From a38d338dcdc7b26e66006a8dfbfa0695426175f0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 26 Oct 2004 14:41:06 +0000 Subject: [PATCH] ext/ogg/gstoggdemux.c: Fix EOS again. Needs to be done in a better way. We should not remove the pad if there is no n... Original commit message from CVS: * ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_event), (gst_ogg_demux_handle_event), (_find_chain_get_unknown_part), (_find_streams_check), (gst_ogg_demux_push): Fix EOS again. Needs to be done in a better way. We should not remove the pad if there is no new chained stream. --- ChangeLog | 8 ++++++++ ext/ogg/gstoggdemux.c | 26 ++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 937d003232..cb2bbacf4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-10-26 Wim Taymans + + * ext/ogg/gstoggdemux.c: (gst_ogg_demux_src_event), + (gst_ogg_demux_handle_event), (_find_chain_get_unknown_part), + (_find_streams_check), (gst_ogg_demux_push): + Fix EOS again. Needs to be done in a better way. We should not + remove the pad if there is no new chained stream. + 2004-10-26 Iain * ext/ogg/gstoggdemux.c (gst_ogg_pad_new): Free the tag list. diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 7123b71985..87b0e180da 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -559,12 +559,10 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event) GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; - ); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) { FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_FLUSH; - ); + pad->flags |= GST_OGG_PAD_NEEDS_FLUSH;); } GST_DEBUG_OBJECT (ogg, "initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format, @@ -638,8 +636,7 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event) gst_event_unref (event); GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, - pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; - ); + pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;); break; default: gst_pad_event_default (pad, event); @@ -925,8 +922,7 @@ _find_chain_get_unknown_part (GstOggDemux * ogg, gint64 * start, gint64 * end) *end = G_MAXINT64; g_assert (ogg->current_chain >= 0); - FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset); - ); + FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset);); if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) { *end = gst_file_pad_get_length (ogg->sinkpad); @@ -1055,8 +1051,7 @@ _find_streams_check (GstOggDemux * ogg) } else { endpos = G_MAXINT64; FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1, - endpos = MIN (endpos, pad->start_offset); - ); + endpos = MIN (endpos, pad->start_offset);); } if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) { /* have we found the endposition for all streams yet? */ @@ -1365,14 +1360,13 @@ gst_ogg_demux_push (GstOggDemux * ogg, ogg_page * page) if (ogg_page_eos (page)) { GST_DEBUG_OBJECT (ogg, "got EOS for stream with serial %d, sending EOS now", cur->serial); - /* Removing pads while PLAYING doesn't work with current schedulers */ - /* remove from list, as this will never be called again */ + + /* send an EOS before removing this pad */ + if (GST_PAD_IS_USABLE (cur->pad)) + gst_pad_push (cur->pad, GST_DATA (gst_event_new (GST_EVENT_EOS))); + gst_element_remove_pad (GST_ELEMENT (ogg), cur->pad); cur->pad = NULL; -#if 0 - /* this is also not possible because sending EOS this way confuses the scheduler */ - gst_pad_push (cur->pad, GST_DATA (gst_event_new (GST_EVENT_EOS))); -#endif } } static void