[FFmpeg-devel] [PATCH]Improce auto-detection for cdata files

Mike Melanson mike
Wed Dec 30 22:54:39 CET 2009


Reimar D?ffinger wrote:
> On Wed, Dec 30, 2009 at 08:14:49PM +0000, Carl Eugen Hoyos wrote:
>> Reimar D?ffinger <Reimar.Doeffinger <at> gmx.de> writes:
>>
>>>> -    if (b[0] == 0x04 && (b[1] == 0x00 || b[1] == 0x04 || b[1] == 0x0C))
>>>> +    if (b[0] == 0x04 && (b[1] == 0x00 || b[1] == 0x04 || b[1] == 0x0C) &&
>>>> +        ((uint32_t *)b)[1] == ((uint32_t *)b)[3] && ((uint32_t *)b)[1])
>>>>          return AVPROBE_SCORE_MAX/8;
>>> You should check for a valid sample_rate
>> I totally agree.
>> What are valid sample rates?
> 
> Well, at least != 0. And that check actually should be done in the
> read_header as well since we can get a division by 0 otherwise I think.
> Otherwise I'd suggest to consider < 4000 as valid (since it is only 16
> bit, I wouldn't check for a maximum).

Check out the idcin demuxer where I had to do something similar. I 
bounded the sample rate between 8000..48000 Hz. Sure, sample rates could 
theoretically go much higher in modern practice (96, 192 KHz), but in 
these old DOS games, unlikely.

-- 
     -Mike Melanson



More information about the ffmpeg-devel mailing list