gst/ffmpegcolorspace/gstffmpegcolorspace.c: Don't ignore return code from ffmpeg...
authorWim Taymans <wim.taymans@gmail.com>
Tue, 28 Feb 2006 10:39:19 +0000 (10:39 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 28 Feb 2006 10:39:19 +0000 (10:39 +0000)
Original commit message from CVS:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_transform):
Don't ignore return code from ffmpeg convert function.

* gst/ffmpegcolorspace/imgconvert.c: (img_convert):
Split out some long statements to ease debugging.

ChangeLog
gst/ffmpegcolorspace/gstffmpegcolorspace.c
gst/ffmpegcolorspace/imgconvert.c

index 20fabf5..8ba94a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-28  Wim Taymans  <wim@fluendo.com>
+
+       * gst/ffmpegcolorspace/gstffmpegcolorspace.c:
+       (gst_ffmpegcsp_transform):
+       Don't ignore return code from ffmpeg convert function.
+
+       * gst/ffmpegcolorspace/imgconvert.c: (img_convert):
+       Split out some long statements to ease debugging.
+
 2006-02-27  Jan Schmidt  <thaytan@mad.scientist.com>
 
        * ext/libvisual/visual.c: (gst_visual_init),
index c5911df..f46b2c6 100644 (file)
@@ -429,6 +429,7 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
     GstBuffer * outbuf)
 {
   GstFFMpegCsp *space;
+  gint result;
 
   space = GST_FFMPEGCSP (btrans);
 
@@ -449,8 +450,10 @@ gst_ffmpegcsp_transform (GstBaseTransform * btrans, GstBuffer * inbuf,
       GST_BUFFER_DATA (outbuf), space->to_pixfmt, space->width, space->height);
 
   /* and convert */
-  img_convert (&space->to_frame, space->to_pixfmt,
+  result = img_convert (&space->to_frame, space->to_pixfmt,
       &space->from_frame, space->from_pixfmt, space->width, space->height);
+  if (result == -1)
+    goto not_supported;
 
   /* copy timestamps */
   gst_buffer_stamp (outbuf, inbuf);
@@ -465,6 +468,12 @@ unknown_format:
         ("attempting to convert colorspaces between unknown formats"));
     return GST_FLOW_NOT_NEGOTIATED;
   }
+not_supported:
+  {
+    GST_ELEMENT_ERROR (space, CORE, NOT_IMPLEMENTED, (NULL),
+        ("cannot convert between formats"));
+    return GST_FLOW_NOT_SUPPORTED;
+  }
 }
 
 gboolean
index dc9cc6c..6d90433 100644 (file)
@@ -2109,6 +2109,7 @@ img_convert (AVPicture * dst, int dst_pix_fmt,
     x_shift = (dst_pix->x_chroma_shift - src_pix->x_chroma_shift);
     y_shift = (dst_pix->y_chroma_shift - src_pix->y_chroma_shift);
     xy_shift = ((x_shift & 0xf) << 4) | (y_shift & 0xf);
+
     /* there must be filters for conversion at least from and to
        YUV444 format */
     switch (xy_shift) {
@@ -2156,11 +2157,15 @@ img_convert (AVPicture * dst, int dst_pix_fmt,
 #define GEN_MASK(x) ((1<<(x))-1)
 #define DIV_ROUND_UP_X(v,x) (((v) + GEN_MASK(x)) >> (x))
 
-    for (i = 1; i <= 2; i++)
+    for (i = 1; i <= 2; i++) {
+      gint w, h;
+
+      w = DIV_ROUND_UP_X (dst_width, dst_pix->x_chroma_shift);
+      h = DIV_ROUND_UP_X (dst_height, dst_pix->y_chroma_shift);
+
       resize_func (dst->data[i], dst->linesize[i],
-          src->data[i], src->linesize[i],
-          DIV_ROUND_UP_X (dst_width, dst_pix->x_chroma_shift),
-          DIV_ROUND_UP_X (dst_height, dst_pix->y_chroma_shift));
+          src->data[i], src->linesize[i], w, h);
+    }
     /* if yuv color space conversion is needed, we do it here on
        the destination image */
     if (dst_pix->color_type != src_pix->color_type) {
@@ -2228,6 +2233,7 @@ no_chroma_filter:
   if (img_convert (tmp, int_pix_fmt,
           src, src_pix_fmt, src_width, src_height) < 0)
     goto fail1;
+
   if (img_convert (dst, dst_pix_fmt,
           tmp, int_pix_fmt, dst_width, dst_height) < 0)
     goto fail1;