diff options
author | Andy Wingo <wingo@pobox.com> | 2007-12-17 14:52:14 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2007-12-17 14:52:14 +0000 |
commit | 5d8d5eb81d5130239de964dd5de42be07bc424e6 (patch) | |
tree | 6e987c24b735ecc1ee152f14c4558f6d9a143220 /gst | |
parent | c9c47b8dce3f3bfc633a5e522d78d4f7cdb767cf (diff) | |
download | gst-plugins-bad-5d8d5eb81d5130239de964dd5de42be07bc424e6.tar.gz gst-plugins-bad-5d8d5eb81d5130239de964dd5de42be07bc424e6.tar.bz2 gst-plugins-bad-5d8d5eb81d5130239de964dd5de42be07bc424e6.zip |
gst/switch/gstswitch.c (gst_stream_selector_block): Implement the block() signal. This implementation will be replace...
Original commit message from CVS:
2007-12-17 Andy Wingo <wingo@pobox.com>
* gst/switch/gstswitch.c (gst_stream_selector_block): Implement
the block() signal. This implementation will be replaced in future
patches, however. Patch 4/12.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/switch/gstswitch.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c index 269ac91e..fefdebac 100644 --- a/gst/switch/gstswitch.c +++ b/gst/switch/gstswitch.c @@ -722,9 +722,57 @@ gst_stream_selector_release_pad (GstElement * element, GstPad * pad) } static void +block_func (GstPad * pad, gboolean blocked, gpointer user_data) +{ + GST_DEBUG_OBJECT (pad, "got blocked = %d", blocked ? 1 : 0); +} + +static void +foreach_set_blocking (GstPad * pad, gpointer user_data) +{ + gboolean block = GPOINTER_TO_INT (user_data); + + gst_pad_set_blocked_async (pad, block, block_func, NULL); +} + +static gboolean +block_all_pads (GstStreamSelector * self, gboolean block) +{ + GstIterator *iter; + GstIteratorResult res; + + iter = gst_element_iterate_sink_pads (GST_ELEMENT (self)); + + while (TRUE) { + res = gst_iterator_foreach (iter, (GFunc) foreach_set_blocking, + GINT_TO_POINTER (block)); + switch (res) { + case GST_ITERATOR_RESYNC: + gst_iterator_resync (iter); + break; + case GST_ITERATOR_DONE: + goto done; + default: + goto error; + } + } + +done: + GST_DEBUG_OBJECT (self, "block_all_pads(%d) succeeded", block); + gst_iterator_free (iter); + return TRUE; + +error: + GST_WARNING_OBJECT (self, "block(%d) signal error: %d", block, res); + gst_iterator_free (iter); + return FALSE; +} + + +static void gst_stream_selector_block (GstStreamSelector * self) { - return; + block_all_pads (self, TRUE); } static void |