video: Some porting bugfixes
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 24 Apr 2012 19:32:08 +0000 (21:32 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 24 Apr 2012 19:32:08 +0000 (21:32 +0200)
gst-libs/gst/video/gstvideodecoder.c
gst-libs/gst/video/gstvideoencoder.c
gst-libs/gst/video/video.c

index 5f1a702..f37fe22 100644 (file)
@@ -841,6 +841,7 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder,
       decoder->priv->current_frame_events =
           g_list_prepend (decoder->priv->current_frame_events, event);
       GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
+      ret = TRUE;
     }
   }
 
@@ -851,7 +852,7 @@ newseg_wrong_format:
     GST_DEBUG_OBJECT (decoder, "received non TIME newsegment");
     gst_event_unref (event);
     /* SWALLOW EVENT */
-    return FALSE;
+    return TRUE;
   }
 }
 
index 47f92dc..2106d20 100644 (file)
@@ -593,14 +593,11 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
   if (!ret)
     GST_WARNING_OBJECT (encoder, "rejected caps %" GST_PTR_FORMAT, caps);
 
-  gst_object_unref (encoder);
-
   return ret;
 
 parse_fail:
   {
     GST_WARNING_OBJECT (encoder, "Failed to parse caps");
-    gst_object_unref (encoder);
     return FALSE;
   }
 }
@@ -630,7 +627,9 @@ gst_video_encoder_proxy_getcaps (GstVideoEncoder * encoder, GstCaps * caps,
   /* Allow downstream to specify width/height/framerate/PAR constraints
    * and forward them upstream for video converters to handle
    */
-  templ_caps = caps ? caps : gst_pad_get_pad_template_caps (encoder->sinkpad);
+  templ_caps =
+      caps ? gst_caps_ref (caps) :
+      gst_pad_get_pad_template_caps (encoder->sinkpad);
   allowed = gst_pad_get_allowed_caps (encoder->srcpad);
 
   if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) {
@@ -836,6 +835,7 @@ gst_video_encoder_sink_event_default (GstVideoEncoder * encoder,
       encoder->priv->at_eos = FALSE;
 
       encoder->input_segment = segment;
+      ret = TRUE;
       GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
       break;
     }
@@ -891,6 +891,7 @@ gst_video_encoder_sink_event_default (GstVideoEncoder * encoder,
       encoder->priv->current_frame_events =
           g_list_prepend (encoder->priv->current_frame_events, event);
       GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
+      ret = TRUE;
     }
   }
 
index ae7dc4e..63a690f 100644 (file)
@@ -853,9 +853,14 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
 
   structure = gst_caps_get_structure (caps, 0);
 
-  if (gst_structure_has_name (structure, "video/x-raw") &&
-      !(s = gst_structure_get_string (structure, "format"))) {
-    goto no_format;
+  if (gst_structure_has_name (structure, "video/x-raw")) {
+    if (!(s = gst_structure_get_string (structure, "format")))
+      goto no_format;
+
+    format = gst_video_format_from_string (s);
+    if (format == GST_VIDEO_FORMAT_UNKNOWN)
+      goto unknown_format;
+
   } else if (g_str_has_prefix (gst_structure_get_name (structure), "video/") ||
       g_str_has_prefix (gst_structure_get_name (structure), "image/")) {
     format = GST_VIDEO_FORMAT_ENCODED;
@@ -863,10 +868,6 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
     goto wrong_name;
   }
 
-  format = gst_video_format_from_string (s);
-  if (format == GST_VIDEO_FORMAT_UNKNOWN)
-    goto unknown_format;
-
   /* width and height are mandatory, except for non-raw-formats */
   if (!gst_structure_get_int (structure, "width", &width) &&
       format != GST_VIDEO_FORMAT_ENCODED)
@@ -1432,6 +1433,7 @@ fill_planes (GstVideoInfo * info)
           info->stride[2] * (GST_ROUND_UP_4 (height) / 4);
       break;
     case GST_VIDEO_FORMAT_ENCODED:
+      break;
     case GST_VIDEO_FORMAT_UNKNOWN:
       GST_ERROR ("invalid format");
       g_warning ("invalid format");