[vlc-devel] [PATCH v3 06/24] filter_chain: use the picture_chain API

Steve Lhomme robux4 at ycbcr.xyz
Mon Sep 21 08:29:42 CEST 2020


chained_filter_t::pending represents the picture chain coming from incoming
pictures. It is set using vlc_picture_chain_get_and_reset() which removes a whole
picture chain from a picture, unlike vlc_picture_chain_PopFront which pops only
one picture.
---
 src/misc/filter_chain.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 5465e0c608c..645a27507fd 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -437,8 +437,7 @@ static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic
             msg_Warn( p_filter, "dropping pictures" );
             FilterDeletePictures( f->pending );
         }
-        f->pending = p_pic->p_next;
-        p_pic->p_next = NULL;
+        f->pending = picture_GetAndResetChain( p_pic );
     }
     return p_pic;
 }
@@ -456,8 +455,7 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
         if( !b->pending )
             continue;
         p_pic = b->pending;
-        b->pending = p_pic->p_next;
-        p_pic->p_next = NULL;
+        b->pending = picture_GetAndResetChain( p_pic );
 
         p_pic = FilterChainVideoFilter( b->next, p_pic );
         if( p_pic )
@@ -535,8 +533,7 @@ static void FilterDeletePictures( picture_t *picture )
 {
     while( picture )
     {
-        picture_t *next = picture->p_next;
-        picture_Release( picture );
-        picture = next;
+        picture_t *next = vlc_picture_chain_PopFront( &picture );
+        picture_Release( next );
     }
 }
-- 
2.26.2



More information about the vlc-devel mailing list