ext/ogg/gstoggdemux.c: Really do nothing when no data is available.

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_iterate):
Really do nothing when no data is available.
Go to the playing state when the stream is not seekable
instead of failing.
This commit is contained in:
Wim Taymans 2004-10-18 13:52:15 +00:00
parent e329258f01
commit 3cffc4f227
2 changed files with 18 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2004-10-18 Wim Taymans <wim@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_iterate):
Really do nothing when no data is available.
Go to the playing state when the stream is not seekable
instead of failing.
2004-10-18 Wim Taymans <wim@fluendo.com> 2004-10-18 Wim Taymans <wim@fluendo.com>
* ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init), * ext/cdaudio/gstcdaudio.c: (_do_init), (gst_cdaudio_base_init),

View file

@ -533,8 +533,7 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event)
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK); GST_OGG_SET_STATE (ogg, GST_OGG_STATE_SEEK);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
);
GST_DEBUG_OBJECT (ogg, GST_DEBUG_OBJECT (ogg,
"initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format, "initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format,
offset); offset);
@ -607,8 +606,7 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event)
gst_event_unref (event); gst_event_unref (event);
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT; pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
);
break; break;
default: default:
gst_pad_event_default (pad, event); gst_pad_event_default (pad, event);
@ -878,8 +876,7 @@ _find_chain_get_unknown_part (GstOggDemux * ogg, gint64 * start, gint64 * end)
*end = G_MAXINT64; *end = G_MAXINT64;
g_assert (ogg->current_chain >= 0); 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) { if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) {
*end = gst_file_pad_get_length (ogg->sinkpad); *end = gst_file_pad_get_length (ogg->sinkpad);
@ -1008,8 +1005,7 @@ _find_streams_check (GstOggDemux * ogg)
} else { } else {
endpos = G_MAXINT64; endpos = G_MAXINT64;
FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1, 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) { if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) {
/* have we found the endposition for all streams yet? */ /* have we found the endposition for all streams yet? */
@ -1081,6 +1077,7 @@ gst_ogg_demux_iterate (GstFilePad * pad)
gst_ogg_demux_eos (ogg); gst_ogg_demux_eos (ogg);
} else { } else {
GST_DEBUG_OBJECT (ogg, "no data available, doing nothing"); GST_DEBUG_OBJECT (ogg, "no data available, doing nothing");
return;
} }
} }
GST_LOG_OBJECT (ogg, "queueing next %u bytes of data", available); GST_LOG_OBJECT (ogg, "queueing next %u bytes of data", available);
@ -1134,9 +1131,9 @@ gst_ogg_demux_iterate (GstFilePad * pad)
break; break;
case 1: case 1:
GST_LOG_OBJECT (ogg, GST_LOG_OBJECT (ogg,
"processing ogg page (serial %d, packet %ld, granule pos %llu, state: %d", "processing ogg page (serial %d, packet %ld, granule pos %llu, state: %d, bos %d)",
ogg_page_serialno (&page), ogg_page_pageno (&page), ogg_page_serialno (&page), ogg_page_pageno (&page),
ogg_page_granulepos (&page), ogg->state); ogg_page_granulepos (&page), ogg->state, ogg_page_bos (&page));
switch (ogg->state) { switch (ogg->state) {
case GST_OGG_STATE_SETUP: case GST_OGG_STATE_SETUP:
if (!setup_funcs[ogg->setup_state].process (ogg, &page)) { if (!setup_funcs[ogg->setup_state].process (ogg, &page)) {
@ -1156,9 +1153,11 @@ gst_ogg_demux_iterate (GstFilePad * pad)
gst_ogg_add_chain (ogg); gst_ogg_add_chain (ogg);
GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT); GST_FLAG_SET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
goto out; goto out;
} } else {
GST_DEBUG_OBJECT (ogg, "stream can not seek");
gst_ogg_add_chain (ogg); gst_ogg_add_chain (ogg);
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY); GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY);
}
/* fall through */ /* fall through */
case GST_OGG_STATE_SEEK: case GST_OGG_STATE_SEEK:
case GST_OGG_STATE_PLAY: case GST_OGG_STATE_PLAY: