diff options
author | Edward Hervey <bilboed@bilboed.com> | 2009-04-03 11:04:42 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-04-03 11:04:42 +0200 |
commit | aecf2cc57b81732be9f19451c4edc6c46f95432d (patch) | |
tree | 4871d8c9b4e0d501c8c66d2eabc7ac0708939c8f | |
parent | f55eb98cb1ed8a54514acb790a4652639688b85e (diff) |
gnlcomposition: Fix usage of GstIterator.
Don't allocate unused variables (GValue, return value)
Resync if needed.
-rw-r--r-- | gnl/gnlcomposition.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 07751e0..943be14 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -373,15 +373,16 @@ static void unblock_childs (GnlComposition * comp) { GstIterator *childs; - GstIteratorResult res; - GValue val = { 0 }; - g_value_init (&val, G_TYPE_BOOLEAN); - g_value_set_boolean (&val, FALSE); childs = gst_bin_iterate_elements (GST_BIN (comp)); - res = - gst_iterator_fold (childs, (GstIteratorFoldFunction) unblock_child_pads, - &val, comp); + +retry: + if (G_UNLIKELY (gst_iterator_fold (childs, + (GstIteratorFoldFunction) unblock_child_pads, NULL, + comp) == GST_ITERATOR_RESYNC)) { + gst_iterator_resync (childs); + goto retry; + } gst_iterator_free (childs); } @@ -410,15 +411,15 @@ static void unlock_childs (GnlComposition * comp) { GstIterator *childs; - GstIteratorResult res; - GValue val = { 0 }; - g_value_init (&val, G_TYPE_BOOLEAN); - g_value_set_boolean (&val, FALSE); childs = gst_bin_iterate_elements (GST_BIN (comp)); - res = - gst_iterator_fold (childs, (GstIteratorFoldFunction) unlock_child_state, - &val, NULL); +retry: + if (G_UNLIKELY (gst_iterator_fold (childs, + (GstIteratorFoldFunction) unlock_child_state, NULL, + NULL) == GST_ITERATOR_RESYNC)) { + gst_iterator_resync (childs); + goto retry; + } gst_iterator_free (childs); } @@ -1297,17 +1298,18 @@ gnl_composition_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED:{ GstIterator *childs; - GstIteratorResult res; - GValue val = { 0 }; /* state-lock all elements */ GST_DEBUG_OBJECT (comp, "Setting all childs to READY and locking their state"); - g_value_init (&val, G_TYPE_BOOLEAN); - g_value_set_boolean (&val, FALSE); childs = gst_bin_iterate_elements (GST_BIN (comp)); - res = gst_iterator_fold (childs, - (GstIteratorFoldFunction) lock_child_state, &val, NULL); + retry: + if (G_UNLIKELY (gst_iterator_fold (childs, + (GstIteratorFoldFunction) lock_child_state, NULL, + NULL) == GST_ITERATOR_RESYNC)) { + gst_iterator_resync (childs); + goto retry; + } gst_iterator_free (childs); } |