[vlc-devel] [PATCH 11/14] filter: allow the filter to provide a callback to get output pictures

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


It may allocate a picture each time or pick in a pool.
---
 include/vlc_filter.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index dc1af0b8f7..e6b918d7a4 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -153,6 +153,9 @@ struct filter_t
      * XXX use filter_GetInputAttachments */
     int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
 
+    /* Internal allocator used when the filter owner doesn't provide pictures */
+    struct filter_video_callbacks   filter_allocator;
+
     /** Private structure for the owner of the filter */
     union
     {
@@ -176,7 +179,10 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
     picture_t *pic;
     if ( p_filter->video_owner.video != NULL && p_filter->video_owner.video->buffer_new != NULL)
         pic = p_filter->video_owner.video->buffer_new( p_filter );
+    else if ( p_filter->filter_allocator.buffer_new != NULL )
+        pic = p_filter->filter_allocator.buffer_new( p_filter );
     else
+        // legacy filter owners not setting a default video_allocator
         pic = picture_NewFromFormat( &p_filter->fmt_out.video );
     if( pic == NULL )
         msg_Warn( p_filter, "can't get output picture" );
-- 
2.17.1



More information about the vlc-devel mailing list