diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-02 17:21:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-02 17:21:03 +0200 |
commit | dd551dc7ff510ef74d49ab920e1f4f221292d4db (patch) | |
tree | e7ce078201c0bb86398ec3a0e4cd89d2f1bd5b92 | |
parent | 66627075d960c1c4ce977244a115ba1e82ebab9f (diff) | |
download | ffmpeg-dd551dc7ff510ef74d49ab920e1f4f221292d4db.tar.gz |
avformat/dtsdec: count LE and BE separately in dts_probe()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/dtsdec.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c index 23cbe93516..227a02b5ea 100644 --- a/libavformat/dtsdec.c +++ b/libavformat/dtsdec.c @@ -32,8 +32,8 @@ static int dts_probe(AVProbeData *p) { const uint8_t *buf, *bufp; uint32_t state = -1; - int markers[3] = {0}; - int sum, max; + int markers[4] = {0}; + int sum, max, i; int64_t diff = 0; buf = p->buf; @@ -43,25 +43,29 @@ static int dts_probe(AVProbeData *p) state = (state << 16) | bytestream_get_be16(&bufp); /* regular bitstream */ - if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE) + if (state == DCA_MARKER_RAW_BE) markers[0]++; + if (state == DCA_MARKER_RAW_LE) + markers[1]++; /* 14 bits big-endian bitstream */ if (state == DCA_MARKER_14B_BE) if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0) - markers[1]++; + markers[2]++; /* 14 bits little-endian bitstream */ if (state == DCA_MARKER_14B_LE) if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) - markers[2]++; + markers[3]++; if (buf - p->buf >= 4) diff += FFABS(AV_RL16(buf) - AV_RL16(buf-4)); } - sum = markers[0] + markers[1] + markers[2]; - max = markers[1] > markers[0]; - max = markers[2] > markers[max] ? 2 : max; + sum = markers[0] + markers[1] + markers[2] + markers[3]; + max = 0; + for (i=1; i<4; i++) + if (markers[max] < markers[i]) + max = i; if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && markers[max] * 4 > sum * 3 && diff / p->buf_size > 200) |