[FFmpeg-devel] [PATCH]Improve idcin probe function
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Jun 19 10:04:31 CEST 2013
HI!
Attached patch fixes ticket #2688, I will add the details there later.
Since this is a regression, I plan to backport the patch.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index a4085a9..680b316 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -93,7 +93,7 @@ typedef struct IdcinDemuxContext {
static int idcin_probe(AVProbeData *p)
{
- unsigned int number;
+ unsigned int number, sample_rate;
/*
* This is what you could call a "probabilistic" file check: id CIN
@@ -122,18 +122,18 @@ static int idcin_probe(AVProbeData *p)
return 0;
/* check the audio sample rate */
- number = AV_RL32(&p->buf[8]);
- if ((number != 0) && ((number < 8000) | (number > 48000)))
+ sample_rate = AV_RL32(&p->buf[8]);
+ if ((sample_rate != 0) && ((sample_rate < 8000) | (sample_rate > 48000)))
return 0;
/* check the audio bytes/sample */
number = AV_RL32(&p->buf[12]);
- if (number > 2)
+ if (number > 2 || sample_rate && !number)
return 0;
/* check the audio channels */
number = AV_RL32(&p->buf[16]);
- if (number > 2)
+ if (number > 2 || sample_rate && !number)
return 0;
/* return half certainty since this check is a bit sketchy */
More information about the ffmpeg-devel
mailing list