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.
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)
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;
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)
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;
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);
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);
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)
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;
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)
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;