mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/matroskadec: Fix probing of unknown-length headers
matroska_probe did not support the case of an unknown-length EBML header at all; given that libavformat's Matroska muxer used to produce such files in the streaming case, support for them has been added. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
3c70b941d5
commit
9c6d14ab84
|
@ -1519,9 +1519,14 @@ static int matroska_probe(const AVProbeData *p)
|
||||||
while (n < size)
|
while (n < size)
|
||||||
total = (total << 8) | p->buf[4 + n++];
|
total = (total << 8) | p->buf[4 + n++];
|
||||||
|
|
||||||
|
if (total + 1 == 1ULL << (7 * size)){
|
||||||
|
/* Unknown-length header - simply parse the whole buffer. */
|
||||||
|
total = p->buf_size - 4 - size;
|
||||||
|
} else {
|
||||||
/* Does the probe data contain the whole header? */
|
/* Does the probe data contain the whole header? */
|
||||||
if (p->buf_size < 4 + size + total)
|
if (p->buf_size < 4 + size + total)
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* The header should contain a known document type. For now,
|
/* The header should contain a known document type. For now,
|
||||||
* we don't parse the whole header but simply check for the
|
* we don't parse the whole header but simply check for the
|
||||||
|
|
Loading…
Reference in New Issue