[vlc-devel] [PATCH 1/7] transcode: video: factorize the code to clean the filter chains

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 16:00:23 CEST 2020


---
 modules/stream_out/transcode/video.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ed004363497..f5100184c35 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -402,6 +402,15 @@ static int transcode_video_filters_init( sout_stream_t *p_stream,
     return VLC_SUCCESS;
 }
 
+static void transcode_video_filters_clean( sout_stream_id_sys_t *id )
+{
+    transcode_remove_filters( &id->p_f_chain );
+    transcode_remove_filters( &id->p_conv_nonstatic );
+    transcode_remove_filters( &id->p_conv_static );
+    transcode_remove_filters( &id->p_uf_chain );
+    transcode_remove_filters( &id->p_final_conv_static );
+}
+
 void transcode_video_clean( sout_stream_id_sys_t *id )
 {
     /* Close encoder */
@@ -411,11 +420,7 @@ void transcode_video_clean( sout_stream_id_sys_t *id )
     es_format_Clean( &id->decoder_out );
 
     /* Close filters */
-    transcode_remove_filters( &id->p_f_chain );
-    transcode_remove_filters( &id->p_conv_nonstatic );
-    transcode_remove_filters( &id->p_conv_static );
-    transcode_remove_filters( &id->p_uf_chain );
-    transcode_remove_filters( &id->p_final_conv_static );
+    transcode_video_filters_clean( id );
     if( id->p_spu_blender )
         filter_DeleteBlend( id->p_spu_blender );
     if( id->p_spu )
@@ -555,11 +560,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                             id->decoder_out.video.i_sar_den, p_pic->format.i_sar_den
                         );
                 /* Close filters, encoder format input can't change */
-                transcode_remove_filters( &id->p_f_chain );
-                transcode_remove_filters( &id->p_conv_nonstatic );
-                transcode_remove_filters( &id->p_conv_static );
-                transcode_remove_filters( &id->p_uf_chain );
-                transcode_remove_filters( &id->p_final_conv_static );
+                transcode_video_filters_clean( id );
                 if( id->p_spu_blender )
                     filter_DeleteBlend( id->p_spu_blender );
                 id->p_spu_blender = NULL;
@@ -693,11 +694,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                 goto error;
             transcode_encoder_close( id->encoder );
             /* Close filters */
-            transcode_remove_filters( &id->p_f_chain );
-            transcode_remove_filters( &id->p_conv_nonstatic );
-            transcode_remove_filters( &id->p_conv_static );
-            transcode_remove_filters( &id->p_uf_chain );
-            transcode_remove_filters( &id->p_final_conv_static );
+            transcode_video_filters_clean( id );
             tag_last_block_with_flag( out, BLOCK_FLAG_END_OF_SEQUENCE );
             b_eos = false;
         }
-- 
2.26.2



More information about the vlc-devel mailing list