From 016e750a41d6bafdea180f1825e9cabbbe5ec2d5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 7 Jun 2011 10:52:02 +0200 Subject: [PATCH] utils: remove proxy_setcaps Remove proxy_setcaps, elements should use the caps event and forward caps themselves. --- gst/gstutils.c | 99 ---------------------------------------------------------- gst/gstutils.h | 1 - 2 files changed, 100 deletions(-) diff --git a/gst/gstutils.c b/gst/gstutils.c index 55d7043..0c3ed81 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -2826,105 +2826,6 @@ error: } } -typedef struct -{ - GstPad *orig; - GstCaps *caps; -} SetCapsFoldData; - -static gboolean -setcaps_fold_func (const GValue * vpad, GValue * ret, SetCapsFoldData * data) -{ - gboolean success = TRUE; - GstPad *pad = g_value_get_object (vpad); - - if (pad != data->orig) { - success = gst_pad_set_caps (pad, data->caps); - g_value_set_boolean (ret, success); - } - - return success; -} - -/** - * gst_pad_proxy_setcaps - * @pad: a #GstPad to proxy from - * @caps: (transfer none): the #GstCaps to link with - * - * Calls gst_pad_set_caps() for every other pad belonging to the - * same element as @pad. If gst_pad_set_caps() fails on any pad, - * the proxy setcaps fails. May be used only during negotiation. - * - * Returns: TRUE if sucessful - */ -gboolean -gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps) -{ - GstElement *element; - GstIterator *iter; - GstIteratorResult res; - GValue ret = { 0, }; - SetCapsFoldData data; - - g_return_val_if_fail (GST_IS_PAD (pad), FALSE); - g_return_val_if_fail (caps != NULL, FALSE); - - GST_CAT_DEBUG (GST_CAT_PADS, "proxying pad link for %s:%s", - GST_DEBUG_PAD_NAME (pad)); - - element = gst_pad_get_parent_element (pad); - if (element == NULL) - return FALSE; - - /* only iterate the pads in the oposite direction */ - if (GST_PAD_IS_SRC (pad)) - iter = gst_element_iterate_sink_pads (element); - else - iter = gst_element_iterate_src_pads (element); - - g_value_init (&ret, G_TYPE_BOOLEAN); - g_value_set_boolean (&ret, TRUE); - data.orig = pad; - data.caps = caps; - - while (1) { - res = gst_iterator_fold (iter, (GstIteratorFoldFunction) setcaps_fold_func, - &ret, &data); - - switch (res) { - case GST_ITERATOR_RESYNC: - /* reset return value */ - g_value_set_boolean (&ret, TRUE); - gst_iterator_resync (iter); - break; - case GST_ITERATOR_DONE: - /* all pads iterated, return collected value */ - goto done; - default: - /* iterator returned _ERROR or premature end with _OK, - * mark an error and exit */ - goto error; - } - } -done: - gst_iterator_free (iter); - - gst_object_unref (element); - - /* ok not to unset the gvalue */ - return g_value_get_boolean (&ret); - - /* ERRORS */ -error: - { - g_warning ("Pad list return error on element %s", - GST_ELEMENT_NAME (element)); - gst_iterator_free (iter); - gst_object_unref (element); - return FALSE; - } -} - /** * gst_pad_query_position: * @pad: a #GstPad to invoke the position query on. diff --git a/gst/gstutils.h b/gst/gstutils.h index 8fba48a..f48b630 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -741,7 +741,6 @@ void gst_element_class_install_std_props (GstElementClass * klass, /* pad functions */ void gst_pad_use_fixed_caps (GstPad *pad); GstCaps* gst_pad_proxy_getcaps (GstPad * pad, GstCaps * filter); -gboolean gst_pad_proxy_setcaps (GstPad * pad, GstCaps * caps); GstElement* gst_pad_get_parent_element (GstPad *pad); -- 2.7.4