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

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 18 16:45:10 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..108d11c7469 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_has_chained_pics( 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 = picture_chain_pop_front( &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..53a370cec84 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 = picture_chain_pop_front( &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 = 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