[FFmpeg-devel] [PATCH] wavdec: refactor wav_read_header() to make it more readable and display an error message in case an invalid header is detected (the current version just returns AVERROR_INVALIDDATA)

Thomas Volkert silvo at gmx.net
Thu Dec 18 15:28:49 CET 2014


On 18.12.2014 14:17, wm4 wrote:
>
> The commit message subject line should be at most 72 (or was it 60?)
> characters long. The rest should go into the body of the commit message
> (in raw git, the first line of the commit message is the subject, then
> comes an empty line, and the rest is the body of the commit message).
> Makes it more readable in "git log" and other tools.

Yes, I have seen this after the mail was already sent.
It's updated locally.


> -
> -    rf64 = tag == MKTAG('R', 'F', '6', '4');
> -    wav->rifx = tag == MKTAG('R', 'I', 'F', 'X');
> -    if (!rf64 && !wav->rifx && tag != MKTAG('R', 'I', 'F', 'F'))
> +    /* read chunk ID */
> +    switch (avio_rl32(pb)) {
> +    case MKTAG('R', 'I', 'F', 'F'):
> +        break;
> +    case MKTAG('R', 'I', 'F', 'X'):
> +        wav->rifx = 1;
> +        break;
> +    case MKTAG('R', 'F', '6', '4'):
> +        rf64 = 1;
> +        break;
> +    default:
> +        av_log(s, AV_LOG_ERROR, "invalid start code in RIFF header\n");
>           return AVERROR_INVALIDDATA;
> Seems like a good idea... could it print the chunk ID too, or would
> that not be interesting?

We could print these 4 bytes as string to give a hint which format the 
given input file has!?

Best regards,
Thomas.


More information about the ffmpeg-devel mailing list