From 03921e92a350951da4b6c0d79cc5bacb7d6de7e6 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Fri, 30 May 2008 18:06:45 +0200 Subject: [PATCH] Better signature for MPEG file beginning by a system header start code --- src/file_mpg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file_mpg.c b/src/file_mpg.c index 22f8e5b1..2c500754 100644 --- a/src/file_mpg.c +++ b/src/file_mpg.c @@ -59,6 +59,8 @@ static int header_check_mpg(const unsigned char *buffer, const unsigned int buff * STREAM AND HEADERS * * 0x000001BA pack header start code * * 0x000001BB system header start code * + * 2 bytes: header_size + * 1 byte: stream_id * 0x000001BE padding block start code * * 0x000001BD private 1 block start code * * 0x000001BF private 2 block start code * @@ -75,7 +77,9 @@ static int header_check_mpg(const unsigned char *buffer, const unsigned int buff if(buffer[0]==0x00 && buffer[1]==0x00 && buffer[2]==0x01 && (buffer[3]==0xB0 || (buffer[3]==0xB3 && ((buffer[4]<<8)+(buffer[5]>>8)>0) && ((buffer[5]<<8)+buffer[6]>0)) || - buffer[3]==0xB5 || buffer[3]==0xBA || buffer[3]==0xBB)) + buffer[3]==0xB5 || + buffer[3]==0xBA || + (buffer[3]==0xBB && (buffer[4]<<8)+(buffer[5]>>8)>0 && (buffer[6]&0x80)==0x80))) { reset_file_recovery(file_recovery_new); file_recovery_new->extension=file_hint_mpg.extension;