On Thu, Aug 15, 2013 at 04:07:28PM -0400, Justin Ruggles wrote:
> From: Martin Storsjo <[email protected]>
> 
> This can be useful for decoding AAC object types that are not supported
> by the native AAC decoder, e.g. AAC-LD and AAC-ELD.
> ---
> I modified Martin's original patch to update API usage, get channel layout
> information, allow user to set error concealment method, and flush buffers
> on seek.
> 
>  configure                  |   3 +-
>  libavcodec/Makefile        |   1 +
>  libavcodec/allcodecs.c     |   2 +-
>  libavcodec/libfdk-aacdec.c | 296 
> +++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 300 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/libfdk-aacdec.c

Why?  What's the point of this alternative decoder?

> --- /dev/null
> +++ b/libavcodec/libfdk-aacdec.c
> @@ -0,0 +1,296 @@
> +
> +typedef struct AACContext {
> +    const AVClass *class;
> +    HANDLE_AACDECODER handle;
> +    int initialized;
> +    enum ConcealMethod conceal_method;
> +} AACContext;

That would be the fourth AACContext in libavcodec.  Maybe it's time
to use another name.

> +static const AVOption fdk_aac_dec_options[] = {
> +    { "conceal", "Error concealment method", offsetof(AACContext, 
> conceal_method), AV_OPT_TYPE_INT, { .i64 = CONCEAL_METHOD_DEFAULT }, 
> CONCEAL_METHOD_DEFAULT, CONCEAL_METHOD_NB - 1, A|D, "conceal" },
> +    { "default",  "Default",              0, AV_OPT_TYPE_CONST, { .i64 = 
> CONCEAL_METHOD_DEFAULT },              INT_MIN, INT_MAX, A|D, "conceal" },
> +    { "spectral", "Spectral muting",      0, AV_OPT_TYPE_CONST, { .i64 = 
> CONCEAL_METHOD_SPECTRAL_MUTING },      INT_MIN, INT_MAX, A|D, "conceal" },
> +    { "noise",    "Noise Substitution",   0, AV_OPT_TYPE_CONST, { .i64 = 
> CONCEAL_METHOD_NOISE_SUBSTITUTION },   INT_MIN, INT_MAX, A|D, "conceal" },
> +    { "energy",   "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = 
> CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, A|D, "conceal" },
> +    { NULL }
> +};

space around |

> +    switch (channel_counts[ACT_FRONT]) {
> +        case 4:

Indent case at the same level as switch.

> +    if (channel_counts[ACT_BACK] > 0) {
> +        switch (channel_counts[ACT_BACK]) {
> +        case 3:

like here :)

> +    if (!ch_error && av_get_channel_layout_nb_channels(ch_layout) != 
> info->numChannels) {

nit: long line

> +    err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid);
> +    if (err != AAC_DEC_OK) {
> +        av_log(avctx, AV_LOG_ERROR, "Fill failed: %x\n", err);

I'd say the complete name of the function would be better than "Fill".

> +    err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) buf, buf_size, 0);
> +    if (err == AAC_DEC_NOT_ENOUGH_BITS) {
> +        av_free(tmpptr);
> +        return avpkt->size - valid;
> +    }
> +    if (err != AAC_DEC_OK) {
> +        av_log(avctx, AV_LOG_ERROR, "Decode failed: %x\n", err);

same

> +AVCodec ff_libfdk_aac_decoder = {
> +    .name           = "libfdk_aac",
> +    .type           = AVMEDIA_TYPE_AUDIO,
> +    .id             = AV_CODEC_ID_AAC,
> +    .priv_data_size = sizeof(AACContext),
> +    .init           = fdk_aac_decode_init,
> +    .decode         = fdk_aac_decode_frame,
> +    .close          = fdk_aac_decode_close,
> +    .flush          = fdk_aac_decode_flush,
> +    .capabilities   = CODEC_CAP_DR1,
> +    .long_name      = NULL_IF_CONFIG_SMALL("Fraunhofer FDK AAC"),
> +    .priv_class     = &fdk_aac_dec_class,

nit: Move .long_name after .name.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to