[vlc-devel] [PATCH v2 15/20] filter_chain: separate the picture filtering from filter draining

Steve Lhomme robux4 at ycbcr.xyz
Wed Oct 14 14:39:15 CEST 2020


The draining is done after the picture filtering. This is equivalent to how
a picture was returned with all the chained pictures.

filter_chain_VideoFilter does the same part as filter_chain_VideoFilter() when
called with a NULL picture.

For now filter_chain_VideoFilter() still handles the case where a NULL picture
is used.
---
 include/vlc_filter.h            | 11 ++++++++++-
 src/libvlccore.sym              |  1 +
 src/misc/filter_chain.c         |  6 ++++++
 src/video_output/video_output.c |  2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index e625d44dc62..8465375da7c 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -606,7 +606,16 @@ VLC_API vlc_video_context *filter_chain_GetVideoCtxOut(const filter_chain_t *cha
  * \return modified picture after applying all video filters
  */
 VLC_API picture_t *filter_chain_VideoFilter(filter_chain_t *chain,
-                                            picture_t *pic);
+                                            picture_t *pic) VLC_USED;
+
+/**
+ * Drain the filter chain of remaining processed pictures.
+ *
+ * \param chain pointer to filter chain
+ * \return modified picture after applying all video filters or NULL if there is
+ * nothing left to drain
+ */
+VLC_API picture_t *filter_chain_VideoDrain(filter_chain_t *chain) VLC_USED;
 
 /**
  * Flush a video filter chain.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index cd47af0a2e3..fcf2d41fe9a 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -121,6 +121,7 @@ filter_chain_Reset
 filter_chain_Clear
 filter_chain_SubFilter
 filter_chain_VideoFilter
+filter_chain_VideoDrain
 filter_chain_VideoFlush
 filter_chain_ForEach
 filter_ConfigureBlend
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 4eafffd4d87..d20bfff302a 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -452,6 +452,12 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
         if( p_pic )
             return p_pic;
     }
+    return filter_chain_VideoDrain( p_chain );
+}
+
+picture_t *filter_chain_VideoDrain(filter_chain_t *p_chain)
+{
+    picture_t *p_pic;
     for( chained_filter_t *b = p_chain->last; b != NULL; b = b->prev )
     {
         if( vlc_picture_chain_IsEmpty( &b->pending ) )
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0233e214d9e..3ab17de9161 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1068,7 +1068,7 @@ static int ThreadDisplayPreparePicture(vout_thread_sys_t *vout, bool reuse,
 
     vlc_mutex_lock(&sys->filter.lock);
 
-    picture_t *picture = filter_chain_VideoFilter(sys->filter.chain_static, NULL);
+    picture_t *picture = filter_chain_VideoDrain(sys->filter.chain_static);
     assert(!reuse || !picture);
 
     while (!picture) {
-- 
2.26.2



More information about the vlc-devel mailing list