[vlc-devel] [PATCH 3/7] filters: use macro to set the typed Open callback for generic video filters

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 12 15:59:11 CEST 2020


---
 include/vlc_filter.h                  |  9 +++++
 modules/hw/d3d11/d3d11_filters.c      |  6 ++--
 modules/hw/d3d9/d3d9_filters.c        |  6 ++--
 modules/hw/vaapi/filters.c            | 33 +++++++++----------
 modules/hw/vdpau/adjust.c             |  7 ++--
 modules/hw/vdpau/sharpen.c            |  7 ++--
 modules/spu/audiobargraph_v.c         |  9 +++--
 modules/spu/logo.c                    |  9 +++--
 modules/video_chroma/chain.c          |  9 ++---
 modules/video_filter/adjust.c         | 11 +++----
 modules/video_filter/alphamask.c      |  8 ++---
 modules/video_filter/anaglyph.c       |  9 ++---
 modules/video_filter/antiflicker.c    |  9 ++---
 modules/video_filter/ball.c           | 10 +++---
 modules/video_filter/blendbench.c     | 12 +++----
 modules/video_filter/bluescreen.c     |  8 ++---
 modules/video_filter/canvas.c         |  8 ++---
 modules/video_filter/ci_filters.m     | 47 +++++++++++++--------------
 modules/video_filter/colorthres.c     |  8 ++---
 modules/video_filter/croppadd.c       |  8 ++---
 modules/video_filter/edgedetection.c  |  8 ++---
 modules/video_filter/erase.c          |  8 ++---
 modules/video_filter/extract.c        |  9 ++---
 modules/video_filter/fps.c            |  8 ++---
 modules/video_filter/freeze.c         |  8 ++---
 modules/video_filter/gaussianblur.c   |  9 ++---
 modules/video_filter/gradfun.c        |  8 ++---
 modules/video_filter/gradient.c       |  8 ++---
 modules/video_filter/grain.c          |  9 ++---
 modules/video_filter/hqdn3d.c         |  8 ++---
 modules/video_filter/invert.c         |  8 ++---
 modules/video_filter/magnify.c        |  8 ++---
 modules/video_filter/mirror.c         |  8 ++---
 modules/video_filter/motionblur.c     |  9 ++---
 modules/video_filter/motiondetect.c   |  8 ++---
 modules/video_filter/oldmovie.c       |  8 ++---
 modules/video_filter/opencv_wrapper.c |  8 ++---
 modules/video_filter/posterize.c      |  8 ++---
 modules/video_filter/postproc.c       |  9 ++---
 modules/video_filter/psychedelic.c    |  9 ++---
 modules/video_filter/puzzle.c         |  8 ++---
 modules/video_filter/ripple.c         |  9 ++---
 modules/video_filter/rotate.c         |  8 ++---
 modules/video_filter/scene.c          | 26 +++++++--------
 modules/video_filter/sepia.c          |  8 ++---
 modules/video_filter/sharpen.c        |  9 ++---
 modules/video_filter/transform.c      |  8 ++---
 modules/video_filter/vhs.c            |  8 ++---
 modules/video_filter/wave.c           | 11 +++----
 49 files changed, 196 insertions(+), 298 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index c610680b3a0..63763e02318 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -142,6 +142,7 @@ struct vlc_filter_operations
 
 typedef int (*vlc_open_deinterlace)(filter_t *);
 typedef int (*vlc_video_converter_open)(filter_t *);
+typedef int (*vlc_video_filter_open)(filter_t *);
 
 
 #define set_deinterlace_callback( activate )     \
@@ -153,6 +154,14 @@ typedef int (*vlc_video_converter_open)(filter_t *);
     set_capability( "video filter", 0 )          \
     add_shortcut( "deinterlace" )
 
+#define set_callback_video_filter( activate )              \
+    {                                                      \
+        vlc_video_filter_open open__ = activate;           \
+        (void) open__;                                     \
+        set_callback(activate)                             \
+    }                                                      \
+    set_capability( "video filter", 0 )
+
 #define set_callback_video_converter( activate, priority ) \
     {                                                      \
         vlc_video_converter_open open__ = activate;        \
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index 2c18dbb2a96..f8a0300ab7b 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -366,9 +366,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = Filter, .close = D3D11CloseAdjust,
 };
 
