[vlc-commits] filters: use macro to set the typed Open callback for video converters

Steve Lhomme git at videolan.org
Tue Oct 13 11:07:07 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Oct  8 16:25:14 2020 +0200| [0d5d447d704644f425727a86404ba1646b06062a] | committer: Steve Lhomme

filters: use macro to set the typed Open callback for video converters

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d5d447d704644f425727a86404ba1646b06062a
---

 include/vlc_filter.h             |  9 +++++++++
 modules/arm_neon/chroma_yuv.c    |  9 +++------
 modules/arm_neon/yuv_rgb.c       |  9 +++------
 modules/hw/d3d11/d3d11_filters.c |  6 ++----
 modules/hw/d3d11/d3d11_filters.h |  4 ++--
 modules/hw/d3d11/d3d11_surface.c | 11 ++++-------
 modules/hw/d3d9/d3d9_filters.c   |  6 ++----
 modules/hw/d3d9/d3d9_filters.h   |  4 ++--
 modules/hw/d3d9/dxa9.c           |  7 ++-----
 modules/hw/mmal/converter.c      |  8 +++-----
 modules/hw/nvdec/chroma.c        |  9 +++------
 modules/hw/vaapi/chroma.c        |  9 ++++-----
 modules/hw/vaapi/filters.c       |  3 +--
 modules/hw/vaapi/filters.h       |  2 +-
 modules/hw/vdpau/chroma.c        | 18 +++++++-----------
 modules/video_chroma/chain.c     |  9 +++------
 modules/video_chroma/cvpx.c      | 29 ++++++++++-------------------
 modules/video_chroma/grey_yuv.c  |  9 +++------
 modules/video_chroma/i420_nv12.c |  8 ++------
 modules/video_chroma/i420_rgb.c  | 24 +++++++++++-------------
 modules/video_chroma/i420_yuy2.c | 15 ++++++---------
 modules/video_chroma/i422_i420.c |  9 +++------
 modules/video_chroma/i422_yuy2.c | 13 +++++--------
 modules/video_chroma/omxdl.c     | 20 ++++++++------------
 modules/video_chroma/rv32.c      |  9 +++------
 modules/video_chroma/swscale.c   |  8 +++-----
 modules/video_chroma/yuvp.c      |  9 +++------
 modules/video_chroma/yuy2_i420.c |  9 +++------
 modules/video_chroma/yuy2_i422.c |  9 +++------
 modules/video_filter/scale.c     |  9 +++------
 30 files changed, 117 insertions(+), 186 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 4497435420..c610680b3a 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -141,6 +141,7 @@ struct vlc_filter_operations
 };
 
 typedef int (*vlc_open_deinterlace)(filter_t *);
+typedef int (*vlc_video_converter_open)(filter_t *);
 
 
 #define set_deinterlace_callback( activate )     \
@@ -152,6 +153,14 @@ typedef int (*vlc_open_deinterlace)(filter_t *);
     set_capability( "video filter", 0 )          \
     add_shortcut( "deinterlace" )
 
