On Mon, Dec 9, 2013 at 12:11 PM, Anton Khirnov <[email protected]> wrote:
> av_frame_free() should be used instead.
> ---
> libavcodec/avcodec.h | 4 ++++
> libavcodec/utils.c | 14 ++------------
> 2 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 4ce6d61..fd0ce9c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3112,6 +3112,7 @@ AVFrame *avcodec_alloc_frame(void);
> */
> void avcodec_get_frame_defaults(AVFrame *frame);
>
> +#if FF_API_AVFRAME_LAVC
> /**
> * Free the frame and any dynamically allocated objects in it,
> * e.g. extended_data.
> @@ -3121,8 +3122,11 @@ void avcodec_get_frame_defaults(AVFrame *frame);
> * @warning this function does NOT free the data buffers themselves
> * (it does not know how, since they might have been allocated with
> * a custom get_buffer()).
> + *
> + * @deprecated use av_frame_free()
> */
> void avcodec_free_frame(AVFrame **frame);
> +#endif
You could also add a "attribute_deprecated" here.
>
> /**
> * Initialize the AVCodecContext to use the given AVCodec. Prior to using
> this
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 89d78dd..25f16c0 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -827,22 +827,12 @@ AVFrame *avcodec_alloc_frame(void)
>
> return frame;
> }
> -#endif
>
> void avcodec_free_frame(AVFrame **frame)
> {
> - AVFrame *f;
> -
> - if (!frame || !*frame)
> - return;
> -
> - f = *frame;
> -
> - if (f->extended_data != f->data)
> - av_freep(&f->extended_data);
> -
> - av_freep(frame);
> + av_frame_free(frame);
> }
> +#endif
>
> int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec
> *codec, AVDictionary **options)
> {
> --
Seems ok.
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel