basesink: Make GAP events actually trigger preroll

Slightly hacky approach needing refinement
This commit is contained in:
Jan Schmidt 2012-08-31 11:31:45 -07:00
parent 5aefdbaf10
commit 888d9aa4d3

View file

@ -377,7 +377,7 @@ static gboolean gst_base_sink_pad_activate_mode (GstPad * pad,
GstObject * parent, GstPadMode mode, gboolean active);
static gboolean gst_base_sink_default_event (GstBaseSink * basesink,
GstEvent * event);
static GstFlowReturn gst_base_sink_default_wait_eos (GstBaseSink * basesink,
static GstFlowReturn gst_base_sink_default_wait_event (GstBaseSink * basesink,
GstEvent * event);
static gboolean gst_base_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event);
@ -523,7 +523,7 @@ gst_base_sink_class_init (GstBaseSinkClass * klass)
klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_default_get_times);
klass->query = GST_DEBUG_FUNCPTR (gst_base_sink_default_query);
klass->event = GST_DEBUG_FUNCPTR (gst_base_sink_default_event);
klass->wait_eos = GST_DEBUG_FUNCPTR (gst_base_sink_default_wait_eos);
klass->wait_eos = GST_DEBUG_FUNCPTR (gst_base_sink_default_wait_event);
/* Registering debug symbols for function pointers */
GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_fixate);
@ -1758,6 +1758,10 @@ again:
GstClockTime timestamp, duration;
gst_event_parse_gap (event, &timestamp, &duration);
GST_DEBUG_OBJECT (basesink, "Got Gap time %" GST_TIME_FORMAT
" duration %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (duration));
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
start = timestamp;
if (GST_CLOCK_TIME_IS_VALID (duration))
@ -1965,8 +1969,8 @@ gst_base_sink_wait_clock (GstBaseSink * sink, GstClockTime time,
/* FIXME: Casting to GstClockEntry only works because the types
* are the same */
if (G_LIKELY (sink->priv->cached_clock_id != NULL
&& GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->priv->
cached_clock_id) == clock)) {
&& GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->
priv->cached_clock_id) == clock)) {
if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id,
time)) {
gst_clock_id_unref (sink->priv->cached_clock_id);
@ -2792,7 +2796,7 @@ gst_base_sink_flush_stop (GstBaseSink * basesink, GstPad * pad,
}
static GstFlowReturn
gst_base_sink_default_wait_eos (GstBaseSink * basesink, GstEvent * event)
gst_base_sink_default_wait_event (GstBaseSink * basesink, GstEvent * event)
{
GstFlowReturn ret;
gboolean late, step_end;
@ -2911,6 +2915,23 @@ gst_base_sink_default_event (GstBaseSink * basesink, GstEvent * event)
basesink->have_newsegment = TRUE;
GST_OBJECT_UNLOCK (basesink);
break;
case GST_EVENT_GAP:
{
/* FIXME: Rename ->wait_eos to wait_event() and pass GAP to subclass? */
gst_base_sink_default_wait_event (basesink, event);
#if 0
if (G_LIKELY (bclass->wait_eos)) {
GstFlowReturn ret;
ret = bclass->wait_eos (basesink, event);
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
result = FALSE;
goto done;
}
}
#endif
break;
}
case GST_EVENT_TAG:
{
GstTagList *taglist;