[vlc-commits] filter: declare the filter function called in video filter wrappers
Steve Lhomme
git at videolan.org
Tue Oct 13 11:07:03 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Oct 8 11:35:34 2020 +0200| [b850bcff15867417bb1d05f4ab18fcfcc3d66cc9] | committer: Steve Lhomme
filter: declare the filter function called in video filter wrappers
By default it declares a static function. There are new variants for the rare
cases where the function is not static.
For now the function to call cannot return an error to match the existing usage.
Also declare the close function to make sure there's more warnings when it's
used with the wrong callback signature.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b850bcff15867417bb1d05f4ab18fcfcc3d66cc9
---
include/vlc_filter.h | 23 +++++++++++++++++++++--
modules/video_chroma/i420_rgb.c | 18 +++++++++---------
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 88df8ae5da..1f130bcb7a 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -354,7 +354,7 @@ VLC_API void filter_DeleteBlend( vlc_blender_t * );
*
* Currently used by the chroma video filters
*/
-#define VIDEO_FILTER_WRAPPER_CLOSE( name, close_cb ) \
+#define VIDEO_FILTER_WRAPPER_CLOSE_FILT( name, close_cb ) \
static picture_t *name ## _Filter ( filter_t *p_filter, \
picture_t *p_pic ) \
{ \
@@ -371,7 +371,26 @@ VLC_API void filter_DeleteBlend( vlc_blender_t * );
.filter_video = name ## _Filter, .close = close_cb, \
};
-#define VIDEO_FILTER_WRAPPER( name ) VIDEO_FILTER_WRAPPER_CLOSE( name, NULL )
+#define VIDEO_FILTER_WRAPPER_CLOSE( name, close_cb ) \
+ static void name (filter_t *, picture_t *, picture_t *); \
+ static void close_cb (filter_t *); \
+ VIDEO_FILTER_WRAPPER_CLOSE_FILT( name, close_cb )
+
+#define VIDEO_FILTER_WRAPPER( name ) \
+ static void name (filter_t *, picture_t *, picture_t *); \
+ VIDEO_FILTER_WRAPPER_CLOSE_FILT( name, NULL )
+
+/**
+ * Wrappers to use when the filter function is not a static function
+ */
+#define VIDEO_FILTER_WRAPPER_EXT( name ) \
+ void name (filter_t *, picture_t *, picture_t *); \
+ VIDEO_FILTER_WRAPPER_CLOSE_FILT( name, NULL )
+
+#define VIDEO_FILTER_WRAPPER_CLOSE_EXT( name, close_cb ) \
+ void name (filter_t *, picture_t *, picture_t *); \
+ static void close_cb (filter_t *); \
+ VIDEO_FILTER_WRAPPER_CLOSE_FILT( name, close_cb )
/**
* Filter chain management API
diff --git a/modules/video_chroma/i420_rgb.c b/modules/video_chroma/i420_rgb.c
index 4ea5e2cec8..dc79754f6a 100644
--- a/modules/video_chroma/i420_rgb.c
+++ b/modules/video_chroma/i420_rgb.c
@@ -78,16 +78,16 @@ vlc_module_begin ()
vlc_module_end ()
#ifndef PLAIN
-VIDEO_FILTER_WRAPPER_CLOSE( I420_R5G5B5, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_R5G6B5, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_A8R8G8B8, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_R8G8B8A8, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_B8G8R8A8, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_A8B8G8R8, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_R5G5B5, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_R5G6B5, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_A8R8G8B8, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_R8G8B8A8, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_B8G8R8A8, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_A8B8G8R8, Deactivate )
#else
-VIDEO_FILTER_WRAPPER_CLOSE( I420_RGB8, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_RGB16, Deactivate )
-VIDEO_FILTER_WRAPPER_CLOSE( I420_RGB32, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_RGB8, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_RGB16, Deactivate )
+VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_RGB32, Deactivate )
#endif
/*****************************************************************************
More information about the vlc-commits
mailing list