gst_plugins_base/gst/ffmpegcolorspace/gstffmpegcolorspace.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gst_plugins_base/gst/ffmpegcolorspace/gstffmpegcolorspace.c	Fri Mar 19 09:35:09 2010 +0200
+++ b/gst_plugins_base/gst/ffmpegcolorspace/gstffmpegcolorspace.c	Fri Apr 16 15:15:52 2010 +0300
@@ -22,13 +22,13 @@
 /**
  * SECTION:element-ffmpegcolorspace
  *
+ * Convert video frames between a great variety of colorspace formats.
+ *
  * <refsect2>
  * <title>Example launch line</title>
- * <para>
- * <programlisting>
+ * |[
  * gst-launch -v videotestsrc ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! ffmpegcolorspace ! ximagesink
- * </programlisting>
- * </para>
+ * ]|
  * </refsect2>
  */
 
@@ -139,12 +139,9 @@
 gst_ffmpegcsp_transform_caps (GstBaseTransform * btrans,
     GstPadDirection direction, GstCaps * caps)
 {
-  GstFFMpegCsp *space;
   GstCaps *template;
   GstCaps *result;
 
-  space = GST_FFMPEGCSP (btrans);
-
   template = gst_ffmpegcsp_codectype_to_caps (CODEC_TYPE_VIDEO, NULL);
   result = gst_caps_intersect (caps, template);
   gst_caps_unref (template);
@@ -379,7 +376,6 @@
 gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
     guint * size)
 {
-  GstFFMpegCsp *space = NULL;
   GstStructure *structure = NULL;
   AVCodecContext *ctx = NULL;
   gboolean ret = TRUE;
@@ -387,8 +383,6 @@
 
   g_assert (size);
 
-  space = GST_FFMPEGCSP (btrans);
-
   structure = gst_caps_get_structure (caps, 0);
   gst_structure_get_int (structure, "width", &width);
   gst_structure_get_int (structure, "height", &height);
@@ -412,7 +406,8 @@
    * GStreamer currently puts it into the caps as 'palette_data' field,
    * so for paletted data the frame size avpicture_get_size() returns is
    * 1024 bytes larger than what GStreamer expects. */
-  if (gst_structure_has_field (structure, "palette_data")) {
+  if (gst_structure_has_field (structure, "palette_data") &&
+      ctx->pix_fmt == PIX_FMT_PAL8) {
     *size -= 4 * 256;           /* = AVPALETTE_SIZE */
   }