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

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 18 16:45:12 CEST 2020


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

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 5465e0c608c..698d9635616 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_get_and_reset_chain( p_pic );
     }
     return p_pic;
 }
@@ -453,11 +452,9 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
     }
     for( chained_filter_t *b = p_chain->last; b != NULL; b = b->prev )
     {
-        if( !b->pending )
+        if( b->pending )
             continue;
-        p_pic = b->pending;
-        b->pending = p_pic->p_next;
-        p_pic->p_next = NULL;
+        p_pic = picture_chain_pop_front( &b->pending );
 
         p_pic = FilterChainVideoFilter( b->next, p_pic );
         if( p_pic )
@@ -535,8 +532,7 @@ static void FilterDeletePictures( picture_t *picture )
 {
     while( picture )
     {
-        picture_t *next = picture->p_next;
-        picture_Release( picture );
-        picture = next;
+        picture_t *next = picture_chain_pop_front( &picture );
+        picture_Release( next );
     }
 }
-- 
2.26.2



More information about the vlc-devel mailing list