summaryrefslogtreecommitdiff
path: root/libavformat/mlpdec.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-11-17 00:28:58 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2015-11-29 10:41:51 +0100
commit2ea38a946dbd7c4528f5729f494758cfad491fa8 (patch)
tree2cf08eb54fa785685fbfbd0a35b775d3ad812832 /libavformat/mlpdec.c
parentaa427537b529cd584cd73222980286d36a00fe28 (diff)
downloadffmpeg-2ea38a946dbd7c4528f5729f494758cfad491fa8.tar.gz
avformat/mlpdec: consider all valid mlp access units when probing
Fixes probing of truehd/mlp files with a lot of frames in between the major sync frames. The spec allows a distance of up to 128 frames in between major sync frames, which leads to the probing code not reaching the desired score.
Diffstat (limited to 'libavformat/mlpdec.c')
-rw-r--r--libavformat/mlpdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mlpdec.c b/libavformat/mlpdec.c
index 2cce506d48..d82df219d9 100644
--- a/libavformat/mlpdec.c
+++ b/libavformat/mlpdec.c
@@ -29,16 +29,19 @@ static int av_always_inline mlp_thd_probe(AVProbeData *p, uint32_t sync)
{
const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
int frames = 0, valid = 0, size = 0;
+ int nsubframes = 0;
for (buf = p->buf; buf + 8 <= end; buf++) {
if (AV_RB32(buf + 4) == sync) {
frames++;
if (last_buf + size == buf) {
- valid++;
+ valid += 1 + nsubframes / 8;
}
+ nsubframes = 0;
last_buf = buf;
size = (AV_RB16(buf) & 0xfff) * 2;
} else if (buf - last_buf == size) {
+ nsubframes++;
size += (AV_RB16(buf) & 0xfff) * 2;
}
}