[FFmpeg-devel] [PATCH] avcodec_decode_audio4

Martin Storsjö martin
Mon Feb 28 09:49:53 CET 2011


On Sun, 27 Feb 2011, Justin Ruggles wrote:

> I'm sorry this is such a huge patch, but it all needs to be applied at
> the same time in order to work.

Since the code seems to be quite much the same that is added to each 
decoder, would it be possible to keep this at an outer layer until each 
codec needs to do something different with it?

Also, won't this in principle break the ABI of AVCodec (if someone 
implements a codec outside of lavc), since the decode function suddenly is 
supposed to behave in a different way, even if the actual signature isn't 
changed? Although I guess that isn't a supported scenario?

Also:

> diff --git a/libavcodec/g722.c b/libavcodec/g722.c
> index 0efc390..c293f84 100644
> --- a/libavcodec/g722.c
> +++ b/libavcodec/g722.c
>  static av_cold int g722_close(AVCodecContext *avctx)
>  {
>      G722Context *c = avctx->priv_data;
> +    if (avctx->trellis) {
>      int i;
>      for (i = 0; i < 2; i++) {
>          av_freep(&c->paths[i]);
>          av_freep(&c->node_buf[i]);
>          av_freep(&c->nodep_buf[i]);
>      }
> +    }
> +
> +    if (c->frame.data[0])
> +        avctx->release_buffer(avctx, &c->frame);
> +
>      return 0;
>  }

I think the if (trellis) around freeing those data structures is 
unnecessary. The same g722_close function is already used when closing the 
encoder even if trellis wasn't used.

// Martin



More information about the ffmpeg-devel mailing list