summaryrefslogtreecommitdiff
path: root/libavformat/bit.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-25 05:15:30 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-25 05:33:09 +0200
commitdfc571ff183401f59da1c5ebd7bb853c17a720de (patch)
treea2c0e7352098a6ac8eeefbee298c3bbb1731d9d0 /libavformat/bit.c
parent21922dc5aefa3b5a75420d6f444da6a14e352726 (diff)
downloadffmpeg-dfc571ff183401f59da1c5ebd7bb853c17a720de.tar.gz
bit: rewrite probe
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/bit.c')
-rw-r--r--libavformat/bit.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/libavformat/bit.c b/libavformat/bit.c
index 5fb3d552f3..774ddcb5ae 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -10,19 +10,17 @@
static int probe(AVProbeData *p)
{
- int i;
- i=AV_RL16(&p->buf[0]);
- if(i != SYNC_WORD)
- return 0;
-
- switch(AV_RL16(&p->buf[2]))
- {
- case 0x40:
- case 0x50:
- return AVPROBE_SCORE_MAX/2;
- default:
- return 0;
+ int i, j;
+
+ for(i=0; i+3<p->buf_size && i< 10*0x50; ){
+ if(AV_RL16(&p->buf[0]) != SYNC_WORD)
+ return 0;
+ j=AV_RL16(&p->buf[2]);
+ if(j!=0x40 && j!=0x50)
+ return 0;
+ i+=j;
}
+ return AVPROBE_SCORE_MAX/2;
}
static int read_header(AVFormatContext *s, AVFormatParameters *ap)