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

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


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

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 0455215e0e..a8fc52a1b2 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -146,6 +146,9 @@ struct filter_t
      * XXX use filter_GetInputAttachments */
     int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
 
+    /* Internal allocator used when the output cannot provide pictures */
+    struct filter_video_callbacks   video_allocator;
+
     /** Private structure for the owner of the filter */
     filter_owner_t      owner;
 };
@@ -165,6 +168,8 @@ static inline picture_t *filter_NewOwnerPicture( filter_t *p_filter, filter_owne
     picture_t *pic;
     if ( callbacks != NULL && callbacks->video != NULL && callbacks->video->buffer_new != NULL)
         pic = callbacks->video->buffer_new( p_filter, callbacks->sys );
+    else if ( p_filter->video_allocator.buffer_new != NULL )
+        pic = p_filter->video_allocator.buffer_new( p_filter, NULL );
     else
         pic = picture_NewFromFormat( &p_filter->fmt_out.video );
     if( pic == NULL )
-- 
2.17.1



More information about the vlc-devel mailing list