[vlc-commits] picture_chain: pass a vlc_picture_chain_t to vlc_picture_chain_Append

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 14:03:48 2020 +0200| [50773e2028986549fa8dbf804f8fbb29adcd46ce] | committer: Steve Lhomme

picture_chain: pass a vlc_picture_chain_t to vlc_picture_chain_Append

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

 include/vlc_picture.h                | 13 ++++++-------
 modules/hw/mmal/converter.c          |  2 +-
 modules/stream_out/mosaic_bridge.c   |  2 +-
 modules/stream_out/transcode/video.c |  2 +-
 modules/video_filter/fps.c           |  9 +++++----
 src/misc/picture_fifo.c              |  2 +-
 src/video_output/snapshot.c          |  2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 03d7e49266..a71edb56a5 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -237,16 +237,15 @@ static inline picture_t * vlc_picture_chain_PeekFront(vlc_picture_chain_t *chain
  *
  * \return the new tail of the picture chain
  */
-VLC_USED
-static inline picture_t * vlc_picture_chain_Append(picture_t **chain, picture_t *tail,
-                                                   picture_t *pic)
+static inline void vlc_picture_chain_Append(vlc_picture_chain_t *chain,
+                                            picture_t *pic)
 {
-    if (*chain == NULL)
-        *chain = pic;
+    if (chain->front == NULL)
+        chain->front = pic;
     else
-        tail->p_next = pic;
+        chain->tail->p_next = pic;
     pic->p_next = NULL; // we're appending a picture, not a chain
-    return pic;
+    chain->tail = pic;
 }
 
 /**
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index 8b86c68686..2cb494b3aa 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -136,7 +136,7 @@ static void pic_fifo_init(vlc_picture_chain_t * const pf)
 
 static void pic_fifo_put(vlc_picture_chain_t * const pf, picture_t * pic)
 {
-    pf->tail = vlc_picture_chain_Append( &pf->front, pf->tail, pic  );
+    vlc_picture_chain_Append( pf, pic  );
 }
 
 #define SUBS_MAX 3
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index e39fa95541..7a82a0eea7 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -572,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->pictures.tail = vlc_picture_chain_Append( &p_es->pictures.front, p_es->pictures.tail, p_new_pic );
+    vlc_picture_chain_Append( &p_es->pictures, p_new_pic );
     vlc_global_unlock( VLC_MOSAIC_MUTEX );
 }
 
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 5dc572b534..5acec51235 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -151,7 +151,7 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
 
     assert(!picture_HasChainedPics(p_pic));
     vlc_mutex_lock(&id->fifo.lock);
-    id->fifo.pic.tail = vlc_picture_chain_Append( &id->fifo.pic.front, id->fifo.pic.tail, p_pic );
+    vlc_picture_chain_Append( &id->fifo.pic, p_pic );
     vlc_mutex_unlock(&id->fifo.lock);
 }
 
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 4e6a59dfd6..49b0d3b61c 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -111,7 +111,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
     p_sys->p_previous_pic->date = date_Get( &p_sys->next_output_pts );
     date_Increment( &p_sys->next_output_pts, 1 );
 
-    picture_t *last_pic = p_sys->p_previous_pic;
+    vlc_picture_chain_t chain;
+    vlc_picture_chain_Init( &chain );
+    vlc_picture_chain_Append( &chain, p_sys->p_previous_pic );
     /* Duplicating pictures are not that effective and framerate increase
         should be avoided, it's only here as filter should work in that direction too*/
     while( unlikely( (date_Get( &p_sys->next_output_pts ) + p_sys->i_output_frame_interval ) < p_picture->date ) )
@@ -122,13 +124,12 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
         picture_Copy( p_tmp, p_sys->p_previous_pic);
         p_tmp->date = date_Get( &p_sys->next_output_pts );
 
-        last_pic = vlc_picture_chain_Append( &p_sys->p_previous_pic, last_pic, p_tmp );
+        vlc_picture_chain_Append( &chain, p_tmp );
         date_Increment( &p_sys->next_output_pts, 1 );
     }
 
-    last_pic = p_sys->p_previous_pic;
     p_sys->p_previous_pic = p_picture;
-    return last_pic;
+    return chain.front;
 }
 
 static int Open( vlc_object_t *p_this)
diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index 32474fe2ef..076e8d43dd 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -48,7 +48,7 @@ static void PictureFifoReset(picture_fifo_t *fifo)
 static void PictureFifoPush(picture_fifo_t *fifo, picture_t *picture)
 {
     assert(!picture_HasChainedPics(picture));
-    fifo->pics.tail = vlc_picture_chain_Append( &fifo->pics.front, fifo->pics.tail, picture );
+    vlc_picture_chain_Append( &fifo->pics, picture );
 }
 static picture_t *PictureFifoPop(picture_fifo_t *fifo)
 {
diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index a98380d343..910d84a149 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -148,7 +148,7 @@ void vout_snapshot_Set(vout_snapshot_t *snap,
 
         video_format_CopyCrop( &dup->format, fmt );
 
-        snap->pics.tail = vlc_picture_chain_Append( &snap->pics.front, snap->pics.tail, dup );
+        vlc_picture_chain_Append( &snap->pics, dup );
         snap->request_count--;
     }
     vlc_cond_broadcast(&snap->wait);



More information about the vlc-commits mailing list