[vlc-devel] [PATCH 13/15] filter_chain: allocate pictures using filter_NewOwnerPicture()

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 19 15:32:17 CEST 2019


With a different set of callbacks depending whether it's the last filter (own
callback) or an intermediate filter (default implmentation).
---
 src/misc/filter_chain.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 3367454cbc..95b3a88b5b 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -103,17 +103,16 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *chained_filter, void *s
     picture_t *pic;
     filter_chain_t *chain = sys;
     chained_filter_t *chained = container_of(chained_filter, chained_filter_t, filter);
-    if( chained->next != NULL ||
-        chain->downstream.video == NULL || chain->downstream.video->buffer_new == NULL )
+    if ( chained->next != NULL )
     {
         // HACK as intermediate filters may not have the same video format as
         // the last one handled by the owner
-        pic = picture_NewFromFormat( &chained_filter->fmt_out.video );
+        pic = filter_NewOwnerPicture( chained_filter, NULL );
     }
     else
     {
         // the owner of the chain requires pictures to be grabbed from its callback
-        pic = chain->downstream.video->buffer_new( chained_filter, chain->downstream.sys );
+        pic = filter_NewOwnerPicture( chained_filter, &chain->downstream );
     }
     if( pic == NULL )
         msg_Err( chained_filter, "Failed to allocate picture" );
-- 
2.17.1



More information about the vlc-devel mailing list