[Libav-user] Hi, question regarding closing a codec context

Jaka Bac jakabac at gmail.com
Wed Aug 23 22:22:49 EEST 2017


On 23 August 2017 at 12:21, Dafna Hirschfeld <dafna3 at gmail.com> wrote:

>  I use the ffmpeg api to decode video.
> After allocating and opening a *AvCodecContext* with *avcodec_open2*,
> then when decoding finishes, is it valid to call just
> *avcodec_flush_buffers* and *avcodec_free_context* without calling
> *avcodec_close* ?
>
> thanks
> Dafna
>


Hi Dafna,

*avcodec_free_context* actually does this:

void avcodec_free_context(AVCodecContext **pavctx)
{
       AVCodecContext *avctx = *pavctx;

       if (!avctx)
           return;

       *avcodec_close(avctx);*

       av_freep(&avctx->extradata);
       av_freep(&avctx->subtitle_header);
       av_freep(&avctx->intra_matrix);
       av_freep(&avctx->inter_matrix);
       av_freep(&avctx->rc_override);

       av_freep(pavctx);
}

>From what I know *avcodec_close* should not be used anymore in the latest
ffmpeg versions.

Jaka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170823/36772c0f/attachment.html>


More information about the Libav-user mailing list