mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 05:45:58 +00:00
qtdemux: handle fragmented files with mdat before moofs
Assume a file with atoms in the following order: moov, mdat, moof, mdat, moof ... The first moov usually doesn't contain any sample entries atoms (or they are all set to 0 length), because the real samples are signaled at the moofs. In push mode, qtdemux parses the moov and then finds the mdat, but then it has 0 entries and assumes it is EOS. This patch makes it continue parsing in case it is a fragmented file so that it might find the moofs and play the media. https://bugzilla.gnome.org/show_bug.cgi?id=710623
This commit is contained in:
parent
0e78ffc9d6
commit
33ebda8ecf
1 changed files with 5 additions and 3 deletions
|
@ -4608,10 +4608,11 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
|
|||
break;
|
||||
}
|
||||
if (fourcc == FOURCC_mdat) {
|
||||
if (demux->n_streams > 0) {
|
||||
gint next_entry = next_entry_size (demux);
|
||||
if (demux->n_streams > 0 && (next_entry != -1 || !demux->fragmented)) {
|
||||
/* we have the headers, start playback */
|
||||
demux->state = QTDEMUX_STATE_MOVIE;
|
||||
demux->neededbytes = next_entry_size (demux);
|
||||
demux->neededbytes = next_entry;
|
||||
demux->mdatleft = size;
|
||||
} else {
|
||||
/* no headers yet, try to get them */
|
||||
|
@ -4675,7 +4676,8 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
|
|||
} else {
|
||||
/* this means we already started buffering and still no moov header,
|
||||
* let's continue buffering everything till we get moov */
|
||||
if (demux->mdatbuffer && (fourcc != FOURCC_moov))
|
||||
if (demux->mdatbuffer && !(fourcc == FOURCC_moov
|
||||
|| fourcc == FOURCC_moof))
|
||||
goto buffer_data;
|
||||
demux->neededbytes = size;
|
||||
demux->state = QTDEMUX_STATE_HEADER;
|
||||
|
|
Loading…
Reference in a new issue