[FFmpeg-cvslog] avformat/avr: check channels and bps in probe

Michael Niedermayer git at videolan.org
Mon Nov 11 16:38:54 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov 11 14:51:43 2013 +0100| [650fd9c004e0093dacf928a015947f7490c0dfbf] | committer: Michael Niedermayer

avformat/avr: check channels and bps in probe

Fixes probetest failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=650fd9c004e0093dacf928a015947f7490c0dfbf
---

 libavformat/avr.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/avr.c b/libavformat/avr.c
index 02edf45..a33134e 100644
--- a/libavformat/avr.c
+++ b/libavformat/avr.c
@@ -26,9 +26,15 @@
 
 static int avr_probe(AVProbeData *p)
 {
-    if (AV_RL32(p->buf) == MKTAG('2', 'B', 'I', 'T'))
-        return AVPROBE_SCORE_EXTENSION;
-    return 0;
+    if (AV_RL32(p->buf) != MKTAG('2', 'B', 'I', 'T'))
+        return 0;
+
+    if (!AV_RB16(p->buf+12) || AV_RB16(p->buf+12) > 256) // channels
+        return AVPROBE_SCORE_EXTENSION/2;
+    if (AV_RB16(p->buf+14) > 256) // bps
+        return AVPROBE_SCORE_EXTENSION/2;
+
+    return AVPROBE_SCORE_EXTENSION;
 }
 
 static int avr_read_header(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list