[vlc-devel] [PATCH 28/36] filter_chain: add function to get the current output video context
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 21 15:14:19 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 54833538cc1..5cb91cd3380 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -439,6 +439,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 450987bb47a..7b1a0ff63bf 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -412,6 +412,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