diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-05-03 16:52:59 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-05-04 11:26:14 +0200 |
commit | 9be4e53001f2bcd6ee5a51a9193d92308148159c (patch) | |
tree | ead0beb699add5206a9b31fff66ed6823c072c9c | |
parent | c4ec1c4c621cddbcec733502c1826af83cc6dbec (diff) |
oggdemux: make event handling better
Explicitly handle FLUSH events and resync on FLUSH_STOP.
Make send_event return a boolean.
Use more performant send_event function to forward events.
-rw-r--r-- | ext/ogg/gstoggdemux.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index ab412f3b3..7d7d5e714 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -1194,7 +1194,7 @@ static gboolean gst_ogg_demux_sink_activate_push (GstPad * sinkpad, gboolean active); static GstStateChangeReturn gst_ogg_demux_change_state (GstElement * element, GstStateChange transition); -static void gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event); +static gboolean gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event); static void gst_ogg_print (GstOggDemux * demux); @@ -1277,17 +1277,23 @@ gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event) ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad)); switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_FLUSH_START: + res = gst_ogg_demux_send_event (ogg, event); + break; + case GST_EVENT_FLUSH_STOP: + GST_DEBUG_OBJECT (ogg, "got a flush stop event"); + ogg_sync_reset (&ogg->sync); + res = gst_ogg_demux_send_event (ogg, event); + break; case GST_EVENT_NEWSEGMENT: - /* FIXME */ GST_DEBUG_OBJECT (ogg, "got a new segment event"); - ogg_sync_reset (&ogg->sync); gst_event_unref (event); res = TRUE; break; case GST_EVENT_EOS: { GST_DEBUG_OBJECT (ogg, "got an EOS event"); - res = gst_pad_event_default (pad, event); + res = gst_ogg_demux_send_event (ogg, event); if (ogg->current_chain == NULL) { GST_ELEMENT_ERROR (ogg, STREAM, DEMUX, (NULL), ("can't get first chain")); @@ -1295,7 +1301,7 @@ gst_ogg_demux_sink_event (GstPad * pad, GstEvent * event) break; } default: - res = gst_pad_event_default (pad, event); + res = gst_ogg_demux_send_event (ogg, event); break; } gst_object_unref (ogg); @@ -2947,10 +2953,11 @@ gst_ogg_demux_chain (GstPad * pad, GstBuffer * buffer) return result; } -static void +static gboolean gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event) { GstOggChain *chain = ogg->current_chain; + gboolean res = TRUE; if (chain) { gint i; @@ -2960,10 +2967,12 @@ gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event) gst_event_ref (event); GST_DEBUG_OBJECT (pad, "Pushing event %" GST_PTR_FORMAT, event); - gst_pad_push_event (GST_PAD (pad), event); + res &= gst_pad_push_event (GST_PAD (pad), event); } } gst_event_unref (event); + + return res; } static GstFlowReturn |