[vlc-devel] [PATCH v1 12/33] mosaic_bridge: output the filtered pictures directly into the picture chain

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 16:46:48 CEST 2020


It can handle better the case of filters pushing more than one picture.
---
 modules/stream_out/mosaic_bridge.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 2bfd5a87f53..e4c1a78e173 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -494,6 +494,17 @@ static void Del( sout_stream_t *p_stream, void *id )
     p_sys->b_inited = false;
 }
 
+static int SinkIntoPictureChain(struct vlc_video_sink *sink, picture_t *pic)
+{
+    sout_stream_sys_t *p_sys = sink->sys;
+    /* push the picture in the mosaic-struct structure */
+    bridged_es_t *p_es = p_sys->p_es;
+    vlc_global_lock( VLC_MOSAIC_MUTEX );
+    vlc_picture_chain_Append( &p_es->pictures, pic );
+    vlc_global_unlock( VLC_MOSAIC_MUTEX );
+    return VLC_SUCCESS;
+}
+
 static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
@@ -563,14 +574,11 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
     }
     picture_Release( p_pic );
 
+    struct vlc_video_sink sink_to_chain = { p_sys, SinkIntoPictureChain };
     if( p_sys->p_vf2 )
-        p_new_pic = filter_chain_VideoFilter( p_sys->p_vf2, p_new_pic );
-
-    /* push the picture in the mosaic-struct structure */
-    bridged_es_t *p_es = p_sys->p_es;
-    vlc_global_lock( VLC_MOSAIC_MUTEX );
-    vlc_picture_chain_Append( &p_es->pictures, p_new_pic );
-    vlc_global_unlock( VLC_MOSAIC_MUTEX );
+        filter_chain_VideoFilterInto( p_sys->p_vf2, p_new_pic, &sink_to_chain );
+    else
+        vlc_video_sink_PutPicture( &sink_to_chain, p_new_pic );
 }
 
 static int Send( sout_stream_t *p_stream, void *id, block_t *p_buffer )
-- 
2.26.2



More information about the vlc-devel mailing list