[FFmpeg-devel] [PATCH]Improce auto-detection for cdata files
Thu Dec 31 00:29:09 CET 2009
Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:
> On Wed, Dec 30, 2009 at 08:54:15PM +0100, Carl Eugen Hoyos wrote:
>> Attached patch improves cdata auto-detection (and "fixes" issue 1634 by
>> not trying to decode the sample any more).
>> Details from
>> The new detection passes probetest, and I would like to raise the score to
>> 26, is that ok?
>> Please comment, Carl Eugen
>> Index: libavformat/eacdata.c
>> --- libavformat/eacdata.c (revision 20959)
>> +++ libavformat/eacdata.c (working copy)
>> @@ -39,7 +39,8 @@
>> const uint8_t *b = p->buf;
>> - if (b == 0x04 && (b == 0x00 || b == 0x04 || b == 0x0C))
>> + if (b == 0x04 && (b == 0x00 || b == 0x04 || b == 0x0C) &&
>> + ((uint32_t *)b) == ((uint32_t *)b) && ((uint32_t *)b))
>> return AVPROBE_SCORE_MAX/8;
> You should check for a valid sample_rate (since that is essential for
> decoding), and the new checks for "total samples" should only be used to
> raise the score above AVPROBE_SCORE_MAX/4 (since those are non-essential
> they should not be "required" by the probe if possible).
> Also since speed does not matter, I think
> AV_RB32(b + 4) == AV_RB32(b + 12)
> etc. is more readable than the casts.
Those casts WILL CRASH on some hardware if the data is unaligned. Use
mans at mansr.com
More information about the ffmpeg-devel