diff options
author | Andy Wingo <wingo@pobox.com> | 2007-12-17 15:00:15 +0000 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2007-12-17 15:00:15 +0000 |
commit | f0df840345f4b790d7cf119bb87f9dc4ca3b3eae (patch) | |
tree | de25ce997f8a7209d316df9c8aaf8b7e9051aa15 | |
parent | 632461e211200b2293d987c2d48c77f2db89e046 (diff) | |
download | gst-plugins-bad-f0df840345f4b790d7cf119bb87f9dc4ca3b3eae.tar.gz gst-plugins-bad-f0df840345f4b790d7cf119bb87f9dc4ca3b3eae.tar.bz2 gst-plugins-bad-f0df840345f4b790d7cf119bb87f9dc4ca3b3eae.zip |
gst/switch/gstswitch.h (struct _GstStreamSelector): gst/switch/gstswitch.c (gst_stream_selector_wait) (gst_selector_p...
Original commit message from CVS:
2007-12-17 Andy Wingo <wingo@pobox.com>
* gst/switch/gstswitch.h (struct _GstStreamSelector):
* gst/switch/gstswitch.c (gst_stream_selector_wait)
(gst_selector_pad_chain, gst_stream_selector_init)
(gst_stream_selector_dispose): Add infrastructure for new blocking
mechanism that does not use gst_pad_set_blocked, which does not
work on sink pads. Patch 7/12.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gst/switch/gstswitch.c | 31 | ||||
-rw-r--r-- | gst/switch/gstswitch.h | 1 |
3 files changed, 39 insertions, 1 deletions
@@ -1,5 +1,13 @@ 2007-12-17 Andy Wingo <wingo@pobox.com> + * gst/switch/gstswitch.h (struct _GstStreamSelector): + + * gst/switch/gstswitch.c (gst_stream_selector_wait) + (gst_selector_pad_chain, gst_stream_selector_init) + (gst_stream_selector_dispose): Add infrastructure for new blocking + mechanism that does not use gst_pad_set_blocked, which does not + work on sink pads. Patch 7/12. + * gst/switch/gstswitch.c (gst_stream_selector_class_init) (gst_stream_selector_get_property): Add last-stop-time readable property. Patch 6/12. diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c index e7456dce..9201e084 100644 --- a/gst/switch/gstswitch.c +++ b/gst/switch/gstswitch.c @@ -314,6 +314,25 @@ gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset, return result; } +static gboolean +gst_stream_selector_wait (GstStreamSelector * self, GstPad * pad) +{ + gboolean flushing; + + GST_OBJECT_LOCK (self); + + while (self->blocked) + g_cond_wait (self->blocked_cond, GST_OBJECT_GET_LOCK (self)); + + GST_OBJECT_UNLOCK (self); + + GST_OBJECT_LOCK (pad); + flushing = GST_PAD_IS_FLUSHING (pad); + GST_OBJECT_UNLOCK (pad); + + return flushing; +} + static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf) { @@ -328,6 +347,9 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf) selpad = GST_SELECTOR_PAD_CAST (pad); seg = &selpad->segment; + if (gst_stream_selector_wait (sel, pad)) + goto ignore; + active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad); timestamp = GST_BUFFER_TIMESTAMP (buf); @@ -368,7 +390,6 @@ ignore: res = GST_FLOW_NOT_LINKED; goto done; } - } static void gst_stream_selector_dispose (GObject * object); @@ -497,6 +518,9 @@ gst_stream_selector_init (GstStreamSelector * sel) sel->active_sinkpad = NULL; sel->nb_sinkpads = 0; gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED); + + sel->blocked_cond = g_cond_new (); + sel->blocked = FALSE; } static void @@ -509,6 +533,11 @@ gst_stream_selector_dispose (GObject * object) sel->active_sinkpad = NULL; } + if (sel->blocked_cond) { + g_cond_free (sel->blocked_cond); + sel->blocked_cond = NULL; + } + G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/gst/switch/gstswitch.h b/gst/switch/gstswitch.h index 3bb88204..7ede7346 100644 --- a/gst/switch/gstswitch.h +++ b/gst/switch/gstswitch.h @@ -49,6 +49,7 @@ struct _GstStreamSelector { GstSegment segment; + GCond *blocked_cond; gboolean blocked; gboolean pending_stop; GstSegment pending_stop_segment; |