elements: Use gst_pad_set_caps() and don't ignore its return value
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Jun 2012 13:45:38 +0000 (15:45 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 8 Jun 2012 13:45:38 +0000 (15:45 +0200)
plugins/elements/gstcapsfilter.c
plugins/elements/gsttypefindelement.c

index 971cb7f..1c585d9 100644 (file)
@@ -305,7 +305,8 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
           GST_PTR_FORMAT " to apply to srcpad", out_caps);
 
       if (!gst_pad_has_current_caps (trans->srcpad))
-        gst_pad_push_event (trans->srcpad, gst_event_new_caps (out_caps));
+        if (!gst_pad_set_caps (trans->srcpad, out_caps))
+          ret = GST_FLOW_NOT_NEGOTIATED;
       gst_caps_unref (out_caps);
     } else {
       gchar *caps_str = gst_caps_to_string (out_caps);
index e6c4de2..2bc5699 100644 (file)
@@ -188,7 +188,7 @@ gst_type_find_element_have_type (GstTypeFindElement * typefind,
   typefind->caps = gst_caps_ref (caps);
   GST_OBJECT_UNLOCK (typefind);
 
-  gst_pad_push_event (typefind->src, gst_event_new_caps (caps));
+  gst_pad_set_caps (typefind->src, caps);
 }
 
 static void
@@ -979,12 +979,12 @@ gst_type_find_element_activate_src_mode (GstPad * pad, GstObject * parent,
        * activation might happen from the streaming thread. */
       gst_pad_pause_task (typefind->sink);
       res = gst_pad_activate_mode (typefind->sink, mode, active);
-      if (typefind->caps) {
+      if (res && typefind->caps) {
         GstCaps *caps;
         GST_OBJECT_LOCK (typefind);
         caps = gst_caps_ref (typefind->caps);
         GST_OBJECT_UNLOCK (typefind);
-        gst_pad_push_event (typefind->src, gst_event_new_caps (caps));
+        res = gst_pad_set_caps (typefind->src, caps);
         gst_caps_unref (caps);
       }
       break;