]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Compute AC3 frame CRC for stronger raw AC3 format probing.
authorandoma <andoma@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 21 Apr 2008 15:20:53 +0000 (15:20 +0000)
committerandoma <andoma@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 21 Apr 2008 15:20:53 +0000 (15:20 +0000)
Closes issue64.

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12920 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/raw.c

index c860b7f54e015dd3fa5d9a1652b643dfb2b021d5..5c188dc92b30a0ab2a2fe5ee5003d6347deead7b 100644 (file)
@@ -22,6 +22,7 @@
 #include "avformat.h"
 #include "ac3_parser.h"
 #include "raw.h"
+#include "crc.h"
 
 #ifdef CONFIG_MUXERS
 /* simple formats */
@@ -429,6 +430,9 @@ static int ac3_probe(AVProbeData *p)
         for(frames = 0; buf2 < end; frames++) {
             if(ff_ac3_parse_header(buf2, &hdr) < 0)
                 break;
+            if(buf2 + hdr.frame_size > end ||
+               av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
+                break;
             buf2 += hdr.frame_size;
         }
         max_frames = FFMAX(max_frames, frames);