From 5e84524d72a17b0c679ede7c0924931e22fce48d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 19 Jun 2012 16:14:46 +0200 Subject: [PATCH] basesink: preroll and sync on gap events --- libs/gst/base/gstbasesink.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index dcf1841..c770472 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -1759,10 +1759,11 @@ gst_base_sink_get_sync_times (GstBaseSink * basesink, GstMiniObject * obj, bclass = GST_BASE_SINK_GET_CLASS (basesink); +again: /* start with nothing */ start = stop = GST_CLOCK_TIME_NONE; + eos = FALSE; -again: if (G_UNLIKELY (GST_IS_EVENT (obj))) { GstEvent *event = GST_EVENT_CAST (obj); @@ -1795,17 +1796,26 @@ again: eos = TRUE; goto eos_done; } + case GST_EVENT_GAP: + { + GstClockTime timestamp, duration; + gst_event_parse_gap (event, ×tamp, &duration); + + if (GST_CLOCK_TIME_IS_VALID (timestamp)) { + start = timestamp; + if (GST_CLOCK_TIME_IS_VALID (duration)) + stop = start + duration; + } + *do_sync = TRUE; + break; + } default: /* other events do not need syncing */ return FALSE; } } else { /* else do buffer sync code */ - GstBuffer *buffer; - - eos = FALSE; - - buffer = GST_BUFFER_CAST (obj); + GstBuffer *buffer = GST_BUFFER_CAST (obj); /* just get the times to see if we need syncing, if the start returns -1 we * don't sync. */ -- 2.7.4