diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-04-30 18:03:37 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-05-04 11:26:14 +0200 |
commit | d9b700392662d31c7ffacdd0f86c7bd2a0b54d7f (patch) | |
tree | 0b6bf88596b3575f31802022b4af3a3e54950a5b /ext/ogg/gstoggdemux.c | |
parent | e879fc9ca3926c29332857d3d1f91689a3e1d473 (diff) |
oggdemux: refactor for seeking in pushmode
refactor the code a little to prepare for seeking in push mode
Diffstat (limited to 'ext/ogg/gstoggdemux.c')
-rw-r--r-- | ext/ogg/gstoggdemux.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index bf4072f24..9b140cbaa 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -311,14 +311,6 @@ gst_ogg_demux_receive_event (GstElement * element, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: - /* can't seek if we are not pullmode, FIXME could pass the - * seek query upstream after converting it to bytes using - * the average bitrate of the stream. */ - if (!ogg->pullmode) { - GST_DEBUG_OBJECT (ogg, "seek on push mode stream not implemented yet"); - goto error; - } - /* now do the seek */ res = gst_ogg_demux_perform_seek (ogg, event); gst_event_unref (event); @@ -349,14 +341,6 @@ gst_ogg_pad_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: - /* can't seek if we are not pullmode, FIXME could pass the - * seek query upstream after converting it to bytes using - * the average bitrate of the stream. */ - if (!ogg->pullmode) { - GST_DEBUG_OBJECT (ogg, "seek on pull mode stream not implemented yet"); - goto error; - } - /* now do the seek */ res = gst_ogg_demux_perform_seek (ogg, event); gst_event_unref (event); @@ -365,19 +349,9 @@ gst_ogg_pad_event (GstPad * pad, GstEvent * event) res = gst_pad_event_default (pad, event); break; } -done: gst_object_unref (ogg); return res; - - /* ERRORS */ -error: - { - GST_DEBUG_OBJECT (ogg, "error handling event"); - gst_event_unref (event); - res = FALSE; - goto done; - } } static void @@ -2039,7 +2013,7 @@ seek_error: /* does not take ownership of the event */ static gboolean -gst_ogg_demux_perform_seek (GstOggDemux * ogg, GstEvent * event) +gst_ogg_demux_perform_seek_pull (GstOggDemux * ogg, GstEvent * event) { GstOggChain *chain = NULL; gboolean res; @@ -2284,6 +2258,29 @@ no_chain: } } +static gboolean +gst_ogg_demux_perform_seek_push (GstOggDemux * ogg, GstEvent * event) +{ + /* can't seek if we are not pullmode, FIXME could pass the + * seek query upstream after converting it to bytes using + * the average bitrate of the stream. */ + return FALSE; +} + +static gboolean +gst_ogg_demux_perform_seek (GstOggDemux * ogg, GstEvent * event) +{ + gboolean res; + + if (ogg->pullmode) { + res = gst_ogg_demux_perform_seek_pull (ogg, event); + } else { + res = gst_ogg_demux_perform_seek_push (ogg, event); + } + return res; +} + + /* finds each bitstream link one at a time using a bisection search * (has to begin by knowing the offset of the lb's initial page). * Recurses for each link so it can alloc the link storage after @@ -3154,7 +3151,7 @@ gst_ogg_demux_loop (GstOggPad * pad) GST_OBJECT_UNLOCK (ogg); /* and seek to configured positions without FLUSH */ - res = gst_ogg_demux_perform_seek (ogg, event); + res = gst_ogg_demux_perform_seek_pull (ogg, event); if (event) gst_event_unref (event); |