[vlc-devel] [PATCH v4 23/24] snapshot: use the picture_chain API

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


---
 src/video_output/snapshot.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index 7afe4602170..01eed7e275c 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -73,8 +73,7 @@ void vout_snapshot_Destroy(vout_snapshot_t *snap)
         return;
 
     while (snap->picture) {
-        picture_t *picture = snap->picture;
-        snap->picture = picture->p_next;
+        picture_t *picture = vlc_picture_chain_PopFront( &snap->picture );
         picture_Release(picture);
     }
 
@@ -112,10 +111,8 @@ picture_t *vout_snapshot_Get(vout_snapshot_t *snap, vlc_tick_t timeout)
         vlc_cond_timedwait(&snap->wait, &snap->lock, deadline) == 0);
 
     /* */
-    picture_t *picture = snap->picture;
-    if (picture)
-        snap->picture = picture->p_next;
-    else if (snap->request_count > 0)
+    picture_t *picture = vlc_picture_chain_PopFront( &snap->picture );
+    if (!picture && snap->request_count > 0)
         snap->request_count--;
 
     vlc_mutex_unlock(&snap->lock);
@@ -161,8 +158,7 @@ void vout_snapshot_Set(vout_snapshot_t *snap,
         }
         else
         {
-            snap->tail->p_next = dup;
-            snap->tail =  dup;
+            snap->tail = vlc_picture_chain_Append( snap->tail, dup );
         }
         snap->request_count--;
     }
-- 
2.26.2



More information about the vlc-devel mailing list