[vlc-devel] [PATCH 10/18] transcode:video: clarify the fmt_out init value

Steve Lhomme robux4 at videolabs.io
Mon Jul 17 16:33:16 CEST 2017


no need to set the value 3 times
---
 modules/stream_out/transcode/video.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 5a3cb3b2c2..83d2589856 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -386,12 +386,14 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
 /* Take care of the scaling and chroma conversions. */
 static void conversion_video_filter_append( sout_stream_id_sys_t *id )
 {
-    const es_format_t *p_fmt_out = &id->p_decoder->fmt_out;
-    if( id->p_f_chain )
-        p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
-
+    const es_format_t *p_fmt_out;
     if( id->p_uf_chain )
         p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
+    else if( id->p_f_chain )
+        p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
+    else
+        p_fmt_out = &id->p_decoder->fmt_out;
+
 
     if( ( p_fmt_out->video.i_chroma != id->p_encoder->fmt_in.video.i_chroma ) ||
         ( p_fmt_out->video.i_width != id->p_encoder->fmt_in.video.i_width ) ||
@@ -610,13 +612,13 @@ static void transcode_video_sar_init( sout_stream_t *p_stream,
 static void transcode_video_encoder_init( sout_stream_t *p_stream,
                                           sout_stream_id_sys_t *id )
 {
-    const es_format_t *p_fmt_out = &id->p_decoder->fmt_out;
-    if( id->p_f_chain ) {
-        p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
-    }
-    if( id->p_uf_chain ) {
+    const es_format_t *p_fmt_out;
+    if( id->p_uf_chain )
         p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
-    }
+    else if( id->p_f_chain )
+        p_fmt_out = filter_chain_GetFmtOut( id->p_f_chain );
+    else
+        p_fmt_out = &id->p_decoder->fmt_out;
 
     id->p_encoder->fmt_in.video.orientation =
         id->p_encoder->fmt_out.video.orientation =
-- 
2.12.1



More information about the vlc-devel mailing list