[vlc-commits] filter_chain: add function to get the current output video context
Steve Lhomme
git at videolan.org
Mon Dec 2 13:43:02 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 5 15:36:07 2019 +0100| [651ca66cc7c43f9b217b4d8d8d485808a36c382b] | committer: Steve Lhomme
filter_chain: add function to get the current output video context
Similar to how we get the current output video format.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=651ca66cc7c43f9b217b4d8d8d485808a36c382b
---
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 c1b15920b8..ce49be1be4 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -457,6 +457,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 d1a048be98..9f711c4eb8 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 450987bb47..7b1a0ff63b 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 )
More information about the vlc-commits
mailing list