[vlc-commits] mosaic: store the picture chain using vlc_picture_chain_t

Steve Lhomme git at videolan.org
Tue Oct 6 13:27:17 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 13:00:03 2020 +0200| [151d5d839886d9c979a3edb8e7c430c1563e54a1] | committer: Steve Lhomme

mosaic: store the picture chain using vlc_picture_chain_t

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=151d5d839886d9c979a3edb8e7c430c1563e54a1
---

 modules/spu/mosaic.c               | 12 ++++++------
 modules/spu/mosaic.h               |  3 +--
 modules/stream_out/mosaic_bridge.c |  9 ++++-----
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
index bd9a079155..c1c1965305 100644
--- a/modules/spu/mosaic.c
+++ b/modules/spu/mosaic.c
@@ -529,16 +529,16 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
         if ( p_es->b_empty )
             continue;
 
-        while ( p_es->p_picture != NULL )
+        while ( !vlc_picture_chain_IsEmpty( &p_es->pictures ) )
         {
-            picture_t *front = vlc_picture_chain_PeekFront( &p_es->p_picture );
+            picture_t *front = vlc_picture_chain_PeekFront( &p_es->pictures.front );
             if ( front->date + p_sys->i_delay >= date )
                 break; // front picture not late
 
             if ( picture_HasChainedPics( front ) )
             {
                 // front picture is late and has more pictures chained, skip it
-                front = vlc_picture_chain_PopFront( &p_es->p_picture );
+                front = vlc_picture_chain_PopFront( &p_es->pictures.front );
                 picture_Release( front );
                 continue;
             }
@@ -546,7 +546,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
             if ( front->date + p_sys->i_delay + BLANK_DELAY < date )
             {
                 // front picture is late and too old, don't display it
-                front = vlc_picture_chain_PopFront( &p_es->p_picture );
+                front = vlc_picture_chain_PopFront( &p_es->pictures.front );
                 // the picture chain is empty as the front didn't have chained pics
                 picture_Release( front );
                 break;
@@ -561,7 +561,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
             }
         }
 
-        if ( p_es->p_picture == NULL )
+        if ( vlc_picture_chain_IsEmpty( &p_es->pictures ) )
             continue;
 
         if ( p_sys->i_order_length == 0 )
@@ -589,7 +589,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
         video_format_Init( &fmt_in, 0 );
         video_format_Init( &fmt_out, 0 );
 
-        p_converted = vlc_picture_chain_PeekFront( &p_es->p_picture );
+        p_converted = vlc_picture_chain_PeekFront( &p_es->pictures.front );
         if ( !p_sys->b_keep )
         {
             /* Convert the images */
diff --git a/modules/spu/mosaic.h b/modules/spu/mosaic.h
index cebd24c83a..04bbc6215b 100644
--- a/modules/spu/mosaic.h
+++ b/modules/spu/mosaic.h
@@ -24,8 +24,7 @@
 typedef struct bridged_es_t
 {
     es_format_t fmt;
-    picture_t *p_picture;
-    picture_t *tail;
+    vlc_picture_chain_t pictures;
     bool b_empty;
     char *psz_id;
 
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 5171474320..f298c41764 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -419,8 +419,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
 
     //p_es->fmt = *p_fmt;
     p_es->psz_id = p_sys->psz_id;
-    p_es->p_picture = NULL;
-    p_es->tail = NULL;
+    vlc_picture_chain_Init( &p_es->pictures );
     p_es->b_empty = false;
 
     vlc_global_unlock( VLC_MOSAIC_MUTEX );
@@ -463,9 +462,9 @@ static void Del( sout_stream_t *p_stream, void *id )
     p_es = p_sys->p_es;
 
     p_es->b_empty = true;
-    while ( p_es->p_picture )
+    while ( !vlc_picture_chain_IsEmpty( &p_es->pictures ) )
     {
-        picture_t *es_picture = vlc_picture_chain_PopFront( &p_es->p_picture );
+        picture_t *es_picture = vlc_picture_chain_PopFront( &p_es->pictures.front );
         picture_Release( es_picture );
     }
 
@@ -573,7 +572,7 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
     /* push the picture in the mosaic-struct structure */
     bridged_es_t *p_es = p_sys->p_es;
     vlc_global_lock( VLC_MOSAIC_MUTEX );
-    p_es->tail = vlc_picture_chain_Append( &p_es->p_picture, p_es->tail, p_new_pic );
+    p_es->pictures.tail = vlc_picture_chain_Append( &p_es->pictures.front, p_es->pictures.tail, p_new_pic );
     vlc_global_unlock( VLC_MOSAIC_MUTEX );
 }
 



More information about the vlc-commits mailing list