[vlc-devel] [PATCH v4 04/24] mosaic: use the picture_chain API

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 21 13:48:02 CEST 2020


p_es->p_picture represents the picture chain and p_es->chain_tail the tail that
is used to append pictures.
---
 modules/spu/mosaic.c               |  7 +++----
 modules/stream_out/mosaic_bridge.c | 13 +++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
index 1b9a1ee8c7c..deecc74e73c 100644
--- a/modules/spu/mosaic.c
+++ b/modules/spu/mosaic.c
@@ -532,11 +532,10 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
         while ( p_es->p_picture != NULL
                  && p_es->p_picture->date + p_sys->i_delay < date )
         {
-            if ( p_es->p_picture->p_next != NULL )
+            if ( picture_HasChainedPics( p_es->p_picture ) )
             {
-                picture_t *p_next = p_es->p_picture->p_next;
-                picture_Release( p_es->p_picture );
-                p_es->p_picture = p_next;
+                picture_t *es_picture = vlc_picture_chain_PopFront( &p_es->p_picture );
+                picture_Release( es_picture );
             }
             else if ( p_es->p_picture->date + p_sys->i_delay + BLANK_DELAY <
                         date )
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index bf05c16a086..daa7ee4ddf5 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -462,9 +462,8 @@ static void Del( sout_stream_t *p_stream, void *id )
     p_es->b_empty = true;
     while ( p_es->p_picture )
     {
-        picture_t *p_next = p_es->p_picture->p_next;
-        picture_Release( p_es->p_picture );
-        p_es->p_picture = p_next;
+        picture_t *es_picture = vlc_picture_chain_PopFront( &p_es->p_picture );
+        picture_Release( es_picture );
     }
 
     for ( i = 0; i < p_bridge->i_es_num; i++ )
@@ -572,11 +571,13 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
     bridged_es_t *p_es = p_sys->p_es;
     vlc_global_lock( VLC_MOSAIC_MUTEX );
     if (p_es->p_picture == NULL)
+    {
         p_es->p_picture = p_new_pic;
+        p_es->tail      = p_new_pic;
+        p_new_pic->p_next = NULL;
+    }
     else
-        p_es->tail->p_next = p_new_pic;
-    p_new_pic->p_next = NULL;
-    p_es->tail = p_new_pic;
+        p_es->tail = vlc_picture_chain_Append( p_es->tail, p_new_pic );
     vlc_global_unlock( VLC_MOSAIC_MUTEX );
 }
 
-- 
2.26.2



More information about the vlc-devel mailing list