[vlc-devel] [PATCH 12/14] filter_chain: add a default implementation for the video_allocator

Steve Lhomme robux4 at ycbcr.xyz
Thu Jul 25 12:34:11 CEST 2019


At some point NULL should not be allowed there.
---
 src/misc/filter_chain.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 6a7b8d7a44..d4652ebf93 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -180,6 +180,11 @@ void filter_chain_Reset( filter_chain_t *p_chain, const es_format_t *p_fmt_in,
     }
 }
 
+static picture_t *DefaultNewPicture( filter_t *filter )
+{
+    return picture_NewFromFormat( &filter->fmt_out.video );
+}
+
 static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
     const char *name, const char *capability, config_chain_t *cfg,
     const es_format_t *fmt_in, const es_format_t *fmt_out )
@@ -232,6 +237,12 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
     if( filter->p_module == NULL )
         goto error;
 
+    if ( filter->filter_allocator.buffer_new == NULL )
+    {
+        // legacy filters not setting a callback to create their output pictures
+        filter->filter_allocator.buffer_new = DefaultNewPicture;
+    }
+
     if( filter->b_allow_fmt_out_change )
     {
         es_format_Clean( &chain->fmt_out );
-- 
2.17.1



More information about the vlc-devel mailing list