[vlc-devel] [PATCH v1 06/33] filters: allow filters to output multiple pictures without chaining them

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 16:46:42 CEST 2020


The filter chain receives the pictures and puts them in a FIFO (like filters used to)

Ultimately all filters will use this callback.
---
 include/vlc_filter.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 6197cec2c9b..9f8da434fd4 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -79,6 +79,32 @@ typedef struct filter_owner_t
 
 struct vlc_mouse_t;
 
+/**
+ * Video sink to send filtered pictures
+ */
+struct vlc_video_sink
+{
+    void *sys;
+    int (*pf_push_picture)(struct vlc_video_sink *, picture_t *);
+};
+
+/**
+ * Helper function to send pictures to a video sink.
+ *
+ * If sending fails the picture is released.
+ *
+ * \param sink to send the picture into
+ * \param pic the picture to send into the sink
+ * \return VLC_SUCCESS if the picture was used by the sink
+ */
+static inline int vlc_video_sink_PutPicture( struct vlc_video_sink *sink, picture_t *pic )
+{
+    int res = sink->pf_push_picture( sink, pic );
+    if ( res != VLC_SUCCESS )
+        picture_Release( pic );
+    return res;
+}
+
 /** Structure describing a filter
  * @warning BIG FAT WARNING : the code relies on the first 4 members of
  * filter_t and decoder_t to be the same, so if you have anything to add,
@@ -134,6 +160,8 @@ struct filter_t
         /* TODO: video filter drain */
         /** Drain (audio filter) */
         block_t *(*pf_audio_drain) ( filter_t * );
+
+        int (*pf_video_filter_into)( filter_t *, picture_t *, struct vlc_video_sink * );
     };
 
     /** Flush
-- 
2.26.2



More information about the vlc-devel mailing list