[FFmpeg-devel] [PATCH] avcodec_free_context instead of close+av_free

Michael Niedermayer michael at niedermayer.cc
Sun Jul 12 02:16:56 CEST 2015


On Sat, Jul 11, 2015 at 05:24:02PM +0000, Lectem wrote:
> If I understood the source and documentation correctly, avcodec_free_context should now be used to free a context instead of avcodec_close + av_free.
> ---
>  doc/examples/decoding_encoding.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
> index f6643f6..e257501 100644
> --- a/doc/examples/decoding_encoding.c
> +++ b/doc/examples/decoding_encoding.c
> @@ -232,8 +232,7 @@ static void audio_encode_example(const char *filename)
>  
>      av_freep(&samples);
>      av_frame_free(&frame);
> -    avcodec_close(c);
> -    av_free(c);
> +    avcodec_free_context(c);

avcodec_close takes a AVCodecContext pointer
avcodec_free_context takes a  AVCodecContext pointer to pointer

make sure you test code before submitting it, make sure you correct
every new compiler warning

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150712/9a3218db/attachment.sig>


More information about the ffmpeg-devel mailing list