diff options
author | Edward Hervey <bilboed@bilboed.com> | 2006-02-14 11:24:53 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2006-02-14 11:24:53 +0000 |
commit | 44cded3b2f6b7c2db282402a0532fe6aebf58234 (patch) | |
tree | 4425f17e867acc77a69c9d9210ff7526ce6d4f95 /gst | |
parent | 7e2a049670be750218d37fe1b098f6f5afb53911 (diff) |
gst/qtdemux/qtdemux.c: Handle the case where data atoms are before moov atoms in push-based mode.
Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (next_entry_size), (gst_qtdemux_chain):
Handle the case where data atoms are before moov atoms in push-based mode.
Errors out gracefully.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/qtdemux/qtdemux.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 77458aec..20493379 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -761,7 +761,7 @@ next_entry_size (GstQTDemux * demux) { QtDemuxStream *stream; int i; - int smallidx = 0; + int smallidx = -1; guint64 smalloffs = -1; GST_LOG_OBJECT (demux, "Finding entry at offset %lld", demux->offset); @@ -785,6 +785,8 @@ next_entry_size (GstQTDemux * demux) GST_LOG_OBJECT (demux, "stream %d offset %lld demux->offset :%lld", smallidx, smalloffs, demux->offset); + if (smallidx == -1) + return -1; stream = demux->streams[smallidx]; if (stream->samples[stream->sample_index].offset >= demux->offset) { @@ -826,7 +828,16 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf) /* get fourcc/length, set neededbytes */ extract_initial_length_and_fourcc ((guint8 *) data, &size, &fourcc); - if (fourcc == GST_MAKE_FOURCC ('m', 'd', 'a', 't')) { + GST_DEBUG_OBJECT (demux, + "Peeking found [%" GST_FOURCC_FORMAT "] size:%ld", + GST_FOURCC_ARGS (fourcc), size); + if ((fourcc == GST_MAKE_FOURCC ('m', 'd', 'a', 't'))) { + if (demux->n_streams <= 0) { + GST_ELEMENT_ERROR (demux, STREAM, FAILED, + (NULL), + ("Can't handled files with header after data in push-mode!")); + ret = GST_FLOW_ERROR; + } demux->state = QTDEMUX_STATE_MOVIE; demux->offset += 24; gst_adapter_flush (demux->adapter, 24); |