MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / avcodec_close

Function avcodec_close

libavcodec/utils.c:692–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692av_cold int avcodec_close(AVCodecContext *avctx)
693{
694 /* If there is a user-supplied mutex locking routine, call it. */
695 if (ff_lockmgr_cb) {
696 if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
697 return -1;
698 }
699
700 entangled_thread_counter++;
701 if(entangled_thread_counter != 1){
702 av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
703 entangled_thread_counter--;
704 return -1;
705 }
706
707 if (HAVE_THREADS && avctx->thread_opaque)
708 avcodec_thread_free(avctx);
709 if (avctx->codec && avctx->codec->close)
710 avctx->codec->close(avctx);
711 avcodec_default_free_buffers(avctx);
712 av_freep(&avctx->priv_data);
713 if(avctx->codec && avctx->codec->encode)
714 av_freep(&avctx->extradata);
715 avctx->codec = NULL;
716 entangled_thread_counter--;
717
718 /* Release any user-supplied mutex. */
719 if (ff_lockmgr_cb) {
720 (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
721 }
722 return 0;
723}
724
725AVCodec *avcodec_find_encoder(enum CodecID id)
726{

Callers 11

av_transcodeFunction · 0.85
stream_component_closeFunction · 0.85
close_connectionFunction · 0.85
av_find_stream_infoFunction · 0.85
close_audioFunction · 0.85
close_videoFunction · 0.85
audio_encode_exampleFunction · 0.85
audio_decode_exampleFunction · 0.85
video_encode_exampleFunction · 0.85
video_decode_exampleFunction · 0.85
estimate_best_b_countFunction · 0.85

Calls 4

av_logFunction · 0.85
av_freepFunction · 0.85
avcodec_thread_freeFunction · 0.70

Tested by

no test coverage detected