gst/elements/gsttypefindelement.c: Use gst_pad_use_explicit_caps for src pad.
authorDavid Schleef <ds@schleef.org>
Sat, 3 Jan 2004 10:01:35 +0000 (10:01 +0000)
committerDavid Schleef <ds@schleef.org>
Sat, 3 Jan 2004 10:01:35 +0000 (10:01 +0000)
Original commit message from CVS:
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init):
Use gst_pad_use_explicit_caps for src pad.
* gst/gstpad.c: (gst_pad_try_set_caps):  Check that link exists
before using it.

ChangeLog
gst/elements/gsttypefind.c
gst/elements/gsttypefindelement.c
gst/gstpad.c
plugins/elements/gsttypefind.c
plugins/elements/gsttypefindelement.c

index 9ab5817..93c3b27 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-01-03  David Schleef  <ds@schleef.org>
 
+       * gst/elements/gsttypefindelement.c:
+       (gst_type_find_element_have_type), (gst_type_find_element_init):
+       Use gst_pad_use_explicit_caps for src pad.
+       * gst/gstpad.c: (gst_pad_try_set_caps):  Check that link exists
+       before using it.
+
+2004-01-03  David Schleef  <ds@schleef.org>
+
        * gst/gstelement.c: (gst_element_link_pads_filtered),
        (gst_element_negotiate_pads): Fix to allow DELAYED to indicate
        that linking was successful.
index 8162084..91c6b58 100644 (file)
@@ -152,9 +152,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
   typefind->caps = gst_caps_copy (caps);
-  if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
-    gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
-  }
+  gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
 }
 static void
 gst_type_find_element_base_init (gpointer g_class)
@@ -216,6 +214,7 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
       gst_static_pad_template_get (&type_find_element_src_template), "src");
   gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
   gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
+  gst_pad_use_explicit_caps (typefind->src);
   gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
 
   typefind->caps = NULL;
index 8162084..91c6b58 100644 (file)
@@ -152,9 +152,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
   typefind->caps = gst_caps_copy (caps);
-  if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
-    gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
-  }
+  gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
 }
 static void
 gst_type_find_element_base_init (gpointer g_class)
@@ -216,6 +214,7 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
       gst_static_pad_template_get (&type_find_element_src_template), "src");
   gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
   gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
+  gst_pad_use_explicit_caps (typefind->src);
   gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
 
   typefind->caps = NULL;
index e2bc26b..237239e 100644 (file)
@@ -1268,10 +1268,11 @@ GstPadLinkReturn
 gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps)
 {
   GstPadLink *link;
+  GstPadLink *oldlink;
   GstPadLinkReturn ret;
 
   g_return_val_if_fail (pad != NULL, GST_PAD_LINK_REFUSED);
-  g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_LINK_REFUSED);
+  g_return_val_if_fail (GST_IS_REAL_PAD (pad), GST_PAD_LINK_REFUSED);
   g_return_val_if_fail (!GST_FLAG_IS_SET (pad, GST_PAD_NEGOTIATING),
       GST_PAD_LINK_REFUSED);
 
@@ -1311,8 +1312,9 @@ gst_pad_try_set_caps (GstPad *pad, const GstCaps *caps)
     return GST_PAD_LINK_DELAYED;
   }
 
-  if (GST_REAL_PAD(pad)->link->filtercaps) {
-    link->filtercaps = gst_caps_copy (GST_REAL_PAD(pad)->link->filtercaps);
+  oldlink = GST_REAL_PAD(pad)->link;
+  if (oldlink && oldlink->filtercaps) {
+    link->filtercaps = gst_caps_copy (oldlink->filtercaps);
   }
   if (link->srcpad == pad) {
     link->srccaps = gst_caps_copy(caps);
index 8162084..91c6b58 100644 (file)
@@ -152,9 +152,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
   typefind->caps = gst_caps_copy (caps);
-  if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
-    gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
-  }
+  gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
 }
 static void
 gst_type_find_element_base_init (gpointer g_class)
@@ -216,6 +214,7 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
       gst_static_pad_template_get (&type_find_element_src_template), "src");
   gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
   gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
+  gst_pad_use_explicit_caps (typefind->src);
   gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
 
   typefind->caps = NULL;
index 8162084..91c6b58 100644 (file)
@@ -152,9 +152,7 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   GST_INFO_OBJECT (typefind, "found caps %s", caps_str);
   g_free (caps_str);
   typefind->caps = gst_caps_copy (caps);
-  if (gst_pad_try_set_caps (typefind->src, caps) < GST_PAD_LINK_OK) {
-    gst_element_error (GST_ELEMENT (typefind), "could not set caps on source pad");
-  }
+  gst_pad_set_explicit_caps (typefind->src, gst_caps_copy(caps));
 }
 static void
 gst_type_find_element_base_init (gpointer g_class)
@@ -216,6 +214,7 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
       gst_static_pad_template_get (&type_find_element_src_template), "src");
   gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
   gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
+  gst_pad_use_explicit_caps (typefind->src);
   gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
 
   typefind->caps = NULL;