[vlc-devel] [PATCH 24/25] modules:decoders: only set the codec ID rather than init the whole ES format

Steve Lhomme robux4 at videolabs.io
Mon Jul 10 16:52:28 CEST 2017


It's already initialized when the decoder is created.
---
 modules/codec/kate.c          | 2 +-
 modules/codec/scte18.c        | 2 +-
 modules/codec/scte27.c        | 2 +-
 modules/codec/spudec/spudec.c | 2 +-
 modules/codec/svcdsub.c       | 2 +-
 modules/codec/zvbi.c          | 3 +--
 modules/misc/stats.c          | 2 +-
 7 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/codec/kate.c b/modules/codec/kate.c
index 6717a6dc8c..3b62030534 100644
--- a/modules/codec/kate.c
+++ b/modules/codec/kate.c
@@ -417,7 +417,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
 #endif
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, 0 );
+    p_dec->fmt_out.i_codec = 0; // may vary during the stream
 
     /* add the decoder to the global list */
     decoder_t **list = realloc( kate_decoder_list, (kate_decoder_list_size+1) * sizeof( *list ));
diff --git a/modules/codec/scte18.c b/modules/codec/scte18.c
index cce6ba9495..2a2181fd3b 100644
--- a/modules/codec/scte18.c
+++ b/modules/codec/scte18.c
@@ -236,7 +236,7 @@ static int Open( vlc_object_t *object )
 
     dec->p_sys = p_sys;
     dec->pf_decode = Decode;
-    es_format_Init( &dec->fmt_out, SPU_ES, 0 );
+    dec->fmt_out.i_codec = 0;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/codec/scte27.c b/modules/codec/scte27.c
index bcea12551d..dfc4d94ec3 100644
--- a/modules/codec/scte27.c
+++ b/modules/codec/scte27.c
@@ -503,7 +503,7 @@ static int Open(vlc_object_t *object)
     sys->segment_buffer = NULL;
 
     dec->pf_decode = Decode;
-    es_format_Init(&dec->fmt_out, SPU_ES, VLC_CODEC_YUVP);
+    dec->fmt_out.i_codec = VLC_CODEC_YUVP;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/codec/spudec/spudec.c b/modules/codec/spudec/spudec.c
index 22ce35856c..09aeb376e8 100644
--- a/modules/codec/spudec/spudec.c
+++ b/modules/codec/spudec/spudec.c
@@ -91,7 +91,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_sys->i_spu      = 0;
     p_sys->p_block    = NULL;
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_CODEC_SPU );
+    p_dec->fmt_out.i_codec = VLC_CODEC_SPU;
 
     p_dec->pf_decode    = Decode;
     p_dec->pf_packetize = NULL;
diff --git a/modules/codec/svcdsub.c b/modules/codec/svcdsub.c
index a154bc9cb3..581c9c3059 100644
--- a/modules/codec/svcdsub.c
+++ b/modules/codec/svcdsub.c
@@ -130,7 +130,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     p_sys->i_state = SUBTITLE_BLOCK_EMPTY;
     p_sys->p_spu   = NULL;
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_CODEC_OGT );
+    p_dec->fmt_out.i_codec = VLC_CODEC_OGT;
 
     p_dec->pf_decode    = Decode;
     p_dec->pf_packetize = Packetize;
diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 602bb42b25..343c0bcd4f 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -276,8 +276,7 @@ static int Open( vlc_object_t *p_this )
     /* Listen for keys */
     var_AddCallback( p_dec->obj.libvlc, "key-pressed", EventKey, p_dec );
 
-    es_format_Init( &p_dec->fmt_out, SPU_ES,
-                    p_sys->b_text ? VLC_CODEC_TEXT : VLC_CODEC_RGBA );
+    p_dec->fmt_out.i_codec = p_sys->b_text ? VLC_CODEC_TEXT : VLC_CODEC_RGBA;
 
     p_dec->pf_decode = Decode;
     return VLC_SUCCESS;
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 9fccf5622f..a0401b6da3 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -86,7 +86,7 @@ static int OpenDecoder ( vlc_object_t *p_this )
     p_dec->pf_decode = DecodeBlock;
 
     /* */
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_I420 );
+    p_dec->fmt_out.i_codec = VLC_CODEC_I420;
     p_dec->fmt_out.video.i_width = 100;
     p_dec->fmt_out.video.i_height = 100;
     p_dec->fmt_out.video.i_sar_num = 1;
-- 
2.12.1



More information about the vlc-devel mailing list