diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c index d3c692e1e2..4958d06331 100644 --- a/plugins/elements/gstfunnel.c +++ b/plugins/elements/gstfunnel.c @@ -357,6 +357,7 @@ gst_funnel_src_event (GstPad * pad, GstEvent * event) GstPad *sinkpad; gboolean result = FALSE; gboolean done = FALSE; + GValue value = { 0, }; funnel = gst_pad_get_parent_element (pad); if (G_UNLIKELY (funnel == NULL)) { @@ -367,11 +368,12 @@ gst_funnel_src_event (GstPad * pad, GstEvent * event) iter = gst_element_iterate_sink_pads (funnel); while (!done) { - switch (gst_iterator_next (iter, (gpointer) & sinkpad)) { + switch (gst_iterator_next (iter, &value)) { case GST_ITERATOR_OK: + sinkpad = g_value_get_object (&value); gst_event_ref (event); result |= gst_pad_push_event (sinkpad, event); - gst_object_unref (sinkpad); + g_value_reset (&value); break; case GST_ITERATOR_RESYNC: gst_iterator_resync (iter); @@ -384,6 +386,7 @@ gst_funnel_src_event (GstPad * pad, GstEvent * event) break; } } + g_value_unset (&value); gst_iterator_free (iter); gst_object_unref (funnel); gst_event_unref (event); @@ -392,15 +395,14 @@ gst_funnel_src_event (GstPad * pad, GstEvent * event) } static void -reset_pad (gpointer data, gpointer user_data) +reset_pad (const GValue * data, gpointer user_data) { - GstPad *pad = data; + GstPad *pad = g_value_get_object (data); GstFunnelPad *fpad = GST_FUNNEL_PAD_CAST (pad); GST_OBJECT_LOCK (pad); gst_funnel_pad_reset (fpad); GST_OBJECT_UNLOCK (pad); - gst_object_unref (pad); } static GstStateChangeReturn diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 407f692ebb..4c7c473fd5 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -329,14 +329,17 @@ gst_selector_pad_iterate_linked_pads (GstPad * pad) GstInputSelector *sel; GstPad *otherpad; GstIterator *it; + GValue val = { 0, }; sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad)); if (G_UNLIKELY (sel == NULL)) return NULL; otherpad = gst_input_selector_get_linked_pad (sel, pad, TRUE); - it = gst_iterator_new_single (GST_TYPE_PAD, otherpad, - (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); + g_value_init (&val, GST_TYPE_PAD); + g_value_set_object (&val, otherpad); + it = gst_iterator_new_single (GST_TYPE_PAD, &val); + g_value_unset (&val); if (otherpad) gst_object_unref (otherpad); diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index e70e78e5da..321c2423a9 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -550,6 +550,7 @@ gst_multi_queue_iterate_internal_links (GstPad * pad) GstPad *opad; GstSingleQueue *squeue; GstMultiQueue *mq = GST_MULTI_QUEUE (gst_pad_get_parent (pad)); + GValue val = { 0, }; GST_MULTI_QUEUE_MUTEX_LOCK (mq); squeue = gst_pad_get_element_private (pad); @@ -563,8 +564,10 @@ gst_multi_queue_iterate_internal_links (GstPad * pad) else goto out; - it = gst_iterator_new_single (GST_TYPE_PAD, opad, - (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); + g_value_init (&val, GST_TYPE_PAD); + g_value_set_object (&val, opad); + it = gst_iterator_new_single (GST_TYPE_PAD, &val); + g_value_unset (&val); gst_object_unref (opad); diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index c7161e4564..c768448204 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -472,6 +472,7 @@ gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps) GstTee *tee; gboolean res, done; GstIterator *it; + GValue item = { 0, }; tee = GST_TEE_CAST (GST_PAD_PARENT (pad)); @@ -480,12 +481,10 @@ gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps) res = TRUE; done = FALSE; while (!done && res) { - gpointer item; - switch (gst_iterator_next (it, &item)) { case GST_ITERATOR_OK: - res &= gst_pad_peer_accept_caps (GST_PAD_CAST (item), caps); - gst_object_unref (item); + res &= gst_pad_peer_accept_caps (g_value_get_object (&item), caps); + g_value_reset (&item); break; case GST_ITERATOR_RESYNC: res = TRUE; @@ -500,6 +499,7 @@ gst_tee_sink_acceptcaps (GstPad * pad, GstCaps * caps) break; } } + g_value_unset (&item); gst_iterator_free (it); return res; @@ -864,11 +864,12 @@ cannot_pull_multiple_srcs: } static void -gst_tee_push_eos (GstPad * pad, GstTee * tee) +gst_tee_push_eos (const GValue * vpad, GstTee * tee) { + GstPad *pad = g_value_get_object (vpad); + if (pad != tee->pull_pad) gst_pad_push_event (pad, gst_event_new_eos ()); - gst_object_unref (pad); } static void @@ -877,7 +878,8 @@ gst_tee_pull_eos (GstTee * tee) GstIterator *iter; iter = gst_element_iterate_src_pads (GST_ELEMENT (tee)); - gst_iterator_foreach (iter, (GFunc) gst_tee_push_eos, tee); + gst_iterator_foreach (iter, (GstIteratorForeachFunction) gst_tee_push_eos, + tee); gst_iterator_free (iter); }