mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
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.
This commit is contained in:
parent
c9c47b8dce
commit
5d8d5eb81d
2 changed files with 53 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
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.
|
||||
|
||||
* gst/switch/gstswitch.h (struct _GstStreamSelectorClass): Fix
|
||||
vmethod prototypes.
|
||||
|
||||
|
|
|
@ -721,10 +721,58 @@ gst_stream_selector_release_pad (GstElement * element, GstPad * pad)
|
|||
gst_element_remove_pad (GST_ELEMENT (sel), 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
|
||||
|
|
Loading…
Reference in a new issue