[FFmpeg-devel] [PATCH] Add support for Audible AA files

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Jul 27 02:00:10 CEST 2015


Vesselin Bontchev <vesselin.bontchev <at> yandex.com> writes:

> This patch adds support for Audible AA files.

> +    uint32_t Magic;

This one is unused, please remove it.
And please make all others lower case.
And please avoid CamelCase, use_underscores_instead.
(I actually prefer CamelCase but it is very unusual in 
FFmpeg.)

> +    union {
> +        unsigned char key[16];
> +        uint32_t part[4];
> +    } HeaderKey;

Is this useful?
(I did not really check.)

> +    } else if (!strcmp(codec_name, "acelp85")) {
> +        // 0xC00C
> +        result = 2000;
> +    } else if (!strcmp(codec_name, "acelp85")) {

If I don't miss anything, something is wrong here...

And I think you can use memcmp() here.

> +static void readString(AVIOContext *pb, int size, char *output)
> +{
> +    avio_read(pb, output, size);
> +}

This does not look useful.

> +    unsigned char dst[8];
> +    unsigned char src[8];

This is uint8_t in tea.h, I suggest you use the 
same type here.

> +    avio_rb32(pb); // unidentified integer

Please use avio_skip().

> +    memcpy(output + 0, "\x00\x00",    2); // purely for padding purposes

This looks ugly, should be output[0]=output[1]=0; 
or similar imo.

> +        return AVERROR_DECODER_NOT_FOUND;

This should be AVERROR_INVALIDDATA.

> +    if (AV_RB32(buf+4) != AA_MAGIC)
> +        return AVPROBE_SCORE_EXTENSION;

return 0

> +    return AVPROBE_SCORE_MAX;

return MAX/2 for 32bit.

Do you check the length of all strings you are 
reading from the file?

Thank you for your patch, Carl Eugen



More information about the ffmpeg-devel mailing list