-static int D3D11OpenAdjust(vlc_object_t *obj)
+static int D3D11OpenAdjust(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
     HRESULT hr;
 
     if (!is_d3d11_opaque(filter->fmt_in.video.i_chroma))
@@ -566,10 +565,9 @@ error:
 
 vlc_module_begin()
     set_description(N_("Direct3D11 adjust filter"))
-    set_capability("video filter", 0)
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_callback(D3D11OpenAdjust)
+    set_callback_video_filter(D3D11OpenAdjust)
     add_shortcut( "adjust" )
 
     add_float_with_range( "contrast", 1.0, 0.0, 2.0,
diff --git a/modules/hw/d3d9/d3d9_filters.c b/modules/hw/d3d9/d3d9_filters.c
index db4ede3487e..cb8bf173e24 100644
--- a/modules/hw/d3d9/d3d9_filters.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -275,9 +275,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = Filter, .close = D3D9CloseAdjust,
 };
 
-static int D3D9OpenAdjust(vlc_object_t *obj)
+static int D3D9OpenAdjust(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
     filter_sys_t *sys = NULL;
     HINSTANCE hdecoder_dll = NULL;
     HRESULT hr;
@@ -486,10 +485,9 @@ error:
 
 vlc_module_begin()
     set_description(N_("Direct3D9 adjust filter"))
-    set_capability("video filter", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_callback(D3D9OpenAdjust)
+    set_callback_video_filter(D3D9OpenAdjust)
     add_shortcut( "adjust" )
 
     add_float_with_range( "contrast", 1.0, 0.0, 2.0,
diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index 6b04fe879e2..36477fc213d 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -587,16 +587,15 @@ static const struct vlc_filter_operations Adjust_ops = {
 };
 
 static int
-OpenAdjust(vlc_object_t * obj)
+OpenAdjust(filter_t *filter)
 {
     VAProcPipelineCaps          pipeline_caps;
-    filter_t *const             filter = (filter_t *)obj;
     struct adjust_data *const   p_data = calloc(1, sizeof(*p_data));
     if (!p_data)
         return VLC_ENOMEM;
 
     for (unsigned int i = 0; i < NUM_ADJUST_MODES; ++i)
-        var_Create(obj, adjust_params_names[i],
+        var_Create(filter, adjust_params_names[i],
                    VLC_VAR_FLOAT | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND);
 
     if (Open(filter, VAProcFilterColorBalance, &pipeline_caps, p_data,
@@ -604,7 +603,7 @@ OpenAdjust(vlc_object_t * obj)
         goto error;
 
     for (unsigned int i = 0; i < NUM_ADJUST_MODES; ++i)
-        var_AddCallback(obj, adjust_params_names[i], FilterCallback, p_data);
+        var_AddCallback(filter, adjust_params_names[i], FilterCallback, p_data);
 
     filter->ops = &Adjust_ops;
 
@@ -612,7 +611,7 @@ OpenAdjust(vlc_object_t * obj)
 
 error:
     for (unsigned int i = 0; i < NUM_ADJUST_MODES; ++i)
-        var_Destroy(obj, adjust_params_names[i]);
+        var_Destroy(filter, adjust_params_names[i]);
     free(p_data);
     return VLC_EGENERIC;
 }
@@ -704,11 +703,10 @@ static const struct vlc_filter_operations BasicFilter_ops = {
 };
 
 static int
-OpenBasicFilter(vlc_object_t * obj, VAProcFilterType filter_type,
+OpenBasicFilter(filter_t *filter, VAProcFilterType filter_type,
                 const char *psz_sigma_name, struct range const *p_vlc_range)
 {
     VAProcPipelineCaps                  pipeline_caps;
-    filter_t *const                     filter = (filter_t *)obj;
     assert(filter->psz_name);
     struct basic_filter_data *const     p_data = calloc(1, sizeof(*p_data));
     if (!p_data)
@@ -718,36 +716,36 @@ OpenBasicFilter(vlc_object_t * obj, VAProcFilterType filter_type,
     p_data->sigma.psz_name = psz_sigma_name;
     p_data->sigma.p_vlc_range = p_vlc_range;
 
-    var_Create(obj, p_data->sigma.psz_name,
+    var_Create(filter, p_data->sigma.psz_name,
                VLC_VAR_FLOAT | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND);
 
     if (Open(filter, p_data->filter_type, &pipeline_caps, p_data,
              OpenBasicFilter_InitFilterParams, NULL))
         goto error;
 
-    var_AddCallback(obj, p_data->sigma.psz_name, FilterCallback, p_data);
+    var_AddCallback(filter, p_data->sigma.psz_name, FilterCallback, p_data);
 
     filter->ops = &BasicFilter_ops;
 
     return VLC_SUCCESS;
 
 error:
-    var_Destroy(obj, p_data->sigma.psz_name);
+    var_Destroy(filter, p_data->sigma.psz_name);
     free(p_data);
     return VLC_EGENERIC;
 }
 
 static int
-OpenDenoiseFilter(vlc_object_t * obj)
+OpenDenoiseFilter(filter_t *filter)
 {
-    return OpenBasicFilter(obj, VAProcFilterNoiseReduction, "denoise-sigma",
+    return OpenBasicFilter(filter, VAProcFilterNoiseReduction, "denoise-sigma",
                            &vlc_denoise_sigma_range);
 }
 
 static int
-OpenSharpenFilter(vlc_object_t * obj)
+OpenSharpenFilter(filter_t *filter)
 {
-    return OpenBasicFilter(obj, VAProcFilterSharpening, "sharpen-sigma",
+    return OpenBasicFilter(filter, VAProcFilterSharpening, "sharpen-sigma",
                            &vlc_sharpen_sigma_range);
 }
 
@@ -1138,17 +1136,16 @@ vlc_module_begin()
     set_description(N_("Video Accelerated API filters"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_capability("video filter", 0)
 
     add_submodule()
-    set_callback(OpenAdjust)
+    set_callback_video_filter(OpenAdjust)
     add_shortcut("adjust")
 
     add_submodule()
     set_deinterlace_callback(OpenDeinterlace)
 
     add_submodule()
-    set_callback(OpenDenoiseFilter)
+    set_callback_video_filter(OpenDenoiseFilter)
     add_float_with_range("denoise-sigma", 1.f, .0f, .0f,
                          "Denoise strength (0-2)",
                          "Set the Denoise strength, between 0 and 2. "
@@ -1157,7 +1154,7 @@ vlc_module_begin()
     add_shortcut("denoise")
 
     add_submodule()
-    set_callback(OpenSharpenFilter)
+    set_callback_video_filter(OpenSharpenFilter)
     add_shortcut("sharpen")
 
     add_submodule()
diff --git a/modules/hw/vdpau/adjust.c b/modules/hw/vdpau/adjust.c
index 7552bfc4e33..8703bb27f7f 100644
--- a/modules/hw/vdpau/adjust.c
+++ b/modules/hw/vdpau/adjust.c
@@ -156,10 +156,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = Adjust, .close = Close,
 };
 
-static int Open(vlc_object_t *obj)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if ( filter->vctx_in == NULL ||
          vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
         return VLC_EGENERIC;
@@ -207,7 +205,6 @@ vlc_module_begin()
     set_description(N_("VDPAU adjust video filter"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_capability("video filter", 0)
     add_shortcut("adjust")
-    set_callback(Open)
+    set_callback_video_filter(Open)
 vlc_module_end()
diff --git a/modules/hw/vdpau/sharpen.c b/modules/hw/vdpau/sharpen.c
index e02efd86ca1..a3f49726543 100644
--- a/modules/hw/vdpau/sharpen.c
+++ b/modules/hw/vdpau/sharpen.c
@@ -91,10 +91,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = Sharpen, .close = Close,
 };
 
-static int Open(vlc_object_t *obj)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if ( filter->vctx_in == NULL ||
          vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VDPAU )
         return VLC_EGENERIC;
@@ -154,7 +152,6 @@ vlc_module_begin()
     set_description(N_("VDPAU sharpen video filter"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_capability("video filter", 0)
     add_shortcut("sharpen")
-    set_callbacks(Open, Close)
+    set_callback_video_filter(Open)
 vlc_module_end()
diff --git a/modules/spu/audiobargraph_v.c b/modules/spu/audiobargraph_v.c
index 61560996c15..b563cbed8d2 100644
--- a/modules/spu/audiobargraph_v.c
+++ b/modules/spu/audiobargraph_v.c
@@ -66,7 +66,7 @@ static const char *const ppsz_pos_descriptions[] =
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
 
 static int  OpenSub  (vlc_object_t *);
-static int  OpenVideo(vlc_object_t *);
+static int  OpenVideo(filter_t *);
 static void Close    (filter_t *);
 
 vlc_module_begin ()
@@ -93,8 +93,7 @@ vlc_module_begin ()
 
     /* video output filter submodule */
     add_submodule ()
-    set_capability("video filter", 0)
-    set_callback(OpenVideo)
+    set_callback_video_filter(OpenVideo)
     set_description(N_("Audio Bar Graph Video sub source"))
     add_shortcut("audiobargraph_v")
 vlc_module_end ()
@@ -584,9 +583,9 @@ static int OpenSub(vlc_object_t *p_this)
 /**
  * Open the video filter
  */
-static int OpenVideo(vlc_object_t *p_this)
+static int OpenVideo(filter_t *p_filter)
 {
-    return OpenCommon(p_this, false);
+    return OpenCommon(VLC_OBJECT(p_filter), false);
 }
 
 /**
diff --git a/modules/spu/logo.c b/modules/spu/logo.c
index feb21af8f17..40e5e8b61ab 100644
--- a/modules/spu/logo.c
+++ b/modules/spu/logo.c
@@ -80,7 +80,7 @@ static const char *const ppsz_pos_descriptions[] =
   N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
 
 static int  OpenSub  ( vlc_object_t * );
-static int  OpenVideo( vlc_object_t * );
+static int  OpenVideo( filter_t * );
 static void Close    ( filter_t * );
 
 vlc_module_begin ()
@@ -106,8 +106,7 @@ vlc_module_begin ()
 
     /* video output filter submodule */
     add_submodule ()
-    set_capability( "video filter", 0 )
-    set_callback( OpenVideo )
+    set_callback_video_filter( OpenVideo )
     set_description( N_("Logo video filter") )
     add_shortcut( "logo" )
 vlc_module_end ()
@@ -210,9 +209,9 @@ static int OpenSub( vlc_object_t *p_this )
 /**
  * Open the video filter
  */
-static int OpenVideo( vlc_object_t *p_this )
+static int OpenVideo( filter_t *p_filter )
 {
-    return OpenCommon( p_this, false );
+    return OpenCommon( VLC_OBJECT(p_filter), false );
 }
 
 static const struct vlc_filter_operations filter_sub_ops = {
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index 05c5a899fb9..347c8d58da7 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -38,15 +38,14 @@
  * Module descriptor
  *****************************************************************************/
 static int       ActivateConverter  ( filter_t * );
-static int       ActivateFilter     ( vlc_object_t * );
+static int       ActivateFilter     ( filter_t * );
 static void      Destroy            ( filter_t * );
 
 vlc_module_begin ()
     set_description( N_("Video filtering using a chain of video filter modules") )
     set_callback_video_converter( ActivateConverter, 1 )
     add_submodule ()
-        set_capability( "video filter", 0 )
-        set_callback( ActivateFilter )
+        set_callback_video_filter( ActivateFilter )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -239,10 +238,8 @@ static int ActivateConverter( filter_t *p_filter )
                                BuildChromaChain );
 }
 
-static int ActivateFilter( vlc_object_t *p_this )
+static int ActivateFilter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( !p_filter->b_allow_fmt_out_change || p_filter->psz_name == NULL )
         return VLC_EGENERIC;
 
diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c
index c6c1cc65220..54b15df6d10 100644
--- a/modules/video_filter/adjust.c
+++ b/modules/video_filter/adjust.c
@@ -44,7 +44,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static picture_t *FilterPacked( filter_t *, picture_t * );
 
@@ -72,7 +72,6 @@ vlc_module_begin ()
     set_shortname( N_("Image adjust" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
 
     add_float_with_range( "contrast", 1.0, 0.0, 2.0,
                           CONT_TEXT, CONT_LONGTEXT, false )
@@ -94,7 +93,7 @@ vlc_module_begin ()
         change_safe()
 
     add_shortcut( "adjust" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -149,10 +148,8 @@ static const struct vlc_filter_operations packed_filter_ops =
 /*****************************************************************************
  * Create: allocates adjust video filter
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
     {
         msg_Err( p_filter, "Input and output chromas don't match" );
@@ -160,7 +157,7 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    filter_sys_t *p_sys = vlc_obj_malloc( p_this, sizeof( *p_sys ) );
+    filter_sys_t *p_sys = vlc_obj_malloc( VLC_OBJECT(p_filter), sizeof( *p_sys ) );
     if( p_sys == NULL )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
diff --git a/modules/video_filter/alphamask.c b/modules/video_filter/alphamask.c
index 2793f634f53..166c0de604f 100644
--- a/modules/video_filter/alphamask.c
+++ b/modules/video_filter/alphamask.c
@@ -48,7 +48,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 static void Destroy     ( filter_t * );
 
 static picture_t *Filter( filter_t *, picture_t * );
@@ -65,9 +65,8 @@ vlc_module_begin ()
     set_help( ALPHAMASK_HELP )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_shortcut( "alphamask", "mask" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 
     add_loadfile(CFG_PREFIX "mask", NULL, MASK_TEXT, MASK_LONGTEXT)
 vlc_module_end ()
@@ -87,9 +86,8 @@ static const struct vlc_filter_operations filter_ops =
     .filter_video = Filter, .close = Destroy,
 };
 
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     char *psz_string;
 
diff --git a/modules/video_filter/anaglyph.c b/modules/video_filter/anaglyph.c
index 65c38c39359..b29dfda5283 100644
--- a/modules/video_filter/anaglyph.c
+++ b/modules/video_filter/anaglyph.c
@@ -30,7 +30,7 @@
 #include <vlc_picture.h>
 #include "filter_picture.h"
 
-static int Create(vlc_object_t *);
+static int Create(filter_t *);
 static void combine_side_by_side_yuv420(picture_t *, picture_t *, int, int);
 
 #define SCHEME_TEXT N_("Color scheme")
@@ -69,10 +69,9 @@ vlc_module_begin()
     set_shortname(N_("Anaglyph"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_capability("video filter", 0)
     add_string(FILTER_PREFIX "scheme", "red-cyan", SCHEME_TEXT, SCHEME_LONGTEXT, false)
         change_string_list(ppsz_scheme_values, ppsz_scheme_descriptions)
-    set_callback(Create)
+    set_callback_video_filter(Create)
 vlc_module_end()
 
 static const char *const ppsz_filter_options[] = {
@@ -86,10 +85,8 @@ typedef struct
 
 VIDEO_FILTER_WRAPPER(Filter)
 
-static int Create(vlc_object_t *p_this)
+static int Create(filter_t *p_filter)
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     switch (p_filter->fmt_in.video.i_chroma)
     {
         case VLC_CODEC_I420:
diff --git a/modules/video_filter/antiflicker.c b/modules/video_filter/antiflicker.c
index a4b9cb424d4..98566ed108c 100644
--- a/modules/video_filter/antiflicker.c
+++ b/modules/video_filter/antiflicker.c
@@ -44,7 +44,7 @@ static int AntiFlickerCallback( vlc_object_t *p_this, char const *psz_var,
                            vlc_value_t oldval, vlc_value_t newval,
                            void *p_data );
 
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 VIDEO_FILTER_WRAPPER_CLOSE( Filter, Destroy )
 
 #define WINDOW_TEXT N_("Window size")
@@ -65,7 +65,6 @@ VIDEO_FILTER_WRAPPER_CLOSE( Filter, Destroy )
 vlc_module_begin ()
     set_description( N_("Antiflicker video filter") )
     set_shortname( N_( "antiflicker" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -76,7 +75,7 @@ vlc_module_begin ()
         SFTN_TEXT, SFTN_LONGTEXT, false )
 
     add_shortcut( "antiflicker" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -98,10 +97,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Distort vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     switch( p_filter->fmt_in.video.i_chroma )
     {
         CASE_PLANAR_YUV
diff --git a/modules/video_filter/ball.c b/modules/video_filter/ball.c
index c87f7e2146b..01a6b5a4e86 100644
--- a/modules/video_filter/ball.c
+++ b/modules/video_filter/ball.c
@@ -72,7 +72,7 @@ enum { RED, GREEN, BLUE, WHITE };
 
 typedef struct filter_sys_t filter_sys_t;
 
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 VIDEO_FILTER_WRAPPER_CLOSE( Filter, Destroy )
 
@@ -125,7 +125,6 @@ vlc_module_begin ()
     set_description( N_("Ball video filter") )
     set_shortname( N_( "Ball" ))
     set_help(BALL_HELP)
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -146,7 +145,7 @@ vlc_module_begin ()
               EDGE_VISIBLE_TEXT, EDGE_VISIBLE_LONGTEXT, true )
 
     add_shortcut( "ball" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -219,9 +218,8 @@ struct filter_sys_t
 *****************************************************************************
 * This function allocates and initializes a Distort vout method.
 *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     char *psz_method;
 
     /* Allocate structure */
@@ -273,7 +271,7 @@ static int Create( vlc_object_t *p_this )
         p_sys->ballColor = RED;
     }
     else
-        p_sys->ballColor = getBallColor( p_this, psz_method );
+        p_sys->ballColor = getBallColor( VLC_OBJECT(p_filter), psz_method );
 
     free( psz_method );
 
diff --git a/modules/video_filter/blendbench.c b/modules/video_filter/blendbench.c
index 0e432b1036c..8bf43ed7f92 100644
--- a/modules/video_filter/blendbench.c
+++ b/modules/video_filter/blendbench.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Create( vlc_object_t * );
+static int Create( filter_t * );
 static void Destroy( filter_t * );
 
 static picture_t *Filter( filter_t *, picture_t * );
@@ -75,7 +75,6 @@ vlc_module_begin ()
     set_shortname( N_("Blendbench" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
 
     set_section( N_("Benchmarking"), NULL )
     add_integer( CFG_PREFIX "loops", 1000, LOOPS_TEXT,
@@ -95,7 +94,7 @@ vlc_module_begin ()
     add_string( CFG_PREFIX "blend-chroma", "YUVA", BLEND_CHROMA_TEXT,
               BLEND_CHROMA_LONGTEXT, false )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -152,9 +151,8 @@ static const struct vlc_filter_operations filter_ops =
 /*****************************************************************************
  * Create: allocates video thread output method
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     char *psz_temp, *psz_cmd;
     int i_ret;
@@ -183,7 +181,7 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_base_chroma = !psz_temp || strlen( psz_temp ) != 4 ? 0 :
         VLC_FOURCC( psz_temp[0], psz_temp[1], psz_temp[2], psz_temp[3] );
     psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" );
-    i_ret = blendbench_LoadImage( p_this, &p_sys->p_base_image,
+    i_ret = blendbench_LoadImage( VLC_OBJECT(p_filter), &p_sys->p_base_image,
                                   p_sys->i_base_chroma, psz_cmd, "Base" );
     free( psz_temp );
     free( psz_cmd );
@@ -198,7 +196,7 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_blend_chroma = !psz_temp || strlen( psz_temp ) != 4
         ? 0 : VLC_FOURCC( psz_temp[0], psz_temp[1], psz_temp[2], psz_temp[3] );
     psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" );
-    i_ret = blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
+    i_ret = blendbench_LoadImage( VLC_OBJECT(p_filter), &p_sys->p_blend_image, p_sys->i_blend_chroma,
                                   psz_cmd, "Blend" );
 
     free( psz_temp );
diff --git a/modules/video_filter/bluescreen.c b/modules/video_filter/bluescreen.c
index 94807ce45cf..9cc0ad2060e 100644
--- a/modules/video_filter/bluescreen.c
+++ b/modules/video_filter/bluescreen.c
@@ -63,7 +63,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 static void Destroy     ( filter_t * );
 
 static picture_t *Filter( filter_t *, picture_t * );
@@ -79,9 +79,8 @@ vlc_module_begin ()
     set_help( BLUESCREEN_HELP )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_shortcut( "bluescreen" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 
     add_integer_with_range( CFG_PREFIX "u", 120, 0, 255,
                             BLUESCREENU_TEXT, BLUESCREENU_LONGTEXT, false )
@@ -111,9 +110,8 @@ static const struct vlc_filter_operations filter_ops =
     .filter_video = Filter, .close = Destroy,
 };
 
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA )
diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index c1afb71c765..b3610d8d1aa 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -38,7 +38,7 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate( vlc_object_t * );
+static int  Activate( filter_t * );
 static void Destroy( filter_t * );
 static picture_t *Filter( filter_t *, picture_t * );
 static void Flush( filter_t * );
@@ -104,9 +104,8 @@ static void Flush( filter_t * );
 vlc_module_begin ()
     set_shortname( N_("Canvas") )
     set_description( N_("Canvas video filter") )
-    set_capability( "video filter", 0 )
     set_help( CANVAS_HELP )
-    set_callback( Activate )
+    set_callback_video_filter( Activate )
 
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
@@ -153,9 +152,8 @@ static const struct vlc_filter_operations filter_ops =
 /*****************************************************************************
  *
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     unsigned i_canvas_width; /* visible width of output canvas */
     unsigned i_canvas_height; /* visible height of output canvas */
     unsigned i_canvas_aspect; /* canvas PictureAspectRatio */
diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index ee56ef33b3a..162937b6bda 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -597,10 +597,8 @@ static const struct vlc_filter_operations filter_ops =
 };
 
 static int
-Open(vlc_object_t *obj, char const *psz_filter)
+Open(filter_t *filter, char const *psz_filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     switch (filter->fmt_in.video.i_chroma)
     {
         case VLC_CODEC_CVPX_NV12:
@@ -717,45 +715,45 @@ error:
 }
 
 static int
-OpenAdjust(vlc_object_t *obj)
+OpenAdjust(filter_t *filter)
 {
-    return Open(obj, "adjust");
+    return Open(filter, "adjust");
 }
 
 static int
-OpenInvert(vlc_object_t *obj)
+OpenInvert(filter_t *filter)
 {
-    return Open(obj, "invert");
+    return Open(filter, "invert");
 }
 
 static int
-OpenPosterize(vlc_object_t *obj)
+OpenPosterize(filter_t *filter)
 {
-    return Open(obj, "posterize");
+    return Open(filter, "posterize");
 }
 
 static int
-OpenSepia(vlc_object_t *obj)
+OpenSepia(filter_t *filter)
 {
-    return Open(obj, "sepia");
+    return Open(filter, "sepia");
 }
 
 static int
-OpenSharpen(vlc_object_t *obj)
+OpenSharpen(filter_t *filter)
 {
-    return Open(obj, "sharpen");
+    return Open(filter, "sharpen");
 }
 
 static int
-OpenPsychedelic(vlc_object_t *obj)
+OpenPsychedelic(filter_t *filter)
 {
-    return Open(obj, "psychedelic");
+    return Open(filter, "psychedelic");
 }
 
 static int
-OpenCustom(vlc_object_t *obj)
+OpenCustom(filter_t *filter)
 {
-    return Open(obj, "custom");
+    return Open(filter, "custom");
 }
 
 #define CI_CUSTOM_FILTER_TEXT N_("Use a specific Core Image Filter")
@@ -763,37 +761,36 @@ OpenCustom(vlc_object_t *obj)
     "Example: 'CICrystallize', 'CIBumpDistortion', 'CIThermal', 'CIComicEffect'")
 
 vlc_module_begin()
-    set_capability("video filter", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
     set_description(N_("Mac OS X hardware video filters"))
 
     add_submodule()
-    set_callback(OpenAdjust)
+    set_callback_video_filter(OpenAdjust)
     add_shortcut("adjust")
 
     add_submodule()
-    set_callback(OpenInvert)
+    set_callback_video_filter(OpenInvert)
     add_shortcut("invert")
 
     add_submodule()
-    set_callback(OpenPosterize)
+    set_callback_video_filter(OpenPosterize)
     add_shortcut("posterize")
 
     add_submodule()
-    set_callback(OpenSepia)
+    set_callback_video_filter(OpenSepia)
     add_shortcut("sepia")
 
     add_submodule()
-    set_callback(OpenSharpen)
+    set_callback_video_filter(OpenSharpen)
     add_shortcut("sharpen")
 
     add_submodule()
-    set_callback(OpenPsychedelic)
+    set_callback_video_filter(OpenPsychedelic)
     add_shortcut("psychedelic")
 
     add_submodule()
-    set_callback(OpenCustom)
+    set_callback_video_filter(OpenCustom)
     add_shortcut("ci")
     add_string("ci-filter", "CIComicEffect", CI_CUSTOM_FILTER_TEXT, CI_CUSTOM_FILTER_LONGTEXT, true);
 vlc_module_end()
diff --git a/modules/video_filter/colorthres.c b/modules/video_filter/colorthres.c
index 69148d02263..6bc36ec445c 100644
--- a/modules/video_filter/colorthres.c
+++ b/modules/video_filter/colorthres.c
@@ -42,7 +42,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static picture_t *FilterPacked( filter_t *, picture_t * );
 VIDEO_FILTER_WRAPPER_CLOSE( Filter, Destroy )
@@ -70,14 +70,13 @@ vlc_module_begin ()
     set_help(COLOR_HELP)
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_rgb(CFG_PREFIX "color", 0x00FF0000, COLOR_TEXT, COLOR_LONGTEXT)
         change_integer_list( pi_color_values, ppsz_color_descriptions )
     add_integer( CFG_PREFIX "saturationthres", 20,
                  N_("Saturation threshold"), "", false )
     add_integer( CFG_PREFIX "similaritythres", 15,
                  N_("Similarity threshold"), "", false )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -111,9 +110,8 @@ static const struct vlc_filter_operations packed_filter_ops =
  *****************************************************************************
  * This function allocates and initializes a adjust vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_filter/croppadd.c b/modules/video_filter/croppadd.c
index 318083b4df2..e4cefc458ba 100644
--- a/modules/video_filter/croppadd.c
+++ b/modules/video_filter/croppadd.c
@@ -37,7 +37,7 @@
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
-static int  OpenFilter ( vlc_object_t * );
+static int  OpenFilter ( filter_t * );
 
 VIDEO_FILTER_WRAPPER(Filter)
 
@@ -75,8 +75,7 @@ VIDEO_FILTER_WRAPPER(Filter)
 vlc_module_begin ()
     set_shortname( N_("Croppadd") )
     set_description( N_("Video cropping filter") )
-    set_capability( "video filter", 0 )
-    set_callback( OpenFilter )
+    set_callback_video_filter( OpenFilter )
 
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER );
@@ -123,9 +122,8 @@ typedef struct
 /*****************************************************************************
  * OpenFilter: probe the filter and return score
  *****************************************************************************/
-static int OpenFilter( vlc_object_t *p_this )
+static int OpenFilter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
     if( !p_filter->b_allow_fmt_out_change )
diff --git a/modules/video_filter/edgedetection.c b/modules/video_filter/edgedetection.c
index cd68f461259..87d3c225b12 100644
--- a/modules/video_filter/edgedetection.c
+++ b/modules/video_filter/edgedetection.c
@@ -45,7 +45,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int Open( vlc_object_t * );
+static int Open( filter_t * );
 static void Close( filter_t * );
 static picture_t *new_frame( filter_t * );
 static picture_t *Filter( filter_t *, picture_t * );
@@ -72,8 +72,7 @@ vlc_module_begin ()
     set_help( EDGE_DETECTION_LONGTEXT )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
-    set_callback( Open )
+    set_callback_video_filter( Open )
 
 vlc_module_end ()
 
@@ -100,10 +99,9 @@ static const struct vlc_filter_operations filter_ops =
  * needed so that the Sobel operator does not give a high response for noise,
  * or small changes in the image.
  *****************************************************************************/
-static int Open( vlc_object_t *p_this )
+static int Open( filter_t *p_filter  )
 {
     int i_ret;
-    filter_t *p_filter = (filter_t *)p_this;
     filter_owner_t owner = {
         .video = &filter_video_edge_cbs,
         .sys = p_filter,
diff --git a/modules/video_filter/erase.c b/modules/video_filter/erase.c
index 618036ee5a2..4535f777404 100644
--- a/modules/video_filter/erase.c
+++ b/modules/video_filter/erase.c
@@ -39,7 +39,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static void FilterErase( filter_t *, picture_t *, picture_t * );
 static int EraseCallback( vlc_object_t *, char const *,
@@ -64,7 +64,6 @@ VIDEO_FILTER_WRAPPER_CLOSE( Filter, Destroy )
 vlc_module_begin ()
     set_description( N_("Erase video filter") )
     set_shortname( N_( "Erase" ))
-    set_capability( "video filter", 0 )
     set_help(ERASE_HELP)
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
@@ -74,7 +73,7 @@ vlc_module_begin ()
     add_integer( CFG_PREFIX "y", 0, POSY_TEXT, POSY_LONGTEXT, false )
 
     add_shortcut( "erase" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -123,9 +122,8 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
 /*****************************************************************************
  * Create
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     char *psz_filename;
 
diff --git a/modules/video_filter/extract.c b/modules/video_filter/extract.c
index 3d9cba50eb1..0403cfbb236 100644
--- a/modules/video_filter/extract.c
+++ b/modules/video_filter/extract.c
@@ -39,7 +39,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 
 static int ExtractCallback( vlc_object_t *, char const *,
                             vlc_value_t, vlc_value_t, void * );
@@ -66,14 +66,13 @@ vlc_module_begin ()
     set_shortname( N_("Extract" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_shortcut( "extract" )
 
     add_integer_with_range( FILTER_PREFIX "component", 0xFF0000, 1, 0xFFFFFF,
                             COMPONENT_TEXT, COMPONENT_LONGTEXT, false )
         change_integer_list( pi_component_values, ppsz_component_descriptions )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -91,10 +90,8 @@ typedef struct
 /*****************************************************************************
  * Create
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     switch( p_filter->fmt_in.video.i_chroma )
     {
         case VLC_CODEC_I420:
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index e58e2a83078..721a5583193 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -33,7 +33,7 @@
 #include <vlc_filter.h>
 #include <vlc_picture.h>
 
-static int Open( vlc_object_t *p_this);
+static int Open( filter_t * );
 static picture_t *Filter( filter_t *p_filter, picture_t *p_picture);
 
 #define CFG_PREFIX "fps-"
@@ -43,13 +43,12 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture);
 vlc_module_begin ()
     set_description( N_("FPS conversion video filter") )
     set_shortname( N_("FPS Converter" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
     add_shortcut( "fps" )
     add_string( CFG_PREFIX "fps", NULL, FPS_TEXT, FPS_TEXT, false )
-    set_callback( Open )
+    set_callback_video_filter( Open )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -146,9 +145,8 @@ static const struct vlc_filter_operations filter_ops =
     .filter_video = Filter, .close = Close,
 };
 
-static int Open( vlc_object_t *p_this)
+static int Open( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
     /* This filter cannot change the format. */
diff --git a/modules/video_filter/freeze.c b/modules/video_filter/freeze.c
index c296923a3a9..a1f58183359 100644
--- a/modules/video_filter/freeze.c
+++ b/modules/video_filter/freeze.c
@@ -71,17 +71,16 @@ static void freeze_free_allocated_data( filter_t * );
 
 #define CFG_PREFIX "freeze-"
 
-static int  Open ( vlc_object_t * );
+static int  Open ( filter_t * );
 static void Close( filter_t * );
 
 vlc_module_begin()
     set_description( N_("Freezing interactive video filter") )
     set_shortname(   N_("Freeze" ) )
-    set_capability(  "video filter", 0 )
     set_category(    CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    set_callback( Open )
+    set_callback_video_filter( Open )
 vlc_module_end()
 
 /*****************************************************************************
@@ -98,9 +97,8 @@ static const struct vlc_filter_operations filter_ops =
 /**
  * Open the filter
  */
-static int Open( vlc_object_t *p_this )
+static int Open( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     /* Assert video in match with video out */
diff --git a/modules/video_filter/gaussianblur.c b/modules/video_filter/gaussianblur.c
index 10dd001bc81..fd2c900bc91 100644
--- a/modules/video_filter/gaussianblur.c
+++ b/modules/video_filter/gaussianblur.c
@@ -38,7 +38,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 #define SIGMA_MIN (0.01)
 #define SIGMA_MAX (4096.0)
@@ -56,7 +56,6 @@ vlc_module_begin ()
     set_description( N_("Gaussian blur video filter") )
     set_shortname( N_( "Gaussian Blur" ))
     set_help(GAUSSIAN_HELP)
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -64,7 +63,7 @@ vlc_module_begin ()
                           SIGMA_TEXT, SIGMA_LONGTEXT,
                           false )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -121,10 +120,8 @@ static void gaussianblur_InitDistribution( filter_sys_t *p_sys )
     p_sys->pt_distribution = pt_distribution;
 }
 
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if(   p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420
        && p_filter->fmt_in.video.i_chroma != VLC_CODEC_J420
        && p_filter->fmt_in.video.i_chroma != VLC_CODEC_YV12
diff --git a/modules/video_filter/gradfun.c b/modules/video_filter/gradfun.c
index 141642a8bcb..2bc6e36d37a 100644
--- a/modules/video_filter/gradfun.c
+++ b/modules/video_filter/gradfun.c
@@ -39,7 +39,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Open (vlc_object_t *);
+static int  Open (filter_t *);
 
 #define CFG_PREFIX "gradfun-"
 
@@ -57,7 +57,6 @@ vlc_module_begin()
     set_description(N_("Gradfun video filter"))
     set_shortname(N_("Gradfun"))
     set_help(N_("Debanding algorithm"))
-    set_capability("video filter", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
     add_integer_with_range(CFG_PREFIX "radius", 16, RADIUS_MIN, RADIUS_MAX,
@@ -65,7 +64,7 @@ vlc_module_begin()
     add_float_with_range(CFG_PREFIX "strength", 1.2, STRENGTH_MIN, STRENGTH_MAX,
                          STRENGTH_TEXT, STRENGTH_LONGTEXT, false)
 
-    set_callback(Open)
+    set_callback_video_filter(Open)
 vlc_module_end()
 
 /*****************************************************************************
@@ -109,9 +108,8 @@ typedef struct
     struct vf_priv_s cfg;
 } filter_sys_t;
 
-static int Open(vlc_object_t *object)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)object;
     const vlc_fourcc_t fourcc = filter->fmt_in.video.i_chroma;
 
     const vlc_chroma_description_t *chroma = vlc_fourcc_GetChromaDescription(fourcc);
diff --git a/modules/video_filter/gradient.c b/modules/video_filter/gradient.c
index 7acd16a0083..943cd64fbdd 100644
--- a/modules/video_filter/gradient.c
+++ b/modules/video_filter/gradient.c
@@ -43,7 +43,7 @@ enum { GRADIENT, EDGE, HOUGH };
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static int GradientCallback( vlc_object_t *, char const *,
                              vlc_value_t, vlc_value_t,
@@ -79,7 +79,6 @@ vlc_module_begin ()
     set_description( N_("Gradient video filter") )
     set_shortname( N_( "Gradient" ))
     set_help(GRADIENT_HELP)
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -93,7 +92,7 @@ vlc_module_begin ()
                 CARTOON_TEXT, CARTOON_LONGTEXT, false )
 
     add_shortcut( "gradient" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -128,9 +127,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Distort vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     char *psz_method;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_filter/grain.c b/modules/video_filter/grain.c
index 024ba4c55cd..12d4dfbcf6b 100644
--- a/modules/video_filter/grain.c
+++ b/modules/video_filter/grain.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Open (vlc_object_t *);
+static int  Open (filter_t *);
 VIDEO_FILTER_WRAPPER_CLOSE(Filter, Close)
 
 #define BANK_SIZE (64)
@@ -63,7 +63,6 @@ vlc_module_begin()
     set_description(N_("Grain video filter"))
     set_shortname( N_("Grain"))
     set_help(N_("Adds filtered gaussian noise"))
-    set_capability( "video filter", 0 )
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
     add_float_with_range(CFG_PREFIX "variance", 2.0, VARIANCE_MIN, VARIANCE_MAX,
@@ -72,7 +71,7 @@ vlc_module_begin()
                            PERIOD_MIN_TEXT, PERIOD_MIN_LONGTEXT, false)
     add_integer_with_range(CFG_PREFIX "period-max", 3*PERIOD_MAX/4, PERIOD_MIN, PERIOD_MAX,
                            PERIOD_MAX_TEXT, PERIOD_MAX_LONGTEXT, false)
-    set_callback(Open)
+    set_callback_video_filter(Open)
 vlc_module_end()
 
 /*****************************************************************************
@@ -368,10 +367,8 @@ static int Callback(vlc_object_t *object, char const *cmd,
     return VLC_SUCCESS;
 }
 
-static int Open(vlc_object_t *object)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)object;
-
     const vlc_chroma_description_t *chroma =
         vlc_fourcc_GetChromaDescription(filter->fmt_in.video.i_chroma);
     if (!chroma || chroma->plane_count < 3 || chroma->pixel_size != 1) {
diff --git a/modules/video_filter/hqdn3d.c b/modules/video_filter/hqdn3d.c
index b1413a2ff78..8f7acdfa73c 100644
--- a/modules/video_filter/hqdn3d.c
+++ b/modules/video_filter/hqdn3d.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local protypes
  *****************************************************************************/
-static int  Open         (vlc_object_t *);
+static int  Open         (filter_t *);
 static void Close        (filter_t *);
 static picture_t *Filter (filter_t *, picture_t *);
 static int DenoiseCallback( vlc_object_t *p_this, char const *psz_var,
@@ -61,7 +61,6 @@ static int DenoiseCallback( vlc_object_t *p_this, char const *psz_var,
 vlc_module_begin()
     set_shortname(N_("HQ Denoiser 3D"))
     set_description(N_("High Quality 3D Denoiser filter"))
-    set_capability("video filter", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
 
@@ -76,7 +75,7 @@ vlc_module_begin()
 
     add_shortcut("hqdn3d")
 
-    set_callback(Open)
+    set_callback_video_filter(Open)
 vlc_module_end()
 
 static const char *const filter_options[] = {
@@ -100,9 +99,8 @@ typedef struct
 /*****************************************************************************
  * Open
  *****************************************************************************/
-static int Open(vlc_object_t *this)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)this;
     filter_sys_t *sys;
     struct vf_priv_s *cfg;
     const video_format_t *fmt_in  = &filter->fmt_in.video;
diff --git a/modules/video_filter/invert.c b/modules/video_filter/invert.c
index c77a86d311b..5cdb1fceb14 100644
--- a/modules/video_filter/invert.c
+++ b/modules/video_filter/invert.c
@@ -36,7 +36,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 
 VIDEO_FILTER_WRAPPER(Filter)
 
@@ -48,9 +48,8 @@ vlc_module_begin ()
     set_shortname( N_("Color inversion" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_shortcut( "invert" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -58,9 +57,8 @@ vlc_module_end ()
  *****************************************************************************
  * This function allocates and initializes a Invert vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
 
     if( fourcc == VLC_CODEC_YUVP || fourcc == VLC_CODEC_RGBP
diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index ebeaec58769..613b98c66d3 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -41,17 +41,16 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 static void Destroy   ( filter_t * );
 
 vlc_module_begin ()
     set_description( N_("Magnify/Zoom interactive video filter") )
     set_shortname( N_( "Magnify" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 
@@ -88,9 +87,8 @@ typedef struct
 /*****************************************************************************
  * Create:
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     /* */
diff --git a/modules/video_filter/mirror.c b/modules/video_filter/mirror.c
index 0d8d4c7f7ea..ea639dd7114 100644
--- a/modules/video_filter/mirror.c
+++ b/modules/video_filter/mirror.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 
 static void VerticalMirror( picture_t *, picture_t *, int plane, bool );
 static void HorizontalMirror( picture_t *, picture_t *, int, bool );
@@ -80,7 +80,6 @@ vlc_module_begin ()
     set_help( N_("Splits video in two same parts, like in a mirror") )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_integer( CFG_PREFIX "split", 0, ORIENTATION_TEXT,
                 ORIENTATION_LONGTEXT, false )
         change_integer_list( pi_orientation_values,
@@ -88,7 +87,7 @@ vlc_module_begin ()
     add_integer( CFG_PREFIX "direction", 0, DIRECTION_TEXT,
                 DIRECTION_LONGTEXT, false )
         change_integer_list( pi_direction_values, ppsz_direction_descriptions )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -111,9 +110,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Mirror vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_filter/motionblur.c b/modules/video_filter/motionblur.c
index d2235a17671..2868c83b07e 100644
--- a/modules/video_filter/motionblur.c
+++ b/modules/video_filter/motionblur.c
@@ -42,7 +42,7 @@
  *****************************************************************************/
 typedef struct filter_sys_t filter_sys_t;
 
-static int  Create       ( vlc_object_t * );
+static int  Create       ( filter_t * );
 static void RenderBlur   ( filter_sys_t *, picture_t *, picture_t * );
 static int MotionBlurCallback( vlc_object_t *, char const *,
                                vlc_value_t, vlc_value_t, void * );
@@ -59,7 +59,6 @@ VIDEO_FILTER_WRAPPER_CLOSE(Filter, Destroy)
 vlc_module_begin ()
     set_shortname( N_("Motion blur") )
     set_description( N_("Motion blur filter") )
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -68,7 +67,7 @@ vlc_module_begin ()
 
     add_shortcut( "blur" )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -88,10 +87,8 @@ struct filter_sys_t
 /*****************************************************************************
  * Create
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const vlc_chroma_description_t *p_chroma =
         vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
     if( p_chroma == NULL || p_chroma->plane_count == 0 )
diff --git a/modules/video_filter/motiondetect.c b/modules/video_filter/motiondetect.c
index ce6d35396d9..a1049607c8d 100644
--- a/modules/video_filter/motiondetect.c
+++ b/modules/video_filter/motiondetect.c
@@ -38,7 +38,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 static void Destroy   ( filter_t * );
 
 #define FILTER_PREFIX "motiondetect-"
@@ -48,10 +48,9 @@ vlc_module_begin ()
     set_shortname( N_( "Motion Detect" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
 
     add_shortcut( "motion" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 
@@ -94,9 +93,8 @@ static void Flush(filter_t *p_filter)
 /*****************************************************************************
  * Create
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     const video_format_t *p_fmt = &p_filter->fmt_in.video;
     filter_sys_t *p_sys;
     bool is_yuv_planar;
diff --git a/modules/video_filter/oldmovie.c b/modules/video_filter/oldmovie.c
index 730fb7ef256..2c0ef1f0958 100644
--- a/modules/video_filter/oldmovie.c
+++ b/modules/video_filter/oldmovie.c
@@ -172,24 +172,22 @@ static int  oldmovie_sliding_offset_apply( filter_t *p_filter, picture_t *p_pic_
  * Module descriptor
  *****************************************************************************/
 
-static int  Open ( vlc_object_t * );
+static int  Open ( filter_t * );
 static void Close( filter_t * );
 
 vlc_module_begin()
     set_description( N_("Old movie effect video filter") )
     set_shortname( N_( "Old movie" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    set_callback( Open )
+    set_callback_video_filter( Open )
 vlc_module_end()
 
 /**
  * Open the filter
  */
-static int Open( vlc_object_t *p_this ) {
-    filter_t *p_filter = (filter_t *)p_this;
+static int Open( filter_t *p_filter ) {
     filter_sys_t *p_sys;
 
     /* Assert video in match with video out */
diff --git a/modules/video_filter/opencv_wrapper.c b/modules/video_filter/opencv_wrapper.c
index 0b6e77c6308..b2e1f7aa5de 100644
--- a/modules/video_filter/opencv_wrapper.c
+++ b/modules/video_filter/opencv_wrapper.c
@@ -45,7 +45,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 static void Destroy   ( filter_t * );
 
 static picture_t* Filter( filter_t*, picture_t* );
@@ -70,9 +70,8 @@ vlc_module_begin ()
     set_shortname( N_("OpenCV" ))
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_shortcut( "opencv_wrapper" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
     add_float_with_range( "opencv-scale", 1.0, 0.1, 2.0,
                           N_("Scale factor (0.1-2.0)"),
                           N_("Amount by which to scale the picture before sending it to the internal OpenCV filter"),
@@ -144,9 +143,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a opencv_wrapper vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t* p_filter )
 {
-    filter_t* p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
     char *psz_chroma, *psz_output;
 
diff --git a/modules/video_filter/posterize.c b/modules/video_filter/posterize.c
index 1c931f829b0..cbdea76b912 100644
--- a/modules/video_filter/posterize.c
+++ b/modules/video_filter/posterize.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 
 static void PlanarYUVPosterize( picture_t *, picture_t *, int);
 static void PackedYUVPosterize( picture_t *, picture_t *, int);
@@ -68,11 +68,10 @@ vlc_module_begin ()
     set_help( N_("Posterize video by lowering the number of colors") )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_integer_with_range( CFG_PREFIX "level", 6, 2, 256,
                            POSTERIZE_LEVEL_TEXT, POSTERIZE_LEVEL_LONGTEXT,
                            false )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -94,9 +93,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Posterize vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     switch( p_filter->fmt_in.video.i_chroma )
diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index 6f41aad0c64..0b5856d19f9 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -53,7 +53,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int OpenPostproc( vlc_object_t * );
+static int OpenPostproc( filter_t * );
 
 VIDEO_FILTER_WRAPPER_CLOSE(PostprocPict, ClosePostproc)
 
@@ -84,9 +84,7 @@ vlc_module_begin ()
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    set_capability( "video filter", 0 )
-
-    set_callback( OpenPostproc )
+    set_callback_video_filter( OpenPostproc )
 
     add_integer_with_range( FILTER_PREFIX "q", PP_QUALITY_MAX, 0,
                             PP_QUALITY_MAX, Q_TEXT, Q_LONGTEXT, false )
@@ -118,9 +116,8 @@ typedef struct
 /*****************************************************************************
  * OpenPostproc: probe and open the postproc
  *****************************************************************************/
-static int OpenPostproc( vlc_object_t *p_this )
+static int OpenPostproc( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     vlc_value_t val, val_orig;
     const char *desc;
diff --git a/modules/video_filter/psychedelic.c b/modules/video_filter/psychedelic.c
index 49d96075694..1a7e7eda2a5 100644
--- a/modules/video_filter/psychedelic.c
+++ b/modules/video_filter/psychedelic.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 VIDEO_FILTER_WRAPPER_CLOSE(Filter, Destroy)
 
@@ -50,12 +50,11 @@ VIDEO_FILTER_WRAPPER_CLOSE(Filter, Destroy)
 vlc_module_begin ()
     set_description( N_("Psychedelic video filter") )
     set_shortname( N_( "Psychedelic" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
     add_shortcut( "psychedelic" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -77,10 +76,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Distort vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
     if( !p_chroma || p_chroma->plane_count != 3 || p_chroma->pixel_size != 1 ) {
diff --git a/modules/video_filter/puzzle.c b/modules/video_filter/puzzle.c
index 15f7a9e6778..ceb8282f48a 100644
--- a/modules/video_filter/puzzle.c
+++ b/modules/video_filter/puzzle.c
@@ -77,13 +77,12 @@ static const char *const ppsz_rotation_descriptions[] = { N_("0"), N_("0/180"),
 
 #define CFG_PREFIX "puzzle-"
 
-static int  Open ( vlc_object_t * );
+static int  Open ( filter_t * );
 static void Close( filter_t * );
 
 vlc_module_begin()
     set_description( N_("Puzzle interactive game video filter") )
     set_shortname( N_( "Puzzle" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -110,7 +109,7 @@ vlc_module_begin()
               MODE_TEXT, MODE_LONGTEXT, false )
         change_integer_list(pi_mode_values, ppsz_mode_descriptions )
 
-    set_callback( Open )
+    set_callback_video_filter( Open )
 vlc_module_end()
 
 /*****************************************************************************
@@ -124,9 +123,8 @@ const char *const ppsz_filter_options[] = {
 /**
  * Open the filter
  */
-static int Open( vlc_object_t *p_this )
+static int Open( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     /* Assert video in match with video out */
diff --git a/modules/video_filter/ripple.c b/modules/video_filter/ripple.c
index f4bf90fb49d..9a7d6d0e949 100644
--- a/modules/video_filter/ripple.c
+++ b/modules/video_filter/ripple.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 VIDEO_FILTER_WRAPPER(Filter)
 
@@ -50,12 +50,11 @@ VIDEO_FILTER_WRAPPER(Filter)
 vlc_module_begin ()
     set_description( N_("Ripple video filter") )
     set_shortname( N_( "Ripple" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
     add_shortcut( "ripple" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -75,10 +74,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Distort vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const vlc_chroma_description_t *p_chroma =
         vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
     if( p_chroma == NULL || p_chroma->plane_count == 0 )
diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c
index 5c470171f8b..e4232cce2cb 100644
--- a/modules/video_filter/rotate.c
+++ b/modules/video_filter/rotate.c
@@ -42,7 +42,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static picture_t *FilterPacked( filter_t *, picture_t * );
 VIDEO_FILTER_WRAPPER_CLOSE(Filter, Destroy)
@@ -65,7 +65,6 @@ static int RotateCallback( vlc_object_t *p_this, char const *psz_var,
 vlc_module_begin ()
     set_description( N_("Rotate video filter") )
     set_shortname( N_( "Rotate" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
@@ -74,7 +73,7 @@ vlc_module_begin ()
               MOTION_LONGTEXT, false )
 
     add_shortcut( "rotate" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -125,9 +124,8 @@ static const struct vlc_filter_operations packed_filter_ops =
 /*****************************************************************************
  * Create: allocates Distort video filter
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma )
diff --git a/modules/video_filter/scene.c b/modules/video_filter/scene.c
index 0de53fd1b2c..0ddb6f1528b 100644
--- a/modules/video_filter/scene.c
+++ b/modules/video_filter/scene.c
@@ -44,7 +44,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 static void Destroy     ( filter_t * );
 
 static picture_t *Filter( filter_t *, picture_t * );
@@ -96,7 +96,6 @@ vlc_module_begin ()
     set_help(SCENE_HELP)
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
 
     /* General options */
     add_string(  CFG_PREFIX "format", "png",
@@ -116,7 +115,7 @@ vlc_module_begin ()
     add_integer_with_range( CFG_PREFIX "ratio", 50, 1, INT_MAX,
                             RATIO_TEXT, RATIO_LONGTEXT, false )
 
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_vfilter_options[] = {
@@ -150,9 +149,8 @@ typedef struct
 /*****************************************************************************
  * Create: initialize and set ops
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     const vlc_chroma_description_t *p_chroma =
@@ -167,15 +165,15 @@ static int Create( vlc_object_t *p_this )
     if( p_filter->p_sys == NULL )
         return VLC_ENOMEM;
 
-    p_sys->p_image = image_HandlerCreate( p_this );
+    p_sys->p_image = image_HandlerCreate( p_filter );
     if( !p_sys->p_image )
     {
-        msg_Err( p_this, "Couldn't get handle to image conversion routines." );
+        msg_Err( p_filter, "Couldn't get handle to image conversion routines." );
         free( p_sys );
         return VLC_EGENERIC;
     }
 
-    p_sys->psz_format = var_CreateGetString( p_this, CFG_PREFIX "format" );
+    p_sys->psz_format = var_CreateGetString( p_filter, CFG_PREFIX "format" );
     p_sys->i_format = image_Type2Fourcc( p_sys->psz_format );
     if( !p_sys->i_format )
     {
@@ -186,14 +184,14 @@ static int Create( vlc_object_t *p_this )
         free( p_sys );
         return VLC_EGENERIC;
     }
-    p_sys->i_width = var_CreateGetInteger( p_this, CFG_PREFIX "width" );
-    p_sys->i_height = var_CreateGetInteger( p_this, CFG_PREFIX "height" );
-    p_sys->i_ratio = var_CreateGetInteger( p_this, CFG_PREFIX "ratio" );
+    p_sys->i_width = var_CreateGetInteger( p_filter, CFG_PREFIX "width" );
+    p_sys->i_height = var_CreateGetInteger( p_filter, CFG_PREFIX "height" );
+    p_sys->i_ratio = var_CreateGetInteger( p_filter, CFG_PREFIX "ratio" );
     if( p_sys->i_ratio <= 0)
         p_sys->i_ratio = 1;
-    p_sys->b_replace = var_CreateGetBool( p_this, CFG_PREFIX "replace" );
-    p_sys->psz_prefix = var_CreateGetString( p_this, CFG_PREFIX "prefix" );
-    p_sys->psz_path = var_GetNonEmptyString( p_this, CFG_PREFIX "path" );
+    p_sys->b_replace = var_CreateGetBool( p_filter, CFG_PREFIX "replace" );
+    p_sys->psz_prefix = var_CreateGetString( p_filter, CFG_PREFIX "prefix" );
+    p_sys->psz_path = var_GetNonEmptyString( p_filter, CFG_PREFIX "path" );
     if( p_sys->psz_path == NULL )
         p_sys->psz_path = config_GetUserDir( VLC_PICTURES_DIR );
 
diff --git a/modules/video_filter/sepia.c b/modules/video_filter/sepia.c
index ce4b111ece0..0554fd22980 100644
--- a/modules/video_filter/sepia.c
+++ b/modules/video_filter/sepia.c
@@ -41,7 +41,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create      ( vlc_object_t * );
+static int  Create      ( filter_t * );
 
 static void RVSepia( picture_t *, picture_t *, int );
 static void PlanarI420Sepia( picture_t *, picture_t *, int);
@@ -65,11 +65,10 @@ vlc_module_begin ()
     set_help( N_("Gives video a warmer tone by applying sepia effect") )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_integer_with_range( CFG_PREFIX "intensity", 120, 0, 255,
                            SEPIA_INTENSITY_TEXT, SEPIA_INTENSITY_LONGTEXT,
                            false )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 /*****************************************************************************
@@ -109,9 +108,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Sepia vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
     /* Allocate structure */
diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c
index e1210c1c588..974ada988e6 100644
--- a/modules/video_filter/sharpen.c
+++ b/modules/video_filter/sharpen.c
@@ -49,7 +49,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 static int SharpenCallback( vlc_object_t *, char const *,
                             vlc_value_t, vlc_value_t, void * );
@@ -67,12 +67,11 @@ vlc_module_begin ()
     set_help(SHARPEN_HELP)
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_capability( "video filter", 0 )
     add_float_with_range( FILTER_PREFIX "sigma", 0.05, 0.0, 2.0,
         SIG_TEXT, SIG_LONGTEXT, false )
     change_safe()
     add_shortcut( "sharpen" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -96,10 +95,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Sharpen vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
     const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
     if( !p_chroma || p_chroma->plane_count != 3 ||
diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 481ac5b401b..93cfaa9be5d 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -41,7 +41,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Open (vlc_object_t *);
+static int  Open (filter_t *);
 
 #define CFG_PREFIX "transform-"
 
@@ -57,7 +57,6 @@ vlc_module_begin()
     set_description(N_("Video transformation filter"))
     set_shortname(N_("Transformation"))
     set_help(N_("Rotate or flip the video"))
-    set_capability("video filter", 0)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
 
@@ -66,7 +65,7 @@ vlc_module_begin()
         change_safe()
 
     add_shortcut("transform")
-    set_callback(Open)
+    set_callback_video_filter(Open)
 vlc_module_end()
 
 /*****************************************************************************
@@ -301,9 +300,8 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
     return VLC_SUCCESS;
 }
 
-static int Open(vlc_object_t *object)
+static int Open(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)object;
     const video_format_t *src = &filter->fmt_in.video;
     video_format_t       *dst = &filter->fmt_out.video;
 
diff --git a/modules/video_filter/vhs.c b/modules/video_filter/vhs.c
index 001d47295a2..e44aff65edb 100644
--- a/modules/video_filter/vhs.c
+++ b/modules/video_filter/vhs.c
@@ -98,25 +98,23 @@ static int  vhs_sliding_effect_apply( filter_t *, picture_t * );
  * Module descriptor
  *****************************************************************************/
 
-static int  Open ( vlc_object_t * );
+static int  Open ( filter_t * );
 static void Close( filter_t * );
 
 vlc_module_begin()
     set_description( N_("VHS movie effect video filter") )
     set_shortname(   N_("VHS movie" ) )
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
-    set_callback( Open )
+    set_callback_video_filter( Open )
 vlc_module_end()
 
 /**
  * Open the filter
  */
-static int Open( vlc_object_t *p_this )
+static int Open( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
     /* Assert video in match with video out */
diff --git a/modules/video_filter/wave.c b/modules/video_filter/wave.c
index 9a7ba896065..dae7b652335 100644
--- a/modules/video_filter/wave.c
+++ b/modules/video_filter/wave.c
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create    ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -48,12 +48,11 @@ static int  Create    ( vlc_object_t * );
 vlc_module_begin ()
     set_description( N_("Wave video filter") )
     set_shortname( N_( "Wave" ))
-    set_capability( "video filter", 0 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
 
     add_shortcut( "wave" )
-    set_callback( Create )
+    set_callback_video_filter( Create )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER(Filter)
@@ -75,10 +74,8 @@ typedef struct
  *****************************************************************************
  * This function allocates and initializes a Distort vout method.
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const vlc_chroma_description_t *p_chroma =
         vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
     if( p_chroma == NULL || p_chroma->plane_count == 0 )
@@ -86,7 +83,7 @@ static int Create( vlc_object_t *p_this )
 
     /* Allocate structure */
     filter_sys_t *p_sys = p_filter->p_sys =
-        vlc_obj_malloc( p_this, sizeof(*p_sys) );
+        vlc_obj_malloc( VLC_OBJECT(p_filter), sizeof(*p_sys) );
     if( !p_sys )
         return VLC_ENOMEM;
 
-- 
2.26.2



More information about the vlc-devel mailing list