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

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 24 13:06:05 2020 +0200| [e4b105bd97d65c31a83aa3845ed42679611d1894] | committer: Steve Lhomme

snapshot: store the picture chain using vlc_picture_chain_t

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

 src/video_output/snapshot.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index aaa658c851..e415f01602 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -46,9 +46,7 @@ struct vout_snapshot {
 
     bool        is_available;
     int         request_count;
-    picture_t   *picture;
-    picture_t   *tail;
-
+    vlc_picture_chain_t pics;
 };
 
 vout_snapshot_t *vout_snapshot_New(void)
@@ -62,8 +60,7 @@ vout_snapshot_t *vout_snapshot_New(void)
 
     snap->is_available = true;
     snap->request_count = 0;
-    snap->picture = NULL;
-    snap->tail = NULL;
+    vlc_picture_chain_Init( &snap->pics );
     return snap;
 }
 
@@ -72,8 +69,8 @@ void vout_snapshot_Destroy(vout_snapshot_t *snap)
     if (snap == NULL)
         return;
 
-    while (snap->picture) {
-        picture_t *picture = vlc_picture_chain_PopFront( &snap->picture );
+    while ( !vlc_picture_chain_IsEmpty( &snap->pics ) ) {
+        picture_t *picture = vlc_picture_chain_PopFront( &snap->pics.front );
         picture_Release(picture);
     }
 
@@ -107,11 +104,11 @@ picture_t *vout_snapshot_Get(vout_snapshot_t *snap, vlc_tick_t timeout)
     snap->request_count++;
 
     /* */
-    while (snap->is_available && !snap->picture &&
+    while (snap->is_available && vlc_picture_chain_IsEmpty( &snap->pics ) &&
         vlc_cond_timedwait(&snap->wait, &snap->lock, deadline) == 0);
 
     /* */
-    picture_t *picture = vlc_picture_chain_PopFront( &snap->picture );
+    picture_t *picture = vlc_picture_chain_PopFront( &snap->pics.front );
     if (!picture && snap->request_count > 0)
         snap->request_count--;
 
@@ -151,7 +148,7 @@ void vout_snapshot_Set(vout_snapshot_t *snap,
 
         video_format_CopyCrop( &dup->format, fmt );
 
-        snap->tail = vlc_picture_chain_Append( &snap->picture, snap->tail, dup );
+        snap->pics.tail = vlc_picture_chain_Append( &snap->pics.front, snap->pics.tail, dup );
         snap->request_count--;
     }
     vlc_cond_broadcast(&snap->wait);



More information about the vlc-commits mailing list