mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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.
This commit is contained in:
parent
632461e211
commit
f0df840345
3 changed files with 39 additions and 1 deletions
|
@ -1,5 +1,13 @@
|
||||||
2007-12-17 Andy Wingo <wingo@pobox.com>
|
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/switch/gstswitch.c (gst_stream_selector_class_init)
|
||||||
(gst_stream_selector_get_property): Add last-stop-time readable
|
(gst_stream_selector_get_property): Add last-stop-time readable
|
||||||
property. Patch 6/12.
|
property. Patch 6/12.
|
||||||
|
|
|
@ -314,6 +314,25 @@ gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
|
||||||
return result;
|
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
|
static GstFlowReturn
|
||||||
gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
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);
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
||||||
seg = &selpad->segment;
|
seg = &selpad->segment;
|
||||||
|
|
||||||
|
if (gst_stream_selector_wait (sel, pad))
|
||||||
|
goto ignore;
|
||||||
|
|
||||||
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
|
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||||
|
@ -368,7 +390,6 @@ ignore:
|
||||||
res = GST_FLOW_NOT_LINKED;
|
res = GST_FLOW_NOT_LINKED;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_stream_selector_dispose (GObject * object);
|
static void gst_stream_selector_dispose (GObject * object);
|
||||||
|
@ -497,6 +518,9 @@ gst_stream_selector_init (GstStreamSelector * sel)
|
||||||
sel->active_sinkpad = NULL;
|
sel->active_sinkpad = NULL;
|
||||||
sel->nb_sinkpads = 0;
|
sel->nb_sinkpads = 0;
|
||||||
gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
|
gst_segment_init (&sel->segment, GST_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
|
sel->blocked_cond = g_cond_new ();
|
||||||
|
sel->blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -509,6 +533,11 @@ gst_stream_selector_dispose (GObject * object)
|
||||||
sel->active_sinkpad = NULL;
|
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);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct _GstStreamSelector {
|
||||||
|
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
|
|
||||||
|
GCond *blocked_cond;
|
||||||
gboolean blocked;
|
gboolean blocked;
|
||||||
gboolean pending_stop;
|
gboolean pending_stop;
|
||||||
GstSegment pending_stop_segment;
|
GstSegment pending_stop_segment;
|
||||||
|
|
Loading…
Reference in a new issue