[FFmpeg-devel] [PATCH 1/2] avcodec/dca_parser: Extend DTS core sync word

foo86 foobaz86 at gmail.com
Tue Apr 28 16:45:35 CEST 2015


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 is sufficient to make the sample in ticket #4492 parse successfully.
The proper solution, however, would involve taking extension sub-stream
length into account by the parser.
---
 libavcodec/dca_parser.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 9797760..41658a5 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -38,7 +38,9 @@ typedef struct DCAParseContext {
 #define IS_MARKER(state, i, buf, buf_size) \
     ((state == DCA_SYNCWORD_CORE_14B_LE && (i < buf_size - 2) && (buf[i + 1] & 0xF0) == 0xF0 &&  buf[i + 2]         == 0x07) || \
      (state == DCA_SYNCWORD_CORE_14B_BE && (i < buf_size - 2) &&  buf[i + 1]         == 0x07 && (buf[i + 2] & 0xF0) == 0xF0) || \
-      state == DCA_SYNCWORD_CORE_LE || state == DCA_SYNCWORD_CORE_BE || state == DCA_SYNCWORD_SUBSTREAM)
+     (state == DCA_SYNCWORD_CORE_LE     && (i < buf_size - 2) && (buf[i + 2] & 0xFC) == 0xFC) || \
+     (state == DCA_SYNCWORD_CORE_BE     && (i < buf_size - 1) && (buf[i + 1] & 0xFC) == 0xFC) || \
+     state == DCA_SYNCWORD_SUBSTREAM)
 
 /**
  * Find the end of the current frame in the bitstream.
-- 
2.1.4



More information about the ffmpeg-devel mailing list