avformat/dtsdec: Extend DTS core sync word
authorfoo86 <foobaz86@gmail.com>
Tue, 28 Apr 2015 14:47:53 +0000 (17:47 +0300)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 28 Apr 2015 17:29:47 +0000 (19:29 +0200)
Check extended sync word for 16-bit LE and BE core streams to reduce
probability of alias sync detection. Previously sync word extension was
checked only for 14-bit streams.

This follows up the similar change in avcodec/dca_parser.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/dtsdec.c

index 50b14c6..da0fb61 100644 (file)
@@ -50,9 +50,11 @@ static int dts_probe(AVProbeData *p)
             diff += FFABS(((int16_t)AV_RL16(buf)) - (int16_t)AV_RL16(buf-4));
 
         /* regular bitstream */
-        if (state == DCA_SYNCWORD_CORE_BE)
+        if (state == DCA_SYNCWORD_CORE_BE &&
+            (bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00)
             marker = 0;
-        else if (state == DCA_SYNCWORD_CORE_LE)
+        else if (state == DCA_SYNCWORD_CORE_LE &&
+                 (bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC)
             marker = 1;
 
         /* 14 bits big-endian bitstream */