<div dir="ltr"><div>On 23 August 2017 at 12:21, Dafna Hirschfeld <span dir="ltr"><<a href="mailto:dafna3@gmail.com" target="_blank">dafna3@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> I use the ffmpeg api to decode video.<div>After allocating and opening a <b>AvCodecContext</b> with <b>avcodec_open2</b>, then when decoding finishes, is it valid to call just       <b>avcodec_flush_buffers</b> and <b>avcodec_free_context</b> without calling <b>avcodec_close</b> ?<br></div><div><br></div><div>thanks</div><span class="gmail-HOEnZb"><font color="#888888"><div>Dafna</div></font></span></div></blockquote><div> </div></div><br></div><div class="gmail_extra"><div>Hi Dafna,</div><div><b><br></b></div><b>avcodec_free_context</b> actually does this:<div><br><div><div>void avcodec_free_context(AVCodecContext **pavctx)</div><div>{</div><div>       AVCodecContext *avctx = *pavctx;</div><div>   </div><div>       if (!avctx)</div><div>           return;</div><div>   </div><div>       <b>avcodec_close(avctx);</b></div><div>   </div><div>       av_freep(&avctx->extradata);</div><div>       av_freep(&avctx->subtitle_header);</div><div>       av_freep(&avctx->intra_matrix);</div><div>       av_freep(&avctx->inter_matrix);</div><div>       av_freep(&avctx->rc_override);</div><div>   </div><div>       av_freep(pavctx);</div><div>}</div></div></div><div><br></div><div>From what I know <b>avcodec_close</b> should not be used anymore in the latest ffmpeg versions.</div><div><br></div><div>Jaka<br></div></div></div>