From 599926b18eb3b49c5f8c3de5478ad3f7ea9ac543 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 3 Jan 2004 10:01:35 +0000 Subject: [PATCH] gst/elements/gsttypefindelement.c: Use gst_pad_use_explicit_caps for src pad. 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 | 8 ++++++++ gst/elements/gsttypefind.c | 5 ++--- gst/elements/gsttypefindelement.c | 5 ++--- gst/gstpad.c | 8 +++++--- plugins/elements/gsttypefind.c | 5 ++--- plugins/elements/gsttypefindelement.c | 5 ++--- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ab5817..93c3b27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-01-03 David Schleef + * 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 + * gst/gstelement.c: (gst_element_link_pads_filtered), (gst_element_negotiate_pads): Fix to allow DELAYED to indicate that linking was successful. diff --git a/gst/elements/gsttypefind.c b/gst/elements/gsttypefind.c index 8162084..91c6b58 100644 --- a/gst/elements/gsttypefind.c +++ b/gst/elements/gsttypefind.c @@ -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; diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 8162084..91c6b58 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -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; diff --git a/gst/gstpad.c b/gst/gstpad.c index e2bc26b..237239e 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -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); diff --git a/plugins/elements/gsttypefind.c b/plugins/elements/gsttypefind.c index 8162084..91c6b58 100644 --- a/plugins/elements/gsttypefind.c +++ b/plugins/elements/gsttypefind.c @@ -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; diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 8162084..91c6b58 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -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; -- 2.7.4