[vlc-devel] [PATCH 10/18] filter_chain: add function to get the current output video context

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 15 15:51:12 CET 2019


Similar to how we get the current output video format.
---
 include/vlc_filter.h    |  8 ++++++++
 src/libvlccore.sym      |  1 +
 src/misc/filter_chain.c | 10 ++++++++++
 3 files changed, 19 insertions(+)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index c195766390e..d3ec4665e30 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -430,6 +430,14 @@ VLC_API bool filter_chain_IsEmpty(const filter_chain_t *chain);
  */
 VLC_API const es_format_t *filter_chain_GetFmtOut(const filter_chain_t *chain);
 
+/**
+ * Get last output video context of the last element in the filter chain.
+ * \note doesn't create change the reference count
+ *
+ * \param chain filter chain
+ */
+VLC_API vlc_video_context *filter_chain_GetVideoCtxOut(const filter_chain_t *chain);
+
 /**
  * Apply the filter chain to a video picture.
  *
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index d1a048be988..9f711c4eb81 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -109,6 +109,7 @@ filter_chain_AppendFromString
 filter_chain_Delete
 filter_chain_DeleteFilter
 filter_chain_GetFmtOut
+filter_chain_GetVideoCtxOut
 filter_chain_IsEmpty
 filter_chain_MouseFilter
 filter_chain_NewVideo
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 80e186d3b6b..9a97b1de2e4 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -403,6 +403,16 @@ const es_format_t *filter_chain_GetFmtOut( const filter_chain_t *p_chain )
     return &p_chain->fmt_out;
 }
 
+vlc_video_context *filter_chain_GetVideoCtxOut(const filter_chain_t *p_chain)
+{
+    if( p_chain->last != NULL )
+        return p_chain->last->filter.vctx_out;
+
+    /* No filter was added, the filter chain has no effect, make sure the chromas are compatible */
+    assert(p_chain->fmt_in.video.i_chroma == p_chain->fmt_out.video.i_chroma);
+    return p_chain->vctx_in;
+}
+
 static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic )
 {
     for( ; f != NULL; f = f->next )
-- 
2.17.1



More information about the vlc-devel mailing list