[vlc-commits] avcodec: remove ffmpeg_CloseCodec()
Rémi Denis-Courmont
git at videolan.org
Mon Jun 19 19:58:56 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 19 19:46:04 2017 +0300| [2b8f8d1c75f95d2ead6f3a77733de677600ec52e] | committer: Rémi Denis-Courmont
avcodec: remove ffmpeg_CloseCodec()
avcodec_free_context() already takes care to close the context if it was
opened.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b8f8d1c75f95d2ead6f3a77733de677600ec52e
---
modules/codec/avcodec/audio.c | 1 -
modules/codec/avcodec/avcodec.c | 13 -------------
modules/codec/avcodec/avcodec.h | 1 -
modules/codec/avcodec/subtitle.c | 1 -
modules/codec/avcodec/video.c | 7 ++++---
5 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 66131969c4..fc9cab1ce8 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -200,7 +200,6 @@ void EndAudioDec( decoder_t *p_dec )
decoder_sys_t *sys = p_dec->p_sys;
AVCodecContext *ctx = sys->p_context;
- ffmpeg_CloseCodec( p_dec );
avcodec_free_context( &ctx );
free( sys );
}
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index bb3baf02bd..1dc779f2ed 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -385,16 +385,3 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
msg_Dbg( p_dec, "codec (%s) started", p_sys->p_codec->name );
return VLC_SUCCESS;
}
-
-void ffmpeg_CloseCodec( decoder_t *p_dec )
-{
- decoder_sys_t *p_sys = p_dec->p_sys;
-
- if( !avcodec_is_open( p_sys->p_context ) )
- return;
-
- vlc_avcodec_lock();
- avcodec_close( p_sys->p_context );
- vlc_avcodec_unlock();
- msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->p_codec->name );
-}
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 0d049174f3..557b2e0f97 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -48,7 +48,6 @@ void EndSubtitleDec( decoder_t * );
/* Initialize decoder */
int ffmpeg_OpenCodec( decoder_t *p_dec );
-void ffmpeg_CloseCodec( decoder_t *p_dec );
/*****************************************************************************
* Module descriptor help strings
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index 02c4ed955b..dd5c989c12 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -123,7 +123,6 @@ void EndSubtitleDec(decoder_t *dec)
decoder_sys_t *sys = dec->p_sys;
AVCodecContext *ctx = sys->p_context;
- ffmpeg_CloseCodec(dec);
avcodec_free_context(&ctx);
free(sys);
}
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 523c13c743..4e655dc849 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1208,6 +1208,7 @@ void EndVideoDec( decoder_t *p_dec )
{
decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *ctx = p_sys->p_context;
+ void *hwaccel_context;
post_mt( p_sys );
@@ -1219,13 +1220,13 @@ void EndVideoDec( decoder_t *p_dec )
cc_Flush( &p_sys->cc );
- ffmpeg_CloseCodec( p_dec );
+ hwaccel_context = ctx->hwaccel_context;
+ avcodec_free_context( &ctx );
if( p_sys->p_va )
- vlc_va_Delete( p_sys->p_va, ctx->hwaccel_context );
+ vlc_va_Delete( p_sys->p_va, hwaccel_context );
vlc_sem_destroy( &p_sys->sem_mt );
- avcodec_free_context( &ctx );
free( p_sys );
}
More information about the vlc-commits
mailing list