[vlc-commits] avcodec: add explicit subtitle close function

Rémi Denis-Courmont git at videolan.org
Mon Jun 19 19:58:37 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 19 18:45:23 2017 +0300| [04ee03f257328781bfebeae214fdbf99b8324bca] | committer: Rémi Denis-Courmont

avcodec: add explicit subtitle close function

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04ee03f257328781bfebeae214fdbf99b8324bca
---

 modules/codec/avcodec/avcodec.c  | 6 ++++--
 modules/codec/avcodec/avcodec.h  | 1 +
 modules/codec/avcodec/subtitle.c | 5 +++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index e50957d139..a7d9ed768d 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -343,9 +343,11 @@ static void CloseDecoder( vlc_object_t *p_this )
         case AUDIO_ES:
             EndAudioDec( p_dec );
             break;
-        default:
-            ffmpeg_CloseCodec( p_dec );
+        case SPU_ES:
+            EndSubtitleDec( p_dec );
             break;
+        default:
+            vlc_assert_unreachable();
     }
 
     decoder_sys_t *p_sys = p_dec->p_sys;
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index e7d47b889e..530894bfd6 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -44,6 +44,7 @@ void EndAudioDec( decoder_t *p_dec );
 
 /* Subtitle Decoder */
 int InitSubtitleDec( decoder_t *, AVCodecContext *, const AVCodec * );
+void EndSubtitleDec( decoder_t * );
 
 /* Initialize decoder */
 int ffmpeg_OpenCodec( decoder_t *p_dec );
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index e0dedf1d4b..ddb1dd9252 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -119,6 +119,11 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     return VLC_SUCCESS;
 }
 
+void EndSubtitleDec(decoder_t *dec)
+{
+    ffmpeg_CloseCodec(dec);
+}
+
 /**
  * Flush
  */



More information about the vlc-commits mailing list