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

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 13:04:43 2020 +0200| [39b79bfe8c5c80aab0f15ceb05f0d3567a9101b1] | committer: Steve Lhomme

picture_fifo: store the picture chain using vlc_picture_chain_t

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

 src/misc/picture_fifo.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index c2f2df8734..cca4c64d05 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -38,23 +38,21 @@
  *****************************************************************************/
 struct picture_fifo_t {
     vlc_mutex_t lock;
-    picture_t   *first;
-    picture_t   *tail;
+    vlc_picture_chain_t pics;
 };
 
 static void PictureFifoReset(picture_fifo_t *fifo)
 {
-    fifo->first    = NULL;
-    fifo->tail     = NULL;
+    vlc_picture_chain_Init( &fifo->pics );
 }
 static void PictureFifoPush(picture_fifo_t *fifo, picture_t *picture)
 {
     assert(!picture_HasChainedPics(picture));
-    fifo->tail = vlc_picture_chain_Append( &fifo->first, fifo->tail, picture );
+    fifo->pics.tail = vlc_picture_chain_Append( &fifo->pics.front, fifo->pics.tail, picture );
 }
 static picture_t *PictureFifoPop(picture_fifo_t *fifo)
 {
-    return vlc_picture_chain_PopFront( &fifo->first );
+    return vlc_picture_chain_PopFront( &fifo->pics.front );
 }
 
 picture_fifo_t *picture_fifo_New(void)
@@ -85,7 +83,7 @@ picture_t *picture_fifo_Pop(picture_fifo_t *fifo)
 bool picture_fifo_IsEmpty(picture_fifo_t *fifo)
 {
     vlc_mutex_lock(&fifo->lock);
-    bool empty = fifo->first == NULL;
+    bool empty = vlc_picture_chain_IsEmpty( &fifo->pics );
     vlc_mutex_unlock(&fifo->lock);
 
     return empty;
@@ -96,14 +94,14 @@ void picture_fifo_Flush(picture_fifo_t *fifo, vlc_tick_t date, bool flush_before
 
     vlc_mutex_lock(&fifo->lock);
 
-    picture_t *old_chain = fifo->first;
+    vlc_picture_chain_t old_chain = fifo->pics;
     PictureFifoReset(fifo);
 
     picture_fifo_t tmp;
     PictureFifoReset(&tmp);
 
-    while (old_chain) {
-        picture_t *picture = vlc_picture_chain_PopFront( &old_chain );
+    while ( !vlc_picture_chain_IsEmpty( &old_chain ) ) {
+        picture_t *picture = vlc_picture_chain_PopFront( &old_chain.front );
 
         if ((date == VLC_TICK_INVALID) ||
             ( flush_before && picture->date <= date) ||



More information about the vlc-commits mailing list