+#define set_callback_video_converter( activate, priority ) \
+    {                                                      \
+        vlc_video_converter_open open__ = activate;        \
+        (void) open__;                                     \
+        set_callback(activate)                             \
+    }                                                      \
+    set_capability( "video converter", priority )
+
 /** Structure describing a filter
  * @warning BIG FAT WARNING : the code relies on the first 4 members of
  * filter_t and decoder_t to be the same, so if you have anything to add,
diff --git a/modules/arm_neon/chroma_yuv.c b/modules/arm_neon/chroma_yuv.c
index 6715f228a9..bf72154a76 100644
--- a/modules/arm_neon/chroma_yuv.c
+++ b/modules/arm_neon/chroma_yuv.c
@@ -29,12 +29,11 @@
 #include <vlc_cpu.h>
 #include "arm_neon/chroma_neon.h"
 
-static int Open (vlc_object_t *);
+static int Open (filter_t *);
 
 vlc_module_begin ()
     set_description (N_("ARM NEON video chroma conversions"))
-    set_capability ("video converter", 250)
-    set_callback(Open)
+    set_callback_video_converter(Open, 250)
 vlc_module_end ()
 
 #define DEFINE_PACK(pack, pict) \
@@ -214,10 +213,8 @@ static void VYUY_I422 (filter_t *filter, picture_t *src, picture_t *dst)
 }
 VIDEO_FILTER_WRAPPER (VYUY_I422)
 
-static int Open (vlc_object_t *obj)
+static int Open (filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if (!vlc_CPU_ARM_NEON())
         return VLC_EGENERIC;
     if ((filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
diff --git a/modules/arm_neon/yuv_rgb.c b/modules/arm_neon/yuv_rgb.c
index a654a72f50..5dca930f21 100644
--- a/modules/arm_neon/yuv_rgb.c
+++ b/modules/arm_neon/yuv_rgb.c
@@ -30,12 +30,11 @@
 #include <vlc_cpu.h>
 #include "arm_neon/chroma_neon.h"
 
-static int Open (vlc_object_t *);
+static int Open (filter_t *);
 
 vlc_module_begin ()
     set_description (N_("ARM NEON video chroma YUV->RGBA"))
-    set_capability ("video converter", 250)
-    set_callback(Open)
+    set_callback_video_converter(Open, 250)
 vlc_module_end ()
 
 /*
@@ -131,10 +130,8 @@ VIDEO_FILTER_WRAPPER (YV12_RGBA)
 VIDEO_FILTER_WRAPPER (NV21_RGBA)
 VIDEO_FILTER_WRAPPER (NV12_RGBA)
 
-static int Open (vlc_object_t *obj)
+static int Open (filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if (!vlc_CPU_ARM_NEON())
         return VLC_EGENERIC;
 
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index 53070a76bc..2c18dbb2a9 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -596,12 +596,10 @@ vlc_module_begin()
     set_deinterlace_callback( D3D11OpenDeinterlace )
 
     add_submodule()
-    set_capability( "video converter", 10 )
-    set_callback( D3D11OpenConverter )
+    set_callback_video_converter( D3D11OpenConverter, 10 )
 
     add_submodule()
-    set_callback( D3D11OpenCPUConverter )
-    set_capability( "video converter", 10 )
+    set_callback_video_converter( D3D11OpenCPUConverter, 10 )
 
     add_submodule()
     set_description(N_("Direct3D11"))
diff --git a/modules/hw/d3d11/d3d11_filters.h b/modules/hw/d3d11/d3d11_filters.h
index 411afda4b9..9c8137df14 100644
--- a/modules/hw/d3d11/d3d11_filters.h
+++ b/modules/hw/d3d11/d3d11_filters.h
@@ -29,8 +29,8 @@
 #include "../../video_chroma/d3d11_fmt.h"
 
 int  D3D11OpenDeinterlace(filter_t *);
-int  D3D11OpenConverter(vlc_object_t *);
-int  D3D11OpenCPUConverter(vlc_object_t *);
+int  D3D11OpenConverter(filter_t *);
+int  D3D11OpenCPUConverter(filter_t *);
 
 int  D3D11OpenDecoderDeviceW8(vlc_decoder_device *, vout_window_t *);
 int  D3D11OpenDecoderDeviceAny(vlc_decoder_device *, vout_window_t *);
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 9fa42114aa..e561853e03 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -691,10 +691,8 @@ static const struct vlc_filter_operations NV12_D3D11_ops = {
     .filter_video = NV12_D3D11_Filter, .close = D3D11CloseCPUConverter,
 };
 
-int D3D11OpenConverter( vlc_object_t *obj )
+int D3D11OpenConverter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)obj;
-
     if ( !is_d3d11_opaque(p_filter->fmt_in.video.i_chroma) )
         return VLC_EGENERIC;
     if ( GetD3D11ContextPrivate(p_filter->vctx_in) == NULL )
@@ -743,7 +741,7 @@ int D3D11OpenConverter( vlc_object_t *obj )
         return VLC_EGENERIC;
     }
 
-    filter_sys_t *p_sys = vlc_obj_calloc(obj, 1, sizeof(filter_sys_t));
+    filter_sys_t *p_sys = vlc_obj_calloc(VLC_OBJECT(p_filter), 1, sizeof(filter_sys_t));
     if (!p_sys)
         return VLC_ENOMEM;
 
@@ -764,9 +762,8 @@ int D3D11OpenConverter( vlc_object_t *obj )
     return VLC_SUCCESS;
 }
 
-int D3D11OpenCPUConverter( vlc_object_t *obj )
+int D3D11OpenCPUConverter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)obj;
     int err = VLC_EGENERIC;
     filter_sys_t *p_sys = NULL;
 
@@ -804,7 +801,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
         return VLC_EGENERIC;
     }
 
-    p_sys = vlc_obj_calloc(obj, 1, sizeof(filter_sys_t));
+    p_sys = vlc_obj_calloc(VLC_OBJECT(p_filter), 1, sizeof(filter_sys_t));
     if (!p_sys) {
         vlc_decoder_device_Release(dec_device);
         return VLC_ENOMEM;
diff --git a/modules/hw/d3d9/d3d9_filters.c b/modules/hw/d3d9/d3d9_filters.c
index deb6b06744..db4ede3487 100644
--- a/modules/hw/d3d9/d3d9_filters.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -516,12 +516,10 @@ vlc_module_begin()
     set_deinterlace_callback( D3D9OpenDeinterlace )
 
     add_submodule()
-    set_capability( "video converter", 10 )
-    set_callback( D3D9OpenConverter )
+    set_callback_video_converter( D3D9OpenConverter, 10 )
 
     add_submodule()
-    set_callback( D3D9OpenCPUConverter )
-    set_capability( "video converter", 10 )
+    set_callback_video_converter( D3D9OpenCPUConverter, 10 )
 
     add_submodule()
     set_description(N_("Direct3D9"))
diff --git a/modules/hw/d3d9/d3d9_filters.h b/modules/hw/d3d9/d3d9_filters.h
index 219b079bbc..7148429330 100644
--- a/modules/hw/d3d9/d3d9_filters.h
+++ b/modules/hw/d3d9/d3d9_filters.h
@@ -29,8 +29,8 @@
 #include "../../video_chroma/d3d9_fmt.h"
 
 int  D3D9OpenDeinterlace(filter_t *);
-int  D3D9OpenConverter(vlc_object_t *);
-int  D3D9OpenCPUConverter(vlc_object_t *);
+int  D3D9OpenConverter(filter_t *);
+int  D3D9OpenCPUConverter(filter_t *);
 
 int D3D9OpenDecoderDevice(vlc_decoder_device *, vout_window_t *);
 
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 6fcb33e10f..ea6f8091bf 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -388,10 +388,8 @@ static picture_t *YV12_D3D9_Filter( filter_t *p_filter, picture_t *p_pic )
     return p_outpic;
 }
 
-int D3D9OpenConverter( vlc_object_t *obj )
+int D3D9OpenConverter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)obj;
-
     if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE &&
          p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
         return VLC_EGENERIC;
@@ -460,9 +458,8 @@ static const struct vlc_filter_operations YV12_D3D9_ops = {
     .filter_video = YV12_D3D9_Filter, .close = D3D9CloseCPUConverter,
 };
 
-int D3D9OpenCPUConverter( vlc_object_t *obj )
+int D3D9OpenCPUConverter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)obj;
     int err = VLC_EGENERIC;
     picture_t *p_dst = NULL;
 
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index dbdee120b5..872ffe4892 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -61,7 +61,7 @@ static const char * const  ppsz_converter_text[] = {
     "Hardware Video Scaler", "ISP", "Resizer"
 };
 
-int OpenConverter(vlc_object_t *);
+static int OpenConverter(filter_t *);
 
 vlc_module_begin()
     add_submodule()
@@ -70,12 +70,11 @@ vlc_module_begin()
     set_shortname(N_("MMAL resizer"))
     set_description(N_("MMAL resizing conversion filter"))
     add_shortcut("mmal_converter")
-    set_capability( "video converter", 900 )
 #ifndef NDEBUG
     add_integer( MMAL_CONVERTER_TYPE_NAME, FILTER_RESIZER_HVS, MMAL_CONVERTER_TYPE_TEXT, MMAL_CONVERTER_TYPE_LONGTEXT, true )
         change_integer_list( pi_converter_modes, ppsz_converter_text )
 #endif
-    set_callback(OpenConverter)
+    set_callback_video_converter(OpenConverter, 900)
 vlc_module_end()
 
 #define MMAL_SLICE_HEIGHT 16
@@ -783,9 +782,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = conv_filter, .flush = conv_flush, .close = CloseConverter,
 };
 
-int OpenConverter(vlc_object_t * obj)
+static int OpenConverter(filter_t *p_filter)
 {
-    filter_t * const p_filter = (filter_t *)obj;
     int ret = VLC_EGENERIC;
     converter_sys_t *sys;
     MMAL_STATUS_T status;
diff --git a/modules/hw/nvdec/chroma.c b/modules/hw/nvdec/chroma.c
index 2e09fb18ce..1cc647c0a1 100644
--- a/modules/hw/nvdec/chroma.c
+++ b/modules/hw/nvdec/chroma.c
@@ -31,15 +31,14 @@
 
 #include "nvdec_fmt.h"
 
-static int OpenCUDAToCPU( vlc_object_t * );
+static int OpenCUDAToCPU( filter_t * );
 
 vlc_module_begin()
     set_shortname(N_("CUDA converter"))
     set_description(N_("CUDA/NVDEC Chroma Converter filter"))
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_capability("video converter", 10)
-    set_callbacks(OpenCUDAToCPU, NULL)
+    set_callback_video_converter(OpenCUDAToCPU, 10)
 vlc_module_end()
 
 #define CALL_CUDA(func, ...) CudaCheckErr(VLC_OBJECT(p_filter), devsys->cudaFunctions, devsys->cudaFunctions->func(__VA_ARGS__), #func)
@@ -121,10 +120,8 @@ static const struct vlc_filter_operations filter_ops = {
     .filter_video = FilterCUDAToCPU,
 };
 
-static int OpenCUDAToCPU( vlc_object_t *p_this )
+static int OpenCUDAToCPU( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if ( p_filter->vctx_in == NULL ||
          vlc_video_context_GetType(p_filter->vctx_in) != VLC_VIDEO_CONTEXT_NVDEC )
         return VLC_EGENERIC;
diff --git a/modules/hw/vaapi/chroma.c b/modules/hw/vaapi/chroma.c
index dfd573ef1e..f43e0dc1cd 100644
--- a/modules/hw/vaapi/chroma.c
+++ b/modules/hw/vaapi/chroma.c
@@ -325,9 +325,8 @@ static const struct vlc_filter_operations filter_download_ops = {
 };
 
 int
-vlc_vaapi_OpenChroma(vlc_object_t *obj)
+vlc_vaapi_OpenChroma(filter_t *filter)
 {
-    filter_t *const     filter = (filter_t *)obj;
     filter_sys_t *      filter_sys;
 
     if (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height
@@ -345,7 +344,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
 
     if (!(filter_sys = calloc(1, sizeof(filter_sys_t))))
     {
-        msg_Err(obj, "unable to allocate memory");
+        msg_Err(filter, "unable to allocate memory");
         return VLC_ENOMEM;
     }
     filter_sys->derive_failed = false;
@@ -370,7 +369,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
         filter_sys->dpy = dec_device->opaque;
 
         filter_sys->dest_pics =
-            vlc_vaapi_PoolNew(obj, filter->vctx_out, filter_sys->dpy,
+            vlc_vaapi_PoolNew(VLC_OBJECT(filter), filter->vctx_out, filter_sys->dpy,
                               DEST_PICS_POOL_SZ, &filter_sys->va_surface_ids,
                               &filter->fmt_out.video);
         if (!filter_sys->dest_pics)
@@ -403,7 +402,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
     }
 
     filter->p_sys = filter_sys;
-    msg_Warn(obj, "Using SW chroma filter for %dx%d %4.4s -> %4.4s",
+    msg_Warn(filter, "Using SW chroma filter for %dx%d %4.4s -> %4.4s",
              filter->fmt_in.video.i_width,
              filter->fmt_in.video.i_height,
              (const char *) &filter->fmt_in.video.i_chroma,
diff --git a/modules/hw/vaapi/filters.c b/modules/hw/vaapi/filters.c
index de79b4b663..6b04fe879e 100644
--- a/modules/hw/vaapi/filters.c
+++ b/modules/hw/vaapi/filters.c
@@ -1161,6 +1161,5 @@ vlc_module_begin()
     add_shortcut("sharpen")
 
     add_submodule()
-    set_capability("video converter", 10)
-    set_callback(vlc_vaapi_OpenChroma)
+    set_callback_video_converter(vlc_vaapi_OpenChroma, 10)
 vlc_module_end()
diff --git a/modules/hw/vaapi/filters.h b/modules/hw/vaapi/filters.h
index 83a51811cf..b30fabc811 100644
--- a/modules/hw/vaapi/filters.h
+++ b/modules/hw/vaapi/filters.h
@@ -28,7 +28,7 @@
 #include "vlc_vaapi.h"
 
 /* chroma filters callbacks */
