[FFmpeg-cvslog] Add support for AMR-WB encoding via libvo-amrwbenc

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Apr 12 21:34:07 CEST 2011


On 12 Apr 2011, at 03:50, git at videolan.org (Martin Storsjö) wrote:
> +static const char wb_bitrate_unsupported[] =
> +    "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, "
> +    "18.25k, 19.85k, 23.05k, or 23.85k\n";

Huh, what is that?

> +    /* make the correspondance between bitrate and mode */
> +    AMRWB_bitrates rates[] = { { 6600, 0},
> +                               { 8850, 1},
> +                               {12650, 2},
> +                               {14250, 3},
> +                               {15850, 4},
> +                               {18250, 5},
> +                               {19850, 6},
> +                               {23050, 7},
> +                               {23850, 8}, };

Quite a few compilers will actually make a on-stack copy for that.
It really should static const.
Also it's quite silly with the second value being the index.
And if that function printed the message that string array wouldn't be necessary.

> +static int amr_wb_encode_frame(AVCodecContext *avctx,
> +                               unsigned char *frame/*out*/,
> +                               int buf_size, void *data/*in*/)
> +{
> +    AMRWBContext *s = avctx->priv_data;
> +    int size;
> +
> +    if ((s->mode = getWBBitrateMode(avctx->bit_rate)) < 0) {
> +        av_log(avctx, AV_LOG_ERROR, wb_bitrate_unsupported);
> +        return -1;
> +    }

Failing in the middle of an encode and just because we can't match the bitrate seems a bit extreme and also not very consistent with other codecs that might not take the bitrate very seriously in the first place.
From a user perspective it also means the codec can't be used without special-case code.


More information about the ffmpeg-cvslog mailing list