-int  vlc_vaapi_OpenChroma(vlc_object_t *obj);
+int  vlc_vaapi_OpenChroma(filter_t *);
 void vlc_vaapi_CloseChroma(filter_t *);
 
 #endif /* VLC_VAAPI_FILTERS_H */
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index bef3eda76a..17a26c0a49 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -761,10 +761,8 @@ static const struct vlc_filter_operations filter_output_ycbcr_ops = {
     .filter_video = YCbCrRender, .flush = Flush, .close = OutputClose,
 };
 
-static int OutputOpen(vlc_object_t *obj)
+static int OutputOpen(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if (filter->fmt_out.video.i_chroma != VLC_CODEC_VDPAU_OUTPUT)
         return VLC_EGENERIC;
 
@@ -775,7 +773,7 @@ static int OutputOpen(vlc_object_t *obj)
     if (dec_device == NULL)
         return VLC_EGENERIC;
 
-    vlc_vdp_mixer_t *sys = vlc_obj_malloc(obj, sizeof (*sys));
+    vlc_vdp_mixer_t *sys = vlc_obj_malloc(VLC_OBJECT(filter), sizeof (*sys));
     if (unlikely(sys == NULL))
     {
         vlc_decoder_device_Release(dec_device);
@@ -825,7 +823,7 @@ static int OutputOpen(vlc_object_t *obj)
         return VLC_EGENERIC;
 
     /* Allocate the output surface picture pool */
-    sys->pool = OutputPoolAlloc(obj, vdpau_decoder,
+    sys->pool = OutputPoolAlloc(VLC_OBJECT(filter), vdpau_decoder,
                                 &filter->fmt_out.video);
     if (sys->pool == NULL)
     {
@@ -898,9 +896,8 @@ static const struct vlc_filter_operations filter_ycbcr_ops = {
     .filter_video = VideoExport_Filter,
 };
 
-static int YCbCrOpen(vlc_object_t *obj)
+static int YCbCrOpen(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
     VdpChromaType type;
     VdpYCbCrFormat format;
 
@@ -918,7 +915,7 @@ static int YCbCrOpen(vlc_object_t *obj)
           != filter->fmt_in.video.i_sar_den * filter->fmt_out.video.i_sar_num))
         return VLC_EGENERIC;
 
-    vlc_vdp_yuv_getter_t *sys = vlc_obj_malloc(obj, sizeof (*sys));
+    vlc_vdp_yuv_getter_t *sys = vlc_obj_malloc(VLC_OBJECT(filter), sizeof (*sys));
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
     sys->format = format;
@@ -941,10 +938,9 @@ static const char *const algo_names[] = {
 vlc_module_begin()
     set_shortname(N_("VDPAU"))
     set_description(N_("VDPAU surface conversions"))
-    set_capability("video converter", 10)
     set_category(CAT_VIDEO)
     set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_callback(OutputOpen)
+    set_callback_video_converter(OutputOpen, 10)
 
     add_integer("vdpau-deinterlace",
                 VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL,
@@ -961,5 +957,5 @@ vlc_module_begin()
        N_("Scaling quality"), N_("High quality scaling level"), true)
 
     add_submodule()
-    set_callback(YCbCrOpen)
+    set_callback_video_converter(YCbCrOpen, 10)
 vlc_module_end()
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index f303b98795..05c5a899fb 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -37,14 +37,13 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int       ActivateConverter  ( vlc_object_t * );
+static int       ActivateConverter  ( filter_t * );
 static int       ActivateFilter     ( vlc_object_t * );
 static void      Destroy            ( filter_t * );
 
 vlc_module_begin ()
     set_description( N_("Video filtering using a chain of video filter modules") )
-    set_capability( "video converter", 1 )
-    set_callback( ActivateConverter )
+    set_callback_video_converter( ActivateConverter, 1 )
     add_submodule ()
         set_capability( "video filter", 0 )
         set_callback( ActivateFilter )
@@ -223,10 +222,8 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
     return VLC_SUCCESS;
 }
 
-static int ActivateConverter( vlc_object_t *p_this )
+static int ActivateConverter( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     const bool b_chroma = p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma;
     const bool b_resize = p_filter->fmt_in.video.i_width  != p_filter->fmt_out.video.i_width ||
                           p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height;
diff --git a/modules/video_chroma/cvpx.c b/modules/video_chroma/cvpx.c
index 97bf253773..0f732e0e4c 100644
--- a/modules/video_chroma/cvpx.c
+++ b/modules/video_chroma/cvpx.c
@@ -37,14 +37,14 @@
 #include "../codec/vt_utils.h"
 #include "../video_chroma/copy.h"
 
-static int Open(vlc_object_t *);
+static int Open(filter_t *);
 static void Close(filter_t *);
 
 #if !TARGET_OS_IPHONE
-static int Open_CVPX_to_CVPX(vlc_object_t *);
+static int Open_CVPX_to_CVPX(filter_t *);
 static void Close_CVPX_to_CVPX(filter_t *);
 
-static int Open_chain_CVPX(vlc_object_t *);
+static int Open_chain_CVPX(filter_t *);
 static void Close_chain_CVPX(filter_t *);
 #endif
 
@@ -66,18 +66,15 @@ typedef struct
 
 vlc_module_begin ()
     set_description("Conversions from/to CoreVideo buffers")
-    set_capability("video converter", 10)
-    set_callback(Open)
+    set_callback_video_converter(Open, 10)
 #if !TARGET_OS_IPHONE
     add_submodule()
     set_description("Conversions between CoreVideo buffers")
-    set_callback(Open_CVPX_to_CVPX)
-    set_capability("video converter", 10)
+    set_callback_video_converter(Open_CVPX_to_CVPX, 10)
 
     add_submodule()
     set_description("Fast CoreVideo resize+conversion")
-    set_callback(Open_chain_CVPX)
-    set_capability("video converter", 11)
+    set_callback_video_converter(Open_chain_CVPX, 11)
 #endif
 vlc_module_end ()
 
@@ -254,10 +251,8 @@ static const struct vlc_filter_operations SW_TO_CVPX_ops = {
     .filter_video = SW_TO_CVPX_Filter, .close = Close,
 };
 
-static int Open(vlc_object_t *obj)
+static int Open(filter_t *p_filter)
 {
-    filter_t *p_filter = (filter_t *)obj;
-
     if (p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
         || p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width)
         return VLC_EGENERIC;
@@ -443,10 +438,8 @@ static const struct vlc_filter_operations filter_ops = {
 };
 
 static int
-Open_CVPX_to_CVPX(vlc_object_t *obj)
+Open_CVPX_to_CVPX(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     /* Avoid conversion to self if we're not resizing */
     if (filter->fmt_in.video.i_chroma == filter->fmt_out.video.i_chroma &&
         filter->fmt_in.video.i_visible_width == filter->fmt_out.video.i_visible_width &&
@@ -568,10 +561,8 @@ static const struct vlc_filter_operations chain_CVPX_ops = {
 };
 
 static int
-Open_chain_CVPX(vlc_object_t *obj)
+Open_chain_CVPX(filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     bool is_input_valid = false;
     bool is_output_valid = false;
 
@@ -629,7 +620,7 @@ Open_chain_CVPX(vlc_object_t *obj)
     if (!is_input_valid || !is_output_valid)
         return VLC_EGENERIC;
 
-    msg_Dbg(obj, "Starting CVPX conversion chain %4.4s -> %4.4s",
+    msg_Dbg(filter, "Starting CVPX conversion chain %4.4s -> %4.4s",
              (const char *)&input_chroma,
              (const char *)&output_chroma);
 
diff --git a/modules/video_chroma/grey_yuv.c b/modules/video_chroma/grey_yuv.c
index 6cf35a9b70..1339362ae8 100644
--- a/modules/video_chroma/grey_yuv.c
+++ b/modules/video_chroma/grey_yuv.c
@@ -39,15 +39,14 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 80 )
-    set_callback( Activate )
+    set_callback_video_converter( Activate, 80 )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER( GREY_I420 )
@@ -72,10 +71,8 @@ GetFilterOperations( filter_t *filter )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( p_filter->fmt_out.video.i_width & 1
      || p_filter->fmt_out.video.i_height & 1 )
     {
diff --git a/modules/video_chroma/i420_nv12.c b/modules/video_chroma/i420_nv12.c
index a54e03a517..76d80f5a5d 100644
--- a/modules/video_chroma/i420_nv12.c
+++ b/modules/video_chroma/i420_nv12.c
@@ -146,11 +146,8 @@ VIDEO_FILTER_WRAPPER_CLOSE( P010_I42010B, Delete )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
-
     /* video must be even, because 4:2:0 is subsampled by 2 in both ways */
     if( p_filter->fmt_in.video.i_width  & 1
      || p_filter->fmt_in.video.i_height & 1 )
@@ -234,6 +231,5 @@ static int Create( vlc_object_t *p_this )
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("YUV planar to semiplanar conversions") )
-    set_capability( "video converter", 160 )
-    set_callback( Create )
+    set_callback_video_converter( Create, 160 )
 vlc_module_end ()
diff --git a/modules/video_chroma/i420_rgb.c b/modules/video_chroma/i420_rgb.c
index dc79754f6a..b0cc8e8d23 100644
--- a/modules/video_chroma/i420_rgb.c
+++ b/modules/video_chroma/i420_rgb.c
@@ -54,27 +54,26 @@ static void Set8bppPalette( filter_t *, uint8_t * );
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
-static int  Activate   ( vlc_object_t * );
+static int  Activate   ( filter_t * );
 static void Deactivate ( filter_t * );
 
 vlc_module_begin ()
 #if defined (SSE2)
     set_description( N_( "SSE2 I420,IYUV,YV12 to "
                         "RV15,RV16,RV24,RV32 conversions") )
-    set_capability( "video converter", 120 )
+    set_callback_video_converter( Activate, 120 )
 # define vlc_CPU_capable() vlc_CPU_SSE2()
 #elif defined (MMX)
     set_description( N_( "MMX I420,IYUV,YV12 to "
                         "RV15,RV16,RV24,RV32 conversions") )
-    set_capability( "video converter", 100 )
+    set_callback_video_converter( Activate, 100 )
 # define vlc_CPU_capable() vlc_CPU_MMX()
 #else
     set_description( N_("I420,IYUV,YV12 to "
                        "RGB8,RV15,RV16,RV24,RV32 conversions") )
-    set_capability( "video converter", 80 )
+    set_callback_video_converter( Activate, 80 )
 # define vlc_CPU_capable() (true)
 #endif
-    set_callback( Activate )
 vlc_module_end ()
 
 #ifndef PLAIN
@@ -95,9 +94,8 @@ VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_RGB32, Deactivate )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
 #ifdef PLAIN
     size_t i_tables_size;
 #endif
@@ -130,7 +128,7 @@ static int Activate( vlc_object_t *p_this )
                        && p_filter->fmt_out.video.i_bmask == 0x001f ) )
                     {
                         /* R5G5B6 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is R5G5B5");
+                        msg_Dbg(p_filter, "RGB pixel format is R5G5B5");
                         p_filter->ops = &I420_R5G5B5_ops;
                     }
                     else if( ( p_filter->fmt_out.video.i_rmask == 0xf800
@@ -138,7 +136,7 @@ static int Activate( vlc_object_t *p_this )
                             && p_filter->fmt_out.video.i_bmask == 0x001f ) )
                     {
                         /* R5G6B5 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is R5G6B5");
+                        msg_Dbg(p_filter, "RGB pixel format is R5G6B5");
                         p_filter->ops = &I420_R5G6B5_ops;
                     }
                     else
@@ -151,7 +149,7 @@ static int Activate( vlc_object_t *p_this )
                      && p_filter->fmt_out.video.i_bmask == 0x000000ff )
                     {
                         /* A8R8G8B8 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is A8R8G8B8");
+                        msg_Dbg(p_filter, "RGB pixel format is A8R8G8B8");
                         p_filter->ops = &I420_A8R8G8B8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0xff000000
@@ -159,7 +157,7 @@ static int Activate( vlc_object_t *p_this )
                           && p_filter->fmt_out.video.i_bmask == 0x0000ff00 )
                     {
                         /* R8G8B8A8 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is R8G8B8A8");
+                        msg_Dbg(p_filter, "RGB pixel format is R8G8B8A8");
                         p_filter->ops = &I420_R8G8B8A8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x0000ff00
@@ -167,7 +165,7 @@ static int Activate( vlc_object_t *p_this )
                           && p_filter->fmt_out.video.i_bmask == 0xff000000 )
                     {
                         /* B8G8R8A8 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is B8G8R8A8");
+                        msg_Dbg(p_filter, "RGB pixel format is B8G8R8A8");
                         p_filter->ops = &I420_B8G8R8A8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x000000ff
@@ -175,7 +173,7 @@ static int Activate( vlc_object_t *p_this )
                           && p_filter->fmt_out.video.i_bmask == 0x00ff0000 )
                     {
                         /* A8B8G8R8 pixel format */
-                        msg_Dbg(p_this, "RGB pixel format is A8B8G8R8");
+                        msg_Dbg(p_filter, "RGB pixel format is A8B8G8R8");
                         p_filter->ops = &I420_A8B8G8R8_ops;
                     }
                     else
diff --git a/modules/video_chroma/i420_yuy2.c b/modules/video_chroma/i420_yuy2.c
index ad6359de6f..8dd222f019 100644
--- a/modules/video_chroma/i420_yuy2.c
+++ b/modules/video_chroma/i420_yuy2.c
@@ -60,7 +60,7 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor.
@@ -68,23 +68,22 @@ static int  Activate ( vlc_object_t * );
 vlc_module_begin ()
 #if defined (MODULE_NAME_IS_i420_yuy2)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 80 )
+    set_callback_video_converter( Activate, 80 )
 # define vlc_CPU_capable() (true)
 #elif defined (MODULE_NAME_IS_i420_yuy2_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 160 )
+    set_callback_video_converter( Activate, 160 )
 # define vlc_CPU_capable() vlc_CPU_MMX()
 #elif defined (MODULE_NAME_IS_i420_yuy2_sse2)
     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 250 )
+    set_callback_video_converter( Activate, 250 )
 # define vlc_CPU_capable() vlc_CPU_SSE2()
 #elif defined (MODULE_NAME_IS_i420_yuy2_altivec)
     set_description(
             _("AltiVec conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "video converter", 250 )
+    set_callback_video_converter( Activate, 250 )
 # define vlc_CPU_capable() vlc_CPU_ALTIVEC()
 #endif
-    set_callback( Activate )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER( I420_YUY2 )
@@ -130,10 +129,8 @@ GetFilterOperations( filter_t *p_filter )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( !vlc_CPU_capable() )
         return VLC_EGENERIC;
 
diff --git a/modules/video_chroma/i422_i420.c b/modules/video_chroma/i422_i420.c
index ac9098efb2..53c9d4082e 100644
--- a/modules/video_chroma/i422_i420.c
+++ b/modules/video_chroma/i422_i420.c
@@ -40,15 +40,14 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 60 )
-    set_callback( Activate )
+    set_callback_video_converter( Activate, 60 )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER( I422_I420 )
@@ -60,10 +59,8 @@ VIDEO_FILTER_WRAPPER( I422_YUVA )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( p_filter->fmt_in.video.i_width & 1
      || p_filter->fmt_in.video.i_height & 1 )
     {
diff --git a/modules/video_chroma/i422_yuy2.c b/modules/video_chroma/i422_yuy2.c
index 9f401ee5ab..9e4ecb729d 100644
--- a/modules/video_chroma/i422_yuy2.c
+++ b/modules/video_chroma/i422_yuy2.c
@@ -47,7 +47,7 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor
@@ -55,21 +55,20 @@ static int  Activate ( vlc_object_t * );
 vlc_module_begin ()
 #if defined (MODULE_NAME_IS_i422_yuy2)
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 80 )
+    set_callback_video_converter( Activate, 80 )
 # define vlc_CPU_capable() (true)
 # define VLC_TARGET
 #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 100 )
+    set_callback_video_converter( Activate, 100 )
 # define vlc_CPU_capable() vlc_CPU_MMX()
 # define VLC_TARGET VLC_MMX
 #elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 120 )
+    set_callback_video_converter( Activate, 120 )
 # define vlc_CPU_capable() vlc_CPU_SSE2()
 # define VLC_TARGET VLC_SSE
 #endif
-    set_callback( Activate )
 vlc_module_end ()
 
 
@@ -115,10 +114,8 @@ GetFilterOperations(filter_t *filter)
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( !vlc_CPU_capable() )
         return VLC_EGENERIC;
     if( (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) & 1
diff --git a/modules/video_chroma/omxdl.c b/modules/video_chroma/omxdl.c
index e643f0735d..f1684f0667 100644
--- a/modules/video_chroma/omxdl.c
+++ b/modules/video_chroma/omxdl.c
@@ -29,13 +29,12 @@
 #include <omxtypes.h>
 #include <omxIP.h>
 
-static int Open (vlc_object_t *);
-static int OpenScaler (vlc_object_t *);
+static int Open (filter_t *);
+static int OpenScaler (filter_t *);
 
 vlc_module_begin ()
     set_description (N_("OpenMAX DL image processing"))
-    set_capability ("video converter", 90)
-    set_callback(Open)
+    set_callback_video_converter(Open,  90)
 vlc_module_end ()
 
 #define SRC_WIDTH  (filter->fmt_in.video.i_width)
@@ -246,16 +245,14 @@ static int FixRV12 (video_format_t *fmt)
 }
 
 /*** Initialization ***/
-static int Open (vlc_object_t *obj)
+static int Open (filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-
     if (filter->fmt_in.video.orientation != filter->fmt_out.video.orientation)
         return VLC_EGENERIC;
 
     if ((filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
      || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
-        return OpenScaler (obj);
+        return OpenScaler (filter);
 
     switch (filter->fmt_in.video.i_chroma)
     {
@@ -333,7 +330,7 @@ static int Open (vlc_object_t *obj)
             return VLC_EGENERIC;
     }
     /* fallback to scaler (conversion with 1:1 scale) */
-    return OpenScaler (obj);
+    return OpenScaler (filter);
 }
 
 /* TODO: configurable interpolation */
@@ -468,10 +465,9 @@ static void I422_RGB_Scale (filter_t *filter, picture_t *src, picture_t *dst)
 VIDEO_FILTER_WRAPPER (I422_RGB_Scale)
 
 /*** Scaling initialization ***/
-static int OpenScaler (vlc_object_t *obj)
+static int OpenScaler (filter_t *filter)
 {
-    filter_t *filter = (filter_t *)obj;
-    int *conv = vlc_obj_malloc(obj, sizeof (*conv));
+    int *conv = vlc_obj_malloc(VLC_OBJECT(filter), sizeof (*conv));
 
     if (unlikely(conv == NULL))
         return VLC_ENOMEM;
diff --git a/modules/video_chroma/rv32.c b/modules/video_chroma/rv32.c
index 835b658531..c4300d4568 100644
--- a/modules/video_chroma/rv32.c
+++ b/modules/video_chroma/rv32.c
@@ -35,7 +35,7 @@
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
-static int  OpenFilter ( vlc_object_t * );
+static int  OpenFilter ( filter_t * );
 static picture_t *Filter( filter_t *, picture_t * );
 
 /*****************************************************************************
@@ -43,8 +43,7 @@ static picture_t *Filter( filter_t *, picture_t * );
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("RV32 conversion filter") )
-    set_capability( "video converter", 1 )
-    set_callback( OpenFilter )
+    set_callback_video_converter( OpenFilter, 1 )
 vlc_module_end ()
 
 static const struct vlc_filter_operations filter_ops = {
@@ -54,10 +53,8 @@ static const struct vlc_filter_operations filter_ops = {
 /*****************************************************************************
  * 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;
-
     /* XXX Only support RV24 -> RV32 conversion */
     if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_RGB24 ||
         (p_filter->fmt_out.video.i_chroma != VLC_CODEC_RGB32 &&
diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c
index 6f623cde48..2f982b8295 100644
--- a/modules/video_chroma/swscale.c
+++ b/modules/video_chroma/swscale.c
@@ -51,7 +51,7 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  OpenScaler( vlc_object_t * );
+static int  OpenScaler( filter_t * );
 static void CloseScaler( filter_t * );
 
 #define SCALEMODE_TEXT N_("Scaling mode")
@@ -67,10 +67,9 @@ static const char *const ppsz_mode_descriptions[] =
 vlc_module_begin ()
     set_description( N_("Video scaling filter") )
     set_shortname( N_("Swscale" ) )
-    set_capability( "video converter", 150 )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_callback( OpenScaler )
+    set_callback_video_converter( OpenScaler, 150 )
     add_integer( "swscale-mode", 2, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, true )
         change_integer_list( pi_mode_values, ppsz_mode_descriptions )
 vlc_module_end ()
@@ -145,9 +144,8 @@ static const struct vlc_filter_operations filter_ops = {
 /*****************************************************************************
  * OpenScaler: probe the filter and return score
  *****************************************************************************/
-static int OpenScaler( vlc_object_t *p_this )
+static int OpenScaler( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t*)p_this;
     filter_sys_t *p_sys;
 
     int i_sws_mode;
diff --git a/modules/video_chroma/yuvp.c b/modules/video_chroma/yuvp.c
index 52ba3dbad2..ff4e1d2f4a 100644
--- a/modules/video_chroma/yuvp.c
+++ b/modules/video_chroma/yuvp.c
@@ -40,12 +40,11 @@
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static int  Open ( vlc_object_t * );
+static int  Open ( filter_t * );
 
 vlc_module_begin ()
     set_description( N_("YUVP converter") )
-    set_capability( "video converter", 10 )
-    set_callback( Open )
+    set_callback_video_converter( Open, 10 )
 vlc_module_end ()
 
 /****************************************************************************
@@ -58,10 +57,8 @@ VIDEO_FILTER_WRAPPER( Convert )
 /*****************************************************************************
  * Open: probe the filter and return score
  *****************************************************************************/
-static int Open( vlc_object_t *p_this )
+static int Open( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t*)p_this;
-
     /* It only supports YUVP to YUVA/RGBA without scaling
      * (if scaling is required another filter can do it) */
     if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVP ||
diff --git a/modules/video_chroma/yuy2_i420.c b/modules/video_chroma/yuy2_i420.c
index 5094feeb50..2ed4d66061 100644
--- a/modules/video_chroma/yuy2_i420.c
+++ b/modules/video_chroma/yuy2_i420.c
@@ -39,15 +39,14 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 80 )
-    set_callback( Activate )
+    set_callback_video_converter( Activate, 80 )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER( YUY2_I420 )
@@ -59,10 +58,8 @@ VIDEO_FILTER_WRAPPER( UYVY_I420 )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( p_filter->fmt_in.video.i_width & 1
      || p_filter->fmt_in.video.i_height & 1 )
     {
diff --git a/modules/video_chroma/yuy2_i422.c b/modules/video_chroma/yuy2_i422.c
index cccfb10f08..9b9b97bb16 100644
--- a/modules/video_chroma/yuy2_i422.c
+++ b/modules/video_chroma/yuy2_i422.c
@@ -39,15 +39,14 @@
 /*****************************************************************************
  * Local and extern prototypes.
  *****************************************************************************/
-static int  Activate ( vlc_object_t * );
+static int  Activate ( filter_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
-    set_capability( "video converter", 80 )
-    set_callback( Activate )
+    set_callback_video_converter( Activate, 80 )
 vlc_module_end ()
 
 VIDEO_FILTER_WRAPPER( YUY2_I422 )
@@ -59,10 +58,8 @@ VIDEO_FILTER_WRAPPER( UYVY_I422 )
  *****************************************************************************
  * This function allocates and initializes a chroma function
  *****************************************************************************/
-static int Activate( vlc_object_t *p_this )
+static int Activate( filter_t *p_filter )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-
     if( p_filter->fmt_in.video.i_width & 1
      || p_filter->fmt_in.video.i_height & 1 )
     {
diff --git a/modules/video_filter/scale.c b/modules/video_filter/scale.c
index 944ad3e117..b3836b2ab8 100644
--- a/modules/video_filter/scale.c
+++ b/modules/video_filter/scale.c
@@ -37,7 +37,7 @@
 /****************************************************************************
  * Local prototypes
  ****************************************************************************/
-static int  OpenFilter ( vlc_object_t * );
+static int  OpenFilter ( filter_t * );
 VIDEO_FILTER_WRAPPER(Filter)
 
 /*****************************************************************************
@@ -45,17 +45,14 @@ VIDEO_FILTER_WRAPPER(Filter)
  *****************************************************************************/
 vlc_module_begin ()
     set_description( N_("Video scaling filter") )
-    set_capability( "video converter", 10 )
-    set_callback( OpenFilter )
+    set_callback_video_converter( OpenFilter, 10 )
 vlc_module_end ()
 
 /*****************************************************************************
  * 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;
-
     if( ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVP &&
           p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA &&
           p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420 &&




More information about the vlc-commits mailing list