filters: add an operations structure to set the callbacks
authorAlexandre Janniaux <ajanni@videolabs.io>
Tue, 25 Aug 2020 16:50:04 +0000 (18:50 +0200)
committerSteve Lhomme <robux4@ycbcr.xyz>
Thu, 8 Oct 2020 08:27:51 +0000 (10:27 +0200)
Generate a simple operations structure for filters generating their own filter
callback via VIDEO_FILTER_WRAPPER().

The filter chain sets a mouse handler on video filters that don't have one,
just as before, by using a local version of the ops structure of the filter and
adding the local mouse callback.

Co-authored-by: Steve Lhomme <robux4@ycbcr.xyz>
127 files changed:
include/vlc_filter.h
modules/access/screen/screen.c
modules/arm_neon/chroma_yuv.c
modules/arm_neon/yuv_rgb.c
modules/audio_filter/audiobargraph_a.c
modules/audio_filter/center.c
modules/audio_filter/channel_mixer/dolby.c
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/mono.c
modules/audio_filter/channel_mixer/remap.c
modules/audio_filter/channel_mixer/simple.c
modules/audio_filter/channel_mixer/spatialaudio.cpp
modules/audio_filter/channel_mixer/trivial.c
modules/audio_filter/chorus_flanger.c
modules/audio_filter/compressor.c
modules/audio_filter/converter/format.c
modules/audio_filter/converter/tospdif.c
modules/audio_filter/equalizer.c
modules/audio_filter/gain.c
modules/audio_filter/karaoke.c
modules/audio_filter/libebur128.c
modules/audio_filter/normvol.c
modules/audio_filter/param_eq.c
modules/audio_filter/resampler/bandlimited.c
modules/audio_filter/resampler/soxr.c
modules/audio_filter/resampler/speex.c
modules/audio_filter/resampler/src.c
modules/audio_filter/resampler/ugly.c
modules/audio_filter/scaletempo.c
modules/audio_filter/spatializer/spatializer.cpp
modules/audio_filter/stereo_widen.c
modules/hw/d3d11/d3d11_deinterlace.c
modules/hw/d3d11/d3d11_filters.c
modules/hw/d3d11/d3d11_surface.c
modules/hw/d3d9/d3d9_filters.c
modules/hw/d3d9/dxa9.c
modules/hw/d3d9/dxva2_deinterlace.c
modules/hw/mmal/converter.c
modules/hw/mmal/deinterlace.c
modules/hw/nvdec/chroma.c
modules/hw/vaapi/chroma.c
modules/hw/vaapi/filters.c
modules/hw/vdpau/adjust.c
modules/hw/vdpau/chroma.c
modules/hw/vdpau/deinterlace.c
modules/hw/vdpau/sharpen.c
modules/spu/audiobargraph_v.c
modules/spu/dynamicoverlay/dynamicoverlay.c
modules/spu/logo.c
modules/spu/marq.c
modules/spu/mosaic.c
modules/spu/rss.c
modules/spu/subsdelay.c
modules/text_renderer/freetype/freetype.c
modules/text_renderer/nsspeechsynthesizer.m
modules/text_renderer/sapi.cpp
modules/text_renderer/svg.c
modules/text_renderer/tdummy.c
modules/video_chroma/chain.c
modules/video_chroma/cvpx.c
modules/video_chroma/grey_yuv.c
modules/video_chroma/i420_nv12.c
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_yuy2.c
modules/video_chroma/i422_i420.c
modules/video_chroma/i422_yuy2.c
modules/video_chroma/omxdl.c
modules/video_chroma/rv32.c
modules/video_chroma/swscale.c
modules/video_chroma/yuvp.c
modules/video_chroma/yuy2_i420.c
modules/video_chroma/yuy2_i422.c
modules/video_filter/adjust.c
modules/video_filter/alphamask.c
modules/video_filter/anaglyph.c
modules/video_filter/antiflicker.c
modules/video_filter/ball.c
modules/video_filter/blend.cpp
modules/video_filter/blendbench.c
modules/video_filter/bluescreen.c
modules/video_filter/canvas.c
modules/video_filter/ci_filters.m
modules/video_filter/colorthres.c
modules/video_filter/croppadd.c
modules/video_filter/deinterlace/deinterlace.c
modules/video_filter/edgedetection.c
modules/video_filter/erase.c
modules/video_filter/extract.c
modules/video_filter/fps.c
modules/video_filter/freeze.c
modules/video_filter/gaussianblur.c
modules/video_filter/gradfun.c
modules/video_filter/gradient.c
modules/video_filter/grain.c
modules/video_filter/hqdn3d.c
modules/video_filter/invert.c
modules/video_filter/magnify.c
modules/video_filter/mirror.c
modules/video_filter/motionblur.c
modules/video_filter/motiondetect.c
modules/video_filter/oldmovie.c
modules/video_filter/opencv_example.cpp
modules/video_filter/opencv_wrapper.c
modules/video_filter/posterize.c
modules/video_filter/postproc.c
modules/video_filter/psychedelic.c
modules/video_filter/puzzle.c
modules/video_filter/ripple.c
modules/video_filter/rotate.c
modules/video_filter/scale.c
modules/video_filter/scene.c
modules/video_filter/sepia.c
modules/video_filter/sharpen.c
modules/video_filter/transform.c
modules/video_filter/vhs.c
modules/video_filter/wave.c
modules/visualization/glspectrum.c
modules/visualization/goom.c
modules/visualization/projectm.cpp
modules/visualization/visual/visual.c
modules/visualization/vsxu.cpp
src/audio_output/filters.c
src/audio_output/meter.c
src/misc/filter.c
src/misc/filter_chain.c
src/misc/image.c
src/video_output/vout_subpictures.c

index d9c274a..0ced8ea 100644 (file)
@@ -79,68 +79,44 @@ typedef struct filter_owner_t
 
 struct vlc_mouse_t;
 
-/** 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,
- * do it at the end of the structure.
- */
-struct filter_t
+struct vlc_filter_operations
 {
-    struct vlc_object_t obj;
-
-    /* Module properties */
-    module_t *          p_module;
-    void               *p_sys;
-
-    /* Input format */
-    es_format_t         fmt_in;
-    vlc_video_context   *vctx_in;  // video filter, set by owner
-
-    /* Output format of filter */
-    es_format_t         fmt_out;
-    vlc_video_context   *vctx_out; // video filter, handled by the filter
-    bool                b_allow_fmt_out_change;
-
-    /* Name of the "video filter" shortcut that is requested, can be NULL */
-    const char *        psz_name;
-    /* Filter configuration */
-    config_chain_t *    p_cfg;
-
+    /* Operation depending on the type of filter. */
     union
     {
         /** Filter a picture (video filter) */
-        picture_t * (*pf_video_filter)( filter_t *, picture_t * );
+        picture_t * (*filter_video)(filter_t *, picture_t *);
 
         /** Filter an audio block (audio filter) */
-        block_t * (*pf_audio_filter)( filter_t *, block_t * );
+        block_t * (*filter_audio)(filter_t *, block_t *);
 
         /** Blend a subpicture onto a picture (blend) */
-        void (*pf_video_blend)( filter_t *,  picture_t *, const picture_t *,
-                                 int, int, int );
+        void (*blend_video)(filter_t *,  picture_t *, const picture_t *,
+                            int, int, int);
 
         /** Generate a subpicture (sub source) */
-        subpicture_t *(*pf_sub_source)( filter_t *, vlc_tick_t );
+        subpicture_t *(*source_sub)(filter_t *, vlc_tick_t);
 
         /** Filter a subpicture (sub filter) */
-        subpicture_t *(*pf_sub_filter)( filter_t *, subpicture_t * );
+        subpicture_t *(*filter_sub)(filter_t *, subpicture_t *);
 
         /** Render text (text render) */
-        int (*pf_render)( filter_t *, subpicture_region_t *,
-                          subpicture_region_t *, const vlc_fourcc_t * );
+        int (*render)(filter_t *, subpicture_region_t *,
+                      subpicture_region_t *, const vlc_fourcc_t *);
     };
 
     union
     {
         /* TODO: video filter drain */
         /** Drain (audio filter) */
-        block_t *(*pf_audio_drain) ( filter_t * );
+        block_t *(*drain_audio)(filter_t *);
     };
 
     /** Flush
      *
      * Flush (i.e. discard) any internal buffer in a video or audio filter.
      */
-    void (*pf_flush)( filter_t * );
+    void (*flush)(filter_t *);
 
     /** Change viewpoint
      *
@@ -148,20 +124,49 @@ struct filter_t
      * used for Ambisonics rendering will change its output according to this
      * viewpoint.
      */
-    void (*pf_change_viewpoint)( filter_t *, const vlc_viewpoint_t * );
+    void (*change_viewpoint)(filter_t *, const vlc_viewpoint_t *);
 
-    union
-    {
-        /** Filter mouse state (video filter).
-         *
-         * If non-NULL, you must convert from output to input formats:
-         * - If VLC_SUCCESS is returned, the mouse state is propagated.
-         * - Otherwise, the mouse change is not propagated.
-         * If NULL, the mouse state is considered unchanged and will be
-         * propagated. */
-        int (*pf_video_mouse)( filter_t *, struct vlc_mouse_t *,
-                               const struct vlc_mouse_t *p_old);
-    };
+    /** Filter mouse state (video filter).
+     *
+     * If non-NULL, you must convert from output to input formats:
+     * - If VLC_SUCCESS is returned, the mouse state is propagated.
+     * - Otherwise, the mouse change is not propagated.
+     * If NULL, the mouse state is considered unchanged and will be
+     * propagated. */
+    int (*video_mouse)(filter_t *, struct vlc_mouse_t *,
+                       const struct vlc_mouse_t *p_old);
+
+};
+
+/** 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,
+ * do it at the end of the structure.
+ */
+struct filter_t
+{
+    struct vlc_object_t obj;
+
+    /* Module properties */
+    module_t *          p_module;
+    void               *p_sys;
+
+    /* Input format */
+    es_format_t         fmt_in;
+    vlc_video_context   *vctx_in;  // video filter, set by owner
+
+    /* Output format of filter */
+    es_format_t         fmt_out;
+    vlc_video_context   *vctx_out; // video filter, handled by the filter
+    bool                b_allow_fmt_out_change;
+
+    /* Name of the "video filter" shortcut that is requested, can be NULL */
+    const char *        psz_name;
+    /* Filter configuration */
+    config_chain_t *    p_cfg;
+
+    /* Implementation of filter API */
+    const struct vlc_filter_operations *ops;
 
     /** Private structure for the owner of the filter */
     filter_owner_t      owner;
@@ -170,7 +175,7 @@ struct filter_t
 /**
  * This function will return a new picture usable by p_filter as an output
  * buffer. You have to release it using picture_Release or by returning
- * it to the caller as a pf_video_filter return value.
+ * it to the caller as a ops->filter_video return value.
  * Provided for convenience.
  *
  * \param p_filter filter_t object
@@ -198,15 +203,15 @@ static inline picture_t *filter_NewPicture( filter_t *p_filter )
  */
 static inline void filter_Flush( filter_t *p_filter )
 {
-    if( p_filter->pf_flush != NULL )
-        p_filter->pf_flush( p_filter );
+    if( p_filter->ops && p_filter->ops->flush != NULL )
+        p_filter->ops->flush( p_filter );
 }
 
 static inline void filter_ChangeViewpoint( filter_t *p_filter,
                                            const vlc_viewpoint_t *vp)
 {
-    if( p_filter->pf_change_viewpoint != NULL )
-        p_filter->pf_change_viewpoint( p_filter, vp );
+    if( p_filter->ops && p_filter->ops->change_viewpoint != NULL )
+        p_filter->ops->change_viewpoint( p_filter, vp );
 }
 
 static inline vlc_decoder_device * filter_HoldDecoderDevice( filter_t *p_filter )
@@ -239,8 +244,8 @@ static inline vlc_decoder_device * filter_HoldDecoderDeviceType( filter_t *p_fil
  */
 static inline block_t *filter_DrainAudio( filter_t *p_filter )
 {
-    if( p_filter->pf_audio_drain )
-        return p_filter->pf_audio_drain( p_filter );
+    if( p_filter->ops && p_filter->ops->drain_audio )
+        return p_filter->ops->drain_audio( p_filter );
     else
         return NULL;
 }
@@ -255,7 +260,7 @@ static inline void filter_SendAudioLoudness(filter_t *filter,
 /**
  * This function will return a new subpicture usable by p_filter as an output
  * buffer. You have to release it using subpicture_Delete or by returning it to
- * the caller as a pf_sub_source return value.
+ * the caller as a ops->sub_source return value.
  * Provided for convenience.
  *
  * \param p_filter filter_t object
@@ -353,7 +358,10 @@ VLC_API void filter_DeleteBlend( vlc_blender_t * );
         }                                                               \
         picture_Release( p_pic );                                       \
         return p_outpic;                                                \
-    }
+    }                                                                   \
+    static const struct vlc_filter_operations name ## _ops = {          \
+        .filter_video = name ## _Filter,                                \
+    };
 
 /**
  * Filter chain management API
index 0c472de..fda1417 100644 (file)
@@ -390,7 +390,7 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
     if( p_sys->p_blend )
     {
         p_sys->dst.p->p_pixels = p_dst;
-        p_sys->p_blend->pf_video_blend( p_sys->p_blend,
+        p_sys->p_blend->ops->blend_video( p_sys->p_blend,
                                         &p_sys->dst,
                                         p_sys->p_mouse,
 #ifdef SCREEN_SUBSCREEN
index 53fe0f8..6715f22 100644 (file)
@@ -231,16 +231,16 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_YUYV:
-                    filter->pf_video_filter = I420_YUYV_Filter;
+                    filter->ops = &I420_YUYV_ops;
                     break;
                 case VLC_CODEC_UYVY:
-                    filter->pf_video_filter = I420_UYVY_Filter;
+                    filter->ops = &I420_UYVY_ops;
                     break;
                 case VLC_CODEC_YVYU:
-                    filter->pf_video_filter = I420_YVYU_Filter;
+                    filter->ops = &I420_YVYU_ops;
                     break;
                 case VLC_CODEC_VYUY:
-                    filter->pf_video_filter = I420_VYUY_Filter;
+                    filter->ops = &I420_VYUY_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -251,16 +251,16 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_YUYV:
-                    filter->pf_video_filter = I420_YVYU_Filter;
+                    filter->ops = &I420_YVYU_ops;
                     break;
                 case VLC_CODEC_UYVY:
-                    filter->pf_video_filter = I420_VYUY_Filter;
+                    filter->ops = &I420_VYUY_ops;
                     break;
                 case VLC_CODEC_YVYU:
-                    filter->pf_video_filter = I420_YUYV_Filter;
+                    filter->ops = &I420_YUYV_ops;
                     break;
                 case VLC_CODEC_VYUY:
-                    filter->pf_video_filter = I420_UYVY_Filter;
+                    filter->ops = &I420_UYVY_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -271,16 +271,16 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_YUYV:
-                    filter->pf_video_filter = I422_YUYV_Filter;
+                    filter->ops = &I422_YUYV_ops;
                     break;
                 case VLC_CODEC_UYVY:
-                    filter->pf_video_filter = I422_UYVY_Filter;
+                    filter->ops = &I422_UYVY_ops;
                     break;
                 case VLC_CODEC_YVYU:
-                    filter->pf_video_filter = I422_YVYU_Filter;
+                    filter->ops = &I422_YVYU_ops;
                     break;
                 case VLC_CODEC_VYUY:
-                    filter->pf_video_filter = I422_VYUY_Filter;
+                    filter->ops = &I422_VYUY_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -292,10 +292,10 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = Semiplanar_Planar_420_Filter;
+                    filter->ops = &Semiplanar_Planar_420_ops;
                     break;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = Semiplanar_Planar_420_Swap_Filter;
+                    filter->ops = &Semiplanar_Planar_420_Swap_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -306,10 +306,10 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = Semiplanar_Planar_420_Swap_Filter;
+                    filter->ops = &Semiplanar_Planar_420_Swap_ops;
                     break;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = Semiplanar_Planar_420_Filter;
+                    filter->ops = &Semiplanar_Planar_420_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -320,7 +320,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = Semiplanar_Planar_422_Filter;
+                    filter->ops = &Semiplanar_Planar_422_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -331,7 +331,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I444:
-                    filter->pf_video_filter = Semiplanar_Planar_444_Filter;
+                    filter->ops = &Semiplanar_Planar_444_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -343,7 +343,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = YUYV_I422_Filter;
+                    filter->ops = &YUYV_I422_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -353,7 +353,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = UYVY_I422_Filter;
+                    filter->ops = &UYVY_I422_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -363,7 +363,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = YVYU_I422_Filter;
+                    filter->ops = &YVYU_I422_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -374,7 +374,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = VYUY_I422_Filter;
+                    filter->ops = &VYUY_I422_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
index 84b5328..a654a72 100644 (file)
@@ -150,7 +150,7 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_in.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = I420_RV16_Filter;
+                    filter->ops = &I420_RV16_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
@@ -166,16 +166,16 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_in.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = I420_RGBA_Filter;
+                    filter->ops = &I420_RGBA_ops;
                     break;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = YV12_RGBA_Filter;
+                    filter->ops = &YV12_RGBA_ops;
                     break;
                 case VLC_CODEC_NV21:
-                    filter->pf_video_filter = NV21_RGBA_Filter;
+                    filter->ops = &NV21_RGBA_ops;
                     break;
                 case VLC_CODEC_NV12:
-                    filter->pf_video_filter = NV12_RGBA_Filter;
+                    filter->ops = &NV12_RGBA_ops;
                     break;
                 default:
                     return VLC_EGENERIC;
index e744b52..90a212c 100644 (file)
@@ -137,7 +137,12 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
 
index fe9301c..14a41e1 100644 (file)
@@ -75,7 +75,12 @@ static int Open (vlc_object_t *in)
     filter->fmt_out.audio.i_rate = filter->fmt_in.audio.i_rate;
     aout_FormatPrepare(&filter->fmt_in.audio);
     aout_FormatPrepare(&filter->fmt_out.audio);
-    filter->pf_audio_filter = Process;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Process,
+    };
+    filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index 8d5c63c..de05e3e 100644 (file)
@@ -138,7 +138,11 @@ static int Create( vlc_object_t *p_this )
         ++i;
     }
 
-    p_filter->pf_audio_filter = DoWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 0c91a15..77aa324 100644 (file)
@@ -478,7 +478,12 @@ static int OpenFilter( vlc_object_t *p_this )
     {
         p_filter->fmt_in.audio.i_physical_channels = AOUT_CHANS_5_0;
     }
-    p_filter->pf_audio_filter = Convert;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Convert,
+    };
+    p_filter->ops = &filter_ops;
 
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     aout_FormatPrepare(&p_filter->fmt_out.audio);
index 0c383e7..74f8ccb 100644 (file)
@@ -384,7 +384,12 @@ static int OpenFilter( vlc_object_t *p_this )
         p_filter->fmt_out.audio.i_channels = 2;
     }
     p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
-    p_filter->pf_audio_filter = Convert;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Convert,
+    };
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_this, "%4.4s->%4.4s, channels %d->%d, bits per sample: %i->%i",
              (char *)&p_filter->fmt_in.i_codec,
index 8c49a5f..e6299f8 100644 (file)
@@ -366,7 +366,11 @@ static int OpenFilter( vlc_object_t *p_this )
              aout_FormatPrintChannels( audio_in ),
              aout_FormatPrintChannels( audio_out ) );
 
-    p_filter->pf_audio_filter = Remap;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Remap,
+    };
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index 567269a..06f17e3 100644 (file)
@@ -345,8 +345,11 @@ static int OpenFilter( vlc_object_t *p_this )
     if( do_work == NULL )
         return VLC_EGENERIC;
 
-    p_filter->pf_audio_filter = Filter;
-    p_filter->p_sys = (void *)do_work;
+    static const struct vlc_filter_operations filter_ops =
+        { .filter_audio = Filter };
+
+    p_filter->ops = &filter_ops;
+    p_filter->p_sys = do_work;
     return VLC_SUCCESS;
 }
 
@@ -392,4 +395,3 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
 
     return p_out;
 }
-
index acb9ed0..803c03b 100644 (file)
@@ -318,6 +318,16 @@ static int allocateBuffers(filter_spatialaudio *p_sys)
     return VLC_SUCCESS;
 }
 
+static const struct FilterOperationInitializer {
+    struct vlc_filter_operations ops {};
+    FilterOperationInitializer()
+    {
+        ops.filter_audio = Mix;
+        ops.flush = Flush;
+        ops.change_viewpoint = ChangeViewpoint;
+    };
+} filter_ops;
+
 static int OpenBinauralizer(vlc_object_t *p_this)
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -391,9 +401,7 @@ static int OpenBinauralizer(vlc_object_t *p_this)
     aout_FormatPrepare(outfmt);
 
     p_filter->p_sys = p_sys;
-    p_filter->pf_audio_filter = Mix;
-    p_filter->pf_flush = Flush;
-    p_filter->pf_change_viewpoint = ChangeViewpoint;
+    p_filter->ops = &filter_ops.ops;
 
     return VLC_SUCCESS;
 }
@@ -541,9 +549,7 @@ static int Open(vlc_object_t *p_this)
     }
 
     p_filter->p_sys = p_sys;
-    p_filter->pf_audio_filter = Mix;
-    p_filter->pf_flush = Flush;
-    p_filter->pf_change_viewpoint = ChangeViewpoint;
+    p_filter->ops = &filter_ops.ops;
 
     return VLC_SUCCESS;
 }
index 6bb58e3..faa142e 100644 (file)
@@ -174,6 +174,18 @@ static int Create( vlc_object_t *p_this )
     const audio_format_t *infmt = &p_filter->fmt_in.audio;
     const audio_format_t *outfmt = &p_filter->fmt_out.audio;
 
+    static const struct vlc_filter_operations equal_filter_ops =
+        { .filter_audio = Equals };
+
+    static const struct vlc_filter_operations extract_filter_ops =
+        { .filter_audio = Extract };
+
+    static const struct vlc_filter_operations upmix_filter_ops =
+        { .filter_audio = Upmix };
+
+    static const struct vlc_filter_operations downmix_filter_ops =
+        { .filter_audio = Downmix };
+
     if( infmt->i_physical_channels == 0 )
     {
         assert( infmt->i_channels > 0 );
@@ -181,7 +193,7 @@ static int Create( vlc_object_t *p_this )
             return VLC_EGENERIC;
         if( aout_FormatNbChannels( outfmt ) == infmt->i_channels )
         {
-            p_filter->pf_audio_filter = Equals;
+            p_filter->ops = &equal_filter_ops;
             return VLC_SUCCESS;
         }
         else
@@ -189,7 +201,7 @@ static int Create( vlc_object_t *p_this )
             if( infmt->i_channels > AOUT_CHAN_MAX )
                 msg_Info(p_filter, "%d channels will be dropped.",
                          infmt->i_channels - AOUT_CHAN_MAX);
-            p_filter->pf_audio_filter = Extract;
+            p_filter->ops = &extract_filter_ops;
             return VLC_SUCCESS;
         }
     }
@@ -211,7 +223,7 @@ static int Create( vlc_object_t *p_this )
     if ( aout_FormatNbChannels( outfmt ) == 1
       && aout_FormatNbChannels( infmt ) == 1 )
     {
-        p_filter->pf_audio_filter = Equals;
+        p_filter->ops = &equal_filter_ops;
         return VLC_SUCCESS;
     }
 
@@ -293,7 +305,7 @@ static int Create( vlc_object_t *p_this )
             }
         if( b_equals )
         {
-            p_filter->pf_audio_filter = Equals;
+            p_filter->ops = &equal_filter_ops;
             return VLC_SUCCESS;
         }
     }
@@ -305,9 +317,9 @@ static int Create( vlc_object_t *p_this )
     memcpy( p_sys->channel_map, channel_map, sizeof(channel_map) );
 
     if( aout_FormatNbChannels( outfmt ) > aout_FormatNbChannels( infmt ) )
-        p_filter->pf_audio_filter = Upmix;
+        p_filter->ops = &upmix_filter_ops;
     else
-        p_filter->pf_audio_filter = Downmix;
+        p_filter->ops = &downmix_filter_ops;
 
     return VLC_SUCCESS;
 }
index 8643c50..6732fd4 100644 (file)
@@ -196,7 +196,12 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
@@ -344,7 +349,7 @@ static int paramCallback( vlc_object_t *p_this, char const *psz_var,
         {
             p_sys->f_delayTime = oldval.f_float;
             p_sys->i_bufferLength = p_sys->i_channels * ( (int)
-                            ( ( p_sys->f_delayTime + p_sys->f_sweepDepth ) * 
+                            ( ( p_sys->f_delayTime + p_sys->f_sweepDepth ) *
                               p_filter->fmt_in.audio.i_rate/1000 ) + 1 );
         }
     }
@@ -357,7 +362,7 @@ static int paramCallback( vlc_object_t *p_this, char const *psz_var,
         {
             p_sys->f_sweepDepth = oldval.f_float;
             p_sys->i_bufferLength = p_sys->i_channels * ( (int)
-                            ( ( p_sys->f_delayTime + p_sys->f_sweepDepth ) * 
+                            ( ( p_sys->f_delayTime + p_sys->f_sweepDepth ) *
                               p_filter->fmt_in.audio.i_rate/1000 ) + 1 );
         }
     }
index 5aab1ce..5f25865 100644 (file)
@@ -256,7 +256,12 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     /* At this stage, we are ready! */
     msg_Dbg( p_filter, "compressor successfully initialized" );
index b780199..fe57dc5 100644 (file)
@@ -57,7 +57,7 @@ vlc_module_end()
  *****************************************************************************/
 
 typedef block_t *(*cvt_t)(filter_t *, block_t *);
-static cvt_t FindConversion(vlc_fourcc_t src, vlc_fourcc_t dst);
+static const struct vlc_filter_operations *FindConversion(vlc_fourcc_t src, vlc_fourcc_t dst);
 
 static int Open(vlc_object_t *object)
 {
@@ -71,10 +71,12 @@ static int Open(vlc_object_t *object)
     if (src->i_codec == dst->i_codec)
         return VLC_EGENERIC;
 
-    filter->pf_audio_filter = FindConversion(src->i_codec, dst->i_codec);
-    if (filter->pf_audio_filter == NULL)
+    const struct vlc_filter_operations *filter_ops = FindConversion(src->i_codec, dst->i_codec);
+    if (filter_ops == NULL)
         return VLC_EGENERIC;
 
+    filter->ops = filter_ops;
+
     msg_Dbg(filter, "%4.4s->%4.4s, bits per sample: %i->%i",
             (char *)&src->i_codec, (char *)&dst->i_codec,
             src->audio.i_bitspersample, dst->audio.i_bitspersample);
@@ -443,42 +445,42 @@ static block_t *Fl64toS32(filter_t *filter, block_t *b)
 static const struct {
     vlc_fourcc_t src;
     vlc_fourcc_t dst;
-    cvt_t convert;
+    struct vlc_filter_operations convert;
 } cvt_directs[] = {
-    { VLC_CODEC_U8,   VLC_CODEC_S16N, U8toS16    },
-    { VLC_CODEC_U8,   VLC_CODEC_FL32, U8toFl32   },
-    { VLC_CODEC_U8,   VLC_CODEC_S32N, U8toS32    },
-    { VLC_CODEC_U8,   VLC_CODEC_FL64, U8toFl64   },
-
-    { VLC_CODEC_S16N, VLC_CODEC_U8,   S16toU8    },
-    { VLC_CODEC_S16N, VLC_CODEC_FL32, S16toFl32  },
-    { VLC_CODEC_S16N, VLC_CODEC_S32N, S16toS32   },
-    { VLC_CODEC_S16N, VLC_CODEC_FL64, S16toFl64  },
-
-    { VLC_CODEC_FL32, VLC_CODEC_U8,   Fl32toU8   },
-    { VLC_CODEC_FL32, VLC_CODEC_S16N, Fl32toS16  },
-    { VLC_CODEC_FL32, VLC_CODEC_S32N, Fl32toS32  },
-    { VLC_CODEC_FL32, VLC_CODEC_FL64, Fl32toFl64 },
-
-    { VLC_CODEC_S32N, VLC_CODEC_U8,   S32toU8    },
-    { VLC_CODEC_S32N, VLC_CODEC_S16N, S32toS16   },
-    { VLC_CODEC_S32N, VLC_CODEC_FL32, S32toFl32  },
-    { VLC_CODEC_S32N, VLC_CODEC_FL64, S32toFl64  },
-
-    { VLC_CODEC_FL64, VLC_CODEC_U8,   Fl64toU8   },
-    { VLC_CODEC_FL64, VLC_CODEC_S16N, Fl64toS16  },
-    { VLC_CODEC_FL64, VLC_CODEC_FL32, Fl64toFl32 },
-    { VLC_CODEC_FL64, VLC_CODEC_S32N, Fl64toS32  },
-
-    { 0, 0, NULL }
+    { VLC_CODEC_U8,   VLC_CODEC_S16N, (struct vlc_filter_operations) { .filter_audio = U8toS16 }    },
+    { VLC_CODEC_U8,   VLC_CODEC_FL32, (struct vlc_filter_operations) { .filter_audio = U8toFl32 }   },
+    { VLC_CODEC_U8,   VLC_CODEC_S32N, (struct vlc_filter_operations) { .filter_audio = U8toS32 }    },
+    { VLC_CODEC_U8,   VLC_CODEC_FL64, (struct vlc_filter_operations) { .filter_audio = U8toFl64 }   },
+
+    { VLC_CODEC_S16N, VLC_CODEC_U8,   (struct vlc_filter_operations) { .filter_audio = S16toU8 }    },
+    { VLC_CODEC_S16N, VLC_CODEC_FL32, (struct vlc_filter_operations) { .filter_audio = S16toFl32 }  },
+    { VLC_CODEC_S16N, VLC_CODEC_S32N, (struct vlc_filter_operations) { .filter_audio = S16toS32 }   },
+    { VLC_CODEC_S16N, VLC_CODEC_FL64, (struct vlc_filter_operations) { .filter_audio = S16toFl64 }  },
+
+    { VLC_CODEC_FL32, VLC_CODEC_U8,   (struct vlc_filter_operations) { .filter_audio = Fl32toU8 }   },
+    { VLC_CODEC_FL32, VLC_CODEC_S16N, (struct vlc_filter_operations) { .filter_audio = Fl32toS16 }  },
+    { VLC_CODEC_FL32, VLC_CODEC_S32N, (struct vlc_filter_operations) { .filter_audio = Fl32toS32 }  },
+    { VLC_CODEC_FL32, VLC_CODEC_FL64, (struct vlc_filter_operations) { .filter_audio = Fl32toFl64 } },
+
+    { VLC_CODEC_S32N, VLC_CODEC_U8,   (struct vlc_filter_operations) { .filter_audio = S32toU8 }    },
+    { VLC_CODEC_S32N, VLC_CODEC_S16N, (struct vlc_filter_operations) { .filter_audio = S32toS16 }   },
+    { VLC_CODEC_S32N, VLC_CODEC_FL32, (struct vlc_filter_operations) { .filter_audio = S32toFl32 }  },
+    { VLC_CODEC_S32N, VLC_CODEC_FL64, (struct vlc_filter_operations) { .filter_audio = S32toFl64 }  },
+
+    { VLC_CODEC_FL64, VLC_CODEC_U8,   (struct vlc_filter_operations) { .filter_audio = Fl64toU8 }   },
+    { VLC_CODEC_FL64, VLC_CODEC_S16N, (struct vlc_filter_operations) { .filter_audio = Fl64toS16 }  },
+    { VLC_CODEC_FL64, VLC_CODEC_FL32, (struct vlc_filter_operations) { .filter_audio = Fl64toFl32 } },
+    { VLC_CODEC_FL64, VLC_CODEC_S32N, (struct vlc_filter_operations) { .filter_audio = Fl64toS32 }  },
+
+    { 0, 0, (struct vlc_filter_operations) { .filter_audio = NULL } }
 };
 
-static cvt_t FindConversion(vlc_fourcc_t src, vlc_fourcc_t dst)
+static const struct vlc_filter_operations *FindConversion(vlc_fourcc_t src, vlc_fourcc_t dst)
 {
-    for (int i = 0; cvt_directs[i].convert; i++) {
+    for (int i = 0; cvt_directs[i].convert.filter_audio; i++) {
         if (cvt_directs[i].src == src &&
             cvt_directs[i].dst == dst)
-            return cvt_directs[i].convert;
+            return &cvt_directs[i].convert;
     }
     return NULL;
 }
index c9d7e08..e513e7a 100644 (file)
@@ -616,8 +616,12 @@ static int Open( vlc_object_t *p_this )
     if( unlikely( p_sys == NULL ) )
         return VLC_ENOMEM;
 
-    p_filter->pf_audio_filter = DoWork;
-    p_filter->pf_flush = Flush;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+        .flush = Flush,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 92ccaf8..b99beb7 100644 (file)
@@ -164,7 +164,11 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
@@ -571,4 +575,3 @@ static int TwoPassCallback( vlc_object_t *p_this, char const *psz_cmd,
     vlc_mutex_unlock( &p_sys->lock );
     return VLC_SUCCESS;
 }
-
index 655d944..0496773 100644 (file)
@@ -98,7 +98,11 @@ static int Open( vlc_object_t *p_this )
     msg_Dbg( p_filter, "gain multiplier sets to %.2fx", p_sys->f_gain );
 
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = Process;
+
+    static const struct vlc_filter_operations filter_ops =
+        { .filter_audio = Process };
+    p_filter->ops = &filter_ops;
+
     return VLC_SUCCESS;
 }
 
index 62967e5..2ec3d6e 100644 (file)
@@ -54,7 +54,12 @@ static int Open (vlc_object_t *obj)
     filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&filter->fmt_in.audio);
     filter->fmt_out.audio = filter->fmt_in.audio;
-    filter->pf_audio_filter = Process;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Process,
+    };
+    filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index 2a16237..368016e 100644 (file)
@@ -230,6 +230,10 @@ Flush(filter_t *filter)
     }
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_audio = Process, .flush = Flush,
+};
+
 static int Open(vlc_object_t *this)
 {
     filter_t *filter = (filter_t *) this;
@@ -279,8 +283,7 @@ static int Open(vlc_object_t *this)
 
     filter->p_sys = sys;
     filter->fmt_out.audio = filter->fmt_in.audio;
-    filter->pf_audio_filter = Process;
-    filter->pf_flush = Flush;
+    filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index a9aa2b9..0fc0119 100644 (file)
@@ -119,7 +119,11 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index f498ffe..57efac8 100644 (file)
@@ -114,17 +114,22 @@ static int Open( vlc_object_t *p_this )
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     p_sys->f_lowf = var_InheritFloat( p_this, "param-eq-lowf");
     p_sys->f_lowgain = var_InheritFloat( p_this, "param-eq-lowgain");
     p_sys->f_highf = var_InheritFloat( p_this, "param-eq-highf");
     p_sys->f_highgain = var_InheritFloat( p_this, "param-eq-highgain");
+
     p_sys->f_f1 = var_InheritFloat( p_this, "param-eq-f1");
     p_sys->f_Q1 = var_InheritFloat( p_this, "param-eq-q1");
     p_sys->f_gain1 = var_InheritFloat( p_this, "param-eq-gain1");
+
     p_sys->f_f2 = var_InheritFloat( p_this, "param-eq-f2");
     p_sys->f_Q2 = var_InheritFloat( p_this, "param-eq-q2");
     p_sys->f_gain2 = var_InheritFloat( p_this, "param-eq-gain2");
@@ -132,7 +137,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->f_f3 = var_InheritFloat( p_this, "param-eq-f3");
     p_sys->f_Q3 = var_InheritFloat( p_this, "param-eq-q3");
     p_sys->f_gain3 = var_InheritFloat( p_this, "param-eq-gain3");
+
 
     i_samplerate = p_filter->fmt_in.audio.i_rate;
     CalcPeakEQCoeffs(p_sys->f_f1, p_sys->f_Q1, p_sys->f_gain1,
@@ -200,18 +205,18 @@ static void CalcPeakEQCoeffs( float f0, float Q, float gainDB, float Fs,
     if (f0 > Fs/2*0.95f) f0 = Fs/2*0.95f;
     if (gainDB < -40) gainDB = -40;
     if (gainDB > 40) gainDB = 40;
+
     A = powf(10, gainDB/40);
     w0 = 2*((float)M_PI)*f0/Fs;
     alpha = sinf(w0)/(2*Q);
+
     b0 = 1 + alpha*A;
     b1 = -2*cosf(w0);
     b2 = 1 - alpha*A;
     a0 = 1 + alpha/A;
     a1 = -2*cosf(w0);
     a2 = 1 - alpha/A;
+
     // Store values to coeffs and normalize by 1/a0
     coeffs[0] = b0/a0;
     coeffs[1] = b1/a0;
@@ -320,4 +325,3 @@ void ProcessEQ( const float *src, float *dest, float *state,
         }
     }
 }
-
index 2d54431..1256f71 100644 (file)
@@ -279,6 +279,10 @@ static block_t *Resample( filter_t * p_filter, block_t * p_in_buf )
     return p_out_buf;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_audio = Resample,
+};
+
 /*****************************************************************************
  * OpenFilter:
  *****************************************************************************/
@@ -306,7 +310,7 @@ static int OpenFilter( vlc_object_t *p_this )
 
     p_sys->i_old_wing = 0;
     p_sys->b_first = true;
-    p_filter->pf_audio_filter = Resample;
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_this, "%4.4s/%iKHz/%i->%4.4s/%iKHz/%i",
              (char *)&p_filter->fmt_in.i_codec,
index 1490d30..b073e3e 100644 (file)
@@ -188,10 +188,14 @@ Open( vlc_object_t *p_obj, bool b_change_ratio )
              (const char *)&p_filter->fmt_out.audio.i_format,
              p_filter->fmt_out.audio.i_rate );
 
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Resample,
+        .drain_audio = Drain,
+        .flush = Flush,
+    };
+    p_filter->ops = &filter_ops;
     p_filter->p_sys = p_sys;
-    p_filter->pf_audio_filter = Resample;
-    p_filter->pf_flush = Flush;
-    p_filter->pf_audio_drain = Drain;
     return VLC_SUCCESS;
 }
 
index eeefc4f..6c33948 100644 (file)
@@ -92,8 +92,12 @@ static int OpenResampler (vlc_object_t *obj)
         return VLC_ENOMEM;
     }
 
+    static const struct vlc_filter_operations filter_ops =
+        { .filter_audio = Resample };
+
     filter->p_sys = st;
-    filter->pf_audio_filter = Resample;
+    filter->ops = &filter_ops;
+
     return VLC_SUCCESS;
 }
 
index 1254314..5e069e7 100644 (file)
@@ -103,8 +103,13 @@ static int OpenResampler (vlc_object_t *obj)
         return VLC_EGENERIC;
     }
 
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Resample,
+    };
+    filter->ops = &filter_ops;
     filter->p_sys = s;
-    filter->pf_audio_filter = Resample;
+
     return VLC_SUCCESS;
 }
 
index 63bba80..da13a59 100644 (file)
@@ -77,7 +77,11 @@ static int CreateResampler( vlc_object_t *p_this )
      || !AOUT_FMT_LINEAR( &p_filter->fmt_in.audio ) )
         return VLC_EGENERIC;
 
-    p_filter->pf_audio_filter = DoWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index c67e01a..18f8a30 100644 (file)
@@ -444,7 +444,11 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
@@ -510,7 +514,11 @@ static int OpenPitch( vlc_object_t *p_this )
     if( !p_sys->resampler )
         return VLC_EGENERIC;
 
-    p_filter->pf_audio_filter = DoPitchWork;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = DoPitchWork,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
@@ -609,7 +617,7 @@ static block_t *DoPitchWork( filter_t * p_filter, block_t * p_in_buf )
     p_filter->fmt_in.audio.i_rate = rate_shift;
 
     /* Change rate, thus changing pitch */
-    p_in_buf = p->resampler->pf_audio_filter( p->resampler, p_in_buf );
+    p_in_buf = p->resampler->ops->filter_audio( p->resampler, p_in_buf );
 
     /* Change tempo while preserving shifted pitch */
     return DoWork( p_filter, p_in_buf );
index 4f9c19b..a1f78d3 100644 (file)
@@ -171,7 +171,16 @@ static int Open( vlc_object_t *p_this )
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     aout_FormatPrepare(&p_filter->fmt_in.audio);
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+
+    static const struct FilterOperationInitializer {
+        struct vlc_filter_operations ops {};
+        FilterOperationInitializer()
+        {
+            ops.filter_audio = DoWork;
+        };
+    } filter_ops;
+
+    p_filter->ops = &filter_ops.ops;
     return VLC_SUCCESS;
 }
 
@@ -286,4 +295,3 @@ static int DampCallback( vlc_object_t *p_this, char const *,
     msg_Dbg( p_this, "'damp' value is now %3.1f", newval.f_float );
     return VLC_SUCCESS;
 }
-
index 1ec29bf..ba19de6 100644 (file)
@@ -153,7 +153,11 @@ static int Open( vlc_object_t *obj )
         return VLC_ENOMEM;
     }
 
-    p_filter->pf_audio_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_audio = Filter,
+    };
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index b2c8d99..3eb8e9b 100644 (file)
@@ -232,6 +232,10 @@ picture_t *AllocPicture( filter_t *p_filter )
     return pic;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Deinterlace, .flush = Flush,
+};
+
 int D3D11OpenDeinterlace(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -350,8 +354,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
 
     filter->fmt_out.video   = out_fmt;
     filter->vctx_out        = vlc_video_context_Hold(filter->vctx_in);
-    filter->pf_video_filter = Deinterlace;
-    filter->pf_flush        = Flush;
+    filter->ops             = &filter_ops;
     filter->p_sys = sys;
 
     return VLC_SUCCESS;
index 868ce7a..36e3351 100644 (file)
@@ -335,6 +335,10 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Filter,
+};
+
 static int D3D11OpenAdjust(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -507,7 +511,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
         }
     }
 
-    filter->pf_video_filter = Filter;
+    filter->ops = &filter_ops;
     filter->p_sys = sys;
     filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
     d3d11_device_unlock(sys->d3d_dev);
index d6bc9ba..f3fe4dd 100644 (file)
@@ -566,7 +566,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
         sys->staging_pic->context = NULL; // some CPU filters won't like the mix of CPU/GPU
 
         picture_Hold( src );
-        sys->filter->pf_video_filter(sys->filter, src);
+        sys->filter->ops->filter_video(sys->filter, src);
 
         sys->staging_pic->context = staging_pic_ctx;
         ID3D11DeviceContext_Unmap(sys->d3d_dev->d3dcontext, p_staging_sys->resource[KNOWN_DXGI_INDEX], 0);
@@ -660,6 +660,10 @@ static picture_t *NV12_D3D11_Filter( filter_t *p_filter, picture_t *p_pic )
     return p_outpic;
 }
 
+static const struct vlc_filter_operations NV12_D3D11_ops = {
+    .filter_video = NV12_D3D11_Filter,
+};
+
 int D3D11OpenConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
@@ -679,34 +683,34 @@ int D3D11OpenConverter( vlc_object_t *obj )
     case VLC_CODEC_YV12:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_YUY2_Filter;
+        p_filter->ops = &D3D11_YUY2_ops;
         break;
     case VLC_CODEC_I420_10L:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE_10B )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_YUY2_Filter;
+        p_filter->ops = &D3D11_YUY2_ops;
         pixel_bytes = 2;
         break;
     case VLC_CODEC_NV12:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_NV12_Filter;
+        p_filter->ops = &D3D11_NV12_ops;
         break;
     case VLC_CODEC_P010:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE_10B )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_NV12_Filter;
+        p_filter->ops = &D3D11_NV12_ops;
         pixel_bytes = 2;
         break;
     case VLC_CODEC_RGBA:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE_RGBA )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_RGBA_Filter;
+        p_filter->ops = &D3D11_RGBA_ops;
         break;
     case VLC_CODEC_BGRA:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D11_OPAQUE_BGRA )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = D3D11_RGBA_Filter;
+        p_filter->ops = &D3D11_RGBA_ops;
         break;
     default:
         return VLC_EGENERIC;
@@ -753,7 +757,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
     case VLC_CODEC_YV12:
     case VLC_CODEC_NV12:
     case VLC_CODEC_P010:
-        p_filter->pf_video_filter = NV12_D3D11_Filter;
+        p_filter->ops = &NV12_D3D11_ops;
         break;
     default:
         return VLC_EGENERIC;
index 80106bc..07eaa13 100644 (file)
@@ -259,6 +259,10 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Filter,
+};
+
 static int D3D9OpenAdjust(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -450,7 +454,7 @@ static int D3D9OpenAdjust(vlc_object_t *obj)
 
     sys->hdecoder_dll = hdecoder_dll;
 
-    filter->pf_video_filter = Filter;
+    filter->ops = &filter_ops;
     filter->p_sys = sys;
     filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
 
index 563818d..afb4848 100644 (file)
@@ -258,7 +258,7 @@ static void YV12_D3D9(filter_t *p_filter, picture_t *src, picture_t *dst)
 
         picture_Hold( src );
 
-        sys->filter->pf_video_filter(sys->filter, src);
+        sys->filter->ops->filter_video(sys->filter, src);
 
         sys->staging->context = staging_pic_ctx;
 
@@ -396,23 +396,23 @@ int D3D9OpenConverter( vlc_object_t *obj )
     case VLC_CODEC_YV12:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = DXA9_YV12_Filter;
+        p_filter->ops = &DXA9_YV12_ops;
         break;
     case VLC_CODEC_I420_10L:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = DXA9_YV12_Filter;
+        p_filter->ops = &DXA9_YV12_ops;
         pixel_bytes = 2;
         break;
     case VLC_CODEC_NV12:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = DXA9_NV12_Filter;
+        p_filter->ops = &DXA9_NV12_ops;
         break;
     case VLC_CODEC_P010:
         if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
             return VLC_EGENERIC;
-        p_filter->pf_video_filter = DXA9_NV12_Filter;
+        p_filter->ops = &DXA9_NV12_ops;
         pixel_bytes = 2;
         break;
     default:
@@ -433,6 +433,10 @@ int D3D9OpenConverter( vlc_object_t *obj )
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations YV12_D3D9_ops = {
+    .filter_video = YV12_D3D9_Filter,
+};
+
 int D3D9OpenCPUConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
@@ -452,7 +456,7 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
     case VLC_CODEC_YV12:
     case VLC_CODEC_I420_10L:
     case VLC_CODEC_P010:
-        p_filter->pf_video_filter = YV12_D3D9_Filter;
+        p_filter->ops = &YV12_D3D9_ops;
         break;
     default:
         return VLC_EGENERIC;
index 7c0c4ec..0d5f582 100644 (file)
@@ -321,6 +321,10 @@ picture_t *AllocPicture( filter_t *p_filter )
     return pic;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Deinterlace, .flush = Flush,
+};
+
 int D3D9OpenDeinterlace(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -501,8 +505,7 @@ int D3D9OpenDeinterlace(vlc_object_t *obj)
 
     filter->fmt_out.video   = out_fmt;
     filter->vctx_out        = vlc_video_context_Hold(filter->vctx_in);
-    filter->pf_video_filter = Deinterlace;
-    filter->pf_flush        = Flush;
+    filter->ops             = &filter_ops;
     filter->p_sys = sys;
 
     return VLC_SUCCESS;
index 0c2a4c1..87299f6 100644 (file)
@@ -781,6 +781,10 @@ static MMAL_FOURCC_T filter_enc_in(const video_format_t * const fmt)
 }
 
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = conv_filter, .flush = conv_flush,
+};
+
 int OpenConverter(vlc_object_t * obj)
 {
     filter_t * const p_filter = (filter_t *)obj;
@@ -969,8 +973,7 @@ retry:
         }
     }
 
-    p_filter->pf_video_filter = conv_filter;
-    p_filter->pf_flush = conv_flush;
+    p_filter->ops = &filter_ops;
     // video_drain NIF in filter structure
 
     return VLC_SUCCESS;
index 0159cdb..404d200 100644 (file)
@@ -418,6 +418,14 @@ static bool is_fmt_valid_in(const vlc_fourcc_t fmt)
     return fmt == VLC_CODEC_MMAL_OPAQUE;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = deinterlace, .flush = di_flush,
+};
+
+static const struct vlc_filter_operations filter_pass_ops = {
+    .filter_video = pass_deinterlace, .flush = pass_flush,
+};
+
 static int OpenMmalDeinterlace(vlc_object_t *p_this)
 {
     filter_t *filter = (filter_t*)p_this;
@@ -500,8 +508,7 @@ static int OpenMmalDeinterlace(vlc_object_t *p_this)
 
     if (sys->use_passthrough)
     {
-        filter->pf_video_filter = pass_deinterlace;
-        filter->pf_flush = pass_flush;
+        filter->ops = &filter_pass_ops;
         return VLC_SUCCESS;
     }
 
@@ -601,8 +608,7 @@ static int OpenMmalDeinterlace(vlc_object_t *p_this)
         goto fail;
     }
 
-    filter->pf_video_filter = deinterlace;
-    filter->pf_flush = di_flush;
+    filter->ops = &filter_ops;
     return 0;
 
 fail:
index 88353f5..2e09fb1 100644 (file)
@@ -117,6 +117,10 @@ done:
     return dst;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = FilterCUDAToCPU,
+};
+
 static int OpenCUDAToCPU( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -137,7 +141,7 @@ static int OpenCUDAToCPU( vlc_object_t *p_this )
            ) )
         return VLC_EGENERIC;
 
-    p_filter->pf_video_filter = FilterCUDAToCPU;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 38b904e..7ea9525 100644 (file)
@@ -316,6 +316,14 @@ static int CheckFmt(const video_format_t *in, const video_format_t *out,
     return VLC_EGENERIC;
 }
 
+static const struct vlc_filter_operations filter_upload_ops = {
+    .filter_video = UploadSurface,
+};
+
+static const struct vlc_filter_operations filter_download_ops = {
+    .filter_video = DownloadSurface,
+};
+
 int
 vlc_vaapi_OpenChroma(vlc_object_t *obj)
 {
@@ -333,7 +341,7 @@ vlc_vaapi_OpenChroma(vlc_object_t *obj)
                  &pixel_bytes))
         return VLC_EGENERIC;
 
-    filter->pf_video_filter = is_upload ? UploadSurface : DownloadSurface;
+    filter->ops = is_upload ? &filter_upload_ops : &filter_download_ops;
 
     if (!(filter_sys = calloc(1, sizeof(filter_sys_t))))
     {
index debe2b5..ac96b16 100644 (file)
@@ -567,6 +567,10 @@ OpenAdjust_InitFilterParams(filter_t * filter, void * p_data,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations Adjust_ops = {
+    .filter_video = Adjust,
+};
+
 static int
 OpenAdjust(vlc_object_t * obj)
 {
@@ -587,7 +591,7 @@ OpenAdjust(vlc_object_t * obj)
     for (unsigned int i = 0; i < NUM_ADJUST_MODES; ++i)
         var_AddCallback(obj, adjust_params_names[i], FilterCallback, p_data);
 
-    filter->pf_video_filter = Adjust;
+    filter->ops = &Adjust_ops;
 
     return VLC_SUCCESS;
 
@@ -684,6 +688,10 @@ OpenBasicFilter_InitFilterParams(filter_t * filter, void * p_data,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations BasicFilter_ops = {
+    .filter_video = BasicFilter,
+};
+
 static int
 OpenBasicFilter(vlc_object_t * obj, VAProcFilterType filter_type,
                 const char *psz_sigma_name, struct range const *p_vlc_range)
@@ -708,7 +716,7 @@ OpenBasicFilter(vlc_object_t * obj, VAProcFilterType filter_type,
 
     var_AddCallback(obj, p_data->sigma.psz_name, FilterCallback, p_data);
 
-    filter->pf_video_filter = BasicFilter;
+    filter->ops = &BasicFilter_ops;
 
     return VLC_SUCCESS;
 
@@ -1065,6 +1073,13 @@ OpenDeinterlace_InitHistory(void * p_data, VAProcPipelineCaps const * pipeline_c
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations DeinterlaceX2_ops = {
+    .filter_video = DeinterlaceX2, .flush = Deinterlace_Flush,
+};
+static const struct vlc_filter_operations Deinterlace_ops = {
+    .filter_video = Deinterlace,   .flush = Deinterlace_Flush,
+};
+
 static int
 OpenDeinterlace(vlc_object_t * obj)
 {
@@ -1079,10 +1094,9 @@ OpenDeinterlace(vlc_object_t * obj)
         goto error;
 
     if (p_data->b_double_rate)
-        filter->pf_video_filter = DeinterlaceX2;
+        filter->ops = &DeinterlaceX2_ops;
     else
-        filter->pf_video_filter = Deinterlace;
-    filter->pf_flush = Deinterlace_Flush;
+        filter->ops = &Deinterlace_ops;
 
     for (unsigned int i = 0; i < METADATA_SIZE; ++i)
     {
index 27c8b4b..3a4d5a5 100644 (file)
@@ -139,6 +139,10 @@ static const char *const options[] = {
     "brightness", "contrast", "saturation", "hue", NULL
 };
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Adjust,
+};
+
 static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -157,7 +161,7 @@ static int Open(vlc_object_t *obj)
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
 
-    filter->pf_video_filter = Adjust;
+    filter->ops = &filter_ops;
     filter->p_sys = sys;
 
     config_ChainParse(filter, "", options, filter->p_cfg);
index fa4b1e8..06c1a63 100644 (file)
@@ -743,6 +743,14 @@ const struct vlc_video_context_operations vdpau_vctx_ops = {
     NULL,
 };
 
+static const struct vlc_filter_operations filter_output_opaque_ops = {
+    .filter_video = VideoRender, .flush = Flush,
+};
+
+static const struct vlc_filter_operations filter_output_ycbcr_ops = {
+    .filter_video = YCbCrRender, .flush = Flush,
+};
+
 static int OutputOpen(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -766,7 +774,7 @@ static int OutputOpen(vlc_object_t *obj)
 
     filter->p_sys = sys;
 
-    picture_t *(*video_filter)(filter_t *, picture_t *) = VideoRender;
+    const struct vlc_filter_operations *ops = &filter_output_opaque_ops;
 
     if (filter->fmt_in.video.i_chroma == VLC_CODEC_VDPAU_VIDEO_444)
     {
@@ -789,7 +797,7 @@ static int OutputOpen(vlc_object_t *obj)
     else
     if (vlc_fourcc_to_vdp_ycc(filter->fmt_in.video.i_chroma,
                               &sys->chroma, &sys->format))
-        video_filter = YCbCrRender;
+        ops = &filter_output_ycbcr_ops;
     else
     {
         vlc_decoder_device_Release(dec_device);
@@ -817,7 +825,7 @@ static int OutputOpen(vlc_object_t *obj)
     }
 
     /* Create the video-to-output mixer */
-    sys->mixer = MixerCreate(filter, video_filter == YCbCrRender);
+    sys->mixer = MixerCreate(filter, ops == &filter_output_ycbcr_ops);
     if (sys->mixer == VDP_INVALID_HANDLE)
     {
         picture_pool_Release(sys->pool);
@@ -834,8 +842,7 @@ static int OutputOpen(vlc_object_t *obj)
     sys->procamp.saturation = 1.f;
     sys->procamp.hue = 0.f;
 
-    filter->pf_video_filter = video_filter;
-    filter->pf_flush = Flush;
+    filter->ops = ops;
     return VLC_SUCCESS;
 }
 
@@ -888,6 +895,10 @@ static bool ChromaMatches(VdpChromaType vdp_type, vlc_fourcc_t vlc_chroma)
     }
 }
 
+static const struct vlc_filter_operations filter_ycbcr_ops = {
+    .filter_video = VideoExport_Filter,
+};
+
 static int YCbCrOpen(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -913,7 +924,7 @@ static int YCbCrOpen(vlc_object_t *obj)
         return VLC_ENOMEM;
     sys->format = format;
 
-    filter->pf_video_filter = VideoExport_Filter;
+    filter->ops = &filter_ycbcr_ops;
     filter->p_sys = sys;
     return VLC_SUCCESS;
 }
index bd66a61..2a5a996 100644 (file)
@@ -96,6 +96,10 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
     return src;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Deinterlace,
+};
+
 static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -119,7 +123,7 @@ static int Open(vlc_object_t *obj)
 
     sys->last_pts = VLC_TICK_INVALID;
 
-    filter->pf_video_filter = Deinterlace;
+    filter->ops = &filter_ops;
     filter->p_sys = sys;
     filter->fmt_out.video.i_frame_rate *= 2;
     filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
index 4aee7e3..718eedd 100644 (file)
@@ -79,6 +79,10 @@ static picture_t *Sharpen(filter_t *filter, picture_t *pic)
 
 static const char *const options[] = { "sigma", NULL };
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Sharpen,
+};
+
 static int Open(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
@@ -125,7 +129,7 @@ static int Open(vlc_object_t *obj)
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
 
-    filter->pf_video_filter = Sharpen;
+    filter->ops = &filter_ops;
     filter->p_sys = sys;
 
     config_ChainParse(filter, "sharpen-", options, filter->p_cfg);
index de3f962..9fdc78c 100644 (file)
@@ -487,6 +487,14 @@ out:
     return p_dst;
 }
 
+static const struct vlc_filter_operations filter_sub_ops = {
+    .source_sub = FilterSub,
+};
+
+static const struct vlc_filter_operations filter_video_ops = {
+    .filter_video = FilterVideo,
+};
+
 /**
  * Common open function
  */
@@ -558,9 +566,9 @@ static int OpenCommon(vlc_object_t *p_this, bool b_sub)
                          BarGraphCallback, p_sys);
 
     if (b_sub)
-        p_filter->pf_sub_source = FilterSub;
+        p_filter->ops = &filter_sub_ops;
     else
-        p_filter->pf_video_filter = FilterVideo;
+        p_filter->ops = &filter_video_ops;
 
     return VLC_SUCCESS;
 }
index b038a2d..37cdf79 100644 (file)
@@ -81,6 +81,10 @@ static const char *const ppsz_filter_options[] = {
     "input", "output", NULL
 };
 
+static const struct vlc_filter_operations filter_ops = {
+    .source_sub = Filter,
+};
+
 /*****************************************************************************
  * Create: allocates adjust video thread output method
  *****************************************************************************
@@ -110,7 +114,7 @@ static int Create( vlc_object_t *p_this )
     p_sys->b_atomic = false;
     vlc_mutex_init( &p_sys->lock );
 
-    p_filter->pf_sub_source = Filter;
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, "overlay-", ppsz_filter_options,
                        p_filter->p_cfg );
index c8d1b02..9a713cb 100644 (file)
@@ -215,6 +215,15 @@ static int OpenVideo( vlc_object_t *p_this )
     return OpenCommon( p_this, false );
 }
 
+static const struct vlc_filter_operations filter_sub_ops = {
+    .source_sub = FilterSub,
+};
+
+static const struct vlc_filter_operations filter_video_ops = {
+    .filter_video = FilterVideo,
+    .video_mouse = Mouse,
+};
+
 /**
  * Common open function
  */
@@ -293,14 +302,9 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
 
     /* Misc init */
     if( b_sub )
-    {
-        p_filter->pf_sub_source = FilterSub;
-    }
+        p_filter->ops = &filter_sub_ops;
     else
-    {
-        p_filter->pf_video_filter = FilterVideo;
-        p_filter->pf_video_mouse = Mouse;
-    }
+        p_filter->ops = &filter_video_ops;
 
     free( psz_filename );
     return VLC_SUCCESS;
index c370c53..31657aa 100644 (file)
@@ -178,6 +178,10 @@ static const char *const ppsz_filter_options[] = {
     NULL
 };
 
+static const struct vlc_filter_operations filter_ops = {
+    .source_sub = Filter,
+};
+
 /*****************************************************************************
  * CreateFilter: allocates marquee video filter
  *****************************************************************************/
@@ -228,7 +232,7 @@ static int CreateFilter( vlc_object_t *p_this )
     CREATE_VAR( p_style->i_font_size, Integer, "marq-size" );
 
     /* Misc init */
-    p_filter->pf_sub_source = Filter;
+    p_filter->ops = &filter_ops;
     p_sys->last_time = 0;
 
     return VLC_SUCCESS;
index bf1c6c8..4a2f6b3 100644 (file)
@@ -271,6 +271,10 @@ static void mosaic_ParseSetOffsets( vlc_object_t *p_this,
 #define mosaic_ParseSetOffsets( a, b, c ) \
             mosaic_ParseSetOffsets( VLC_OBJECT( a ), b, c )
 
+static const struct vlc_filter_operations filter_ops = {
+    .source_sub = Filter,
+};
+
 /*****************************************************************************
  * CreateFiler: allocate mosaic video filter
  *****************************************************************************/
@@ -288,7 +292,7 @@ static int CreateFilter( vlc_object_t *p_this )
     if( p_sys == NULL )
         return VLC_ENOMEM;
 
-    p_filter->pf_sub_source = Filter;
+    p_filter->ops = &filter_ops;
 
     vlc_mutex_init( &p_sys->lock );
     vlc_mutex_lock( &p_sys->lock );
index 95f55e3..08c5ea5 100644 (file)
@@ -240,6 +240,10 @@ static void InitCurrentContext(filter_sys_t *p_sys)
     p_sys->i_cur_char = -1;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .source_sub = Filter,
+};
+
 /*****************************************************************************
  * CreateFilter: allocates RSS video filter
  *****************************************************************************/
@@ -311,7 +315,7 @@ static int CreateFilter( vlc_object_t *p_this )
 
     /* Misc init */
     vlc_mutex_init( &p_sys->lock );
-    p_filter->pf_sub_source = Filter;
+    p_filter->ops = &filter_ops;
     p_sys->last_date = (vlc_tick_t)0;
     p_sys->b_fetched = false;
 
index 70b2e9a..b17a432 100644 (file)
@@ -293,6 +293,10 @@ vlc_module_begin()
 
 static const char * const ppsz_filter_options[] = { "mode", "factor", "overlap", NULL };
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_sub = SubsdelayFilter,
+};
+
 /*****************************************************************************
  * SubsdelayCreate: Create subsdelay filter
  *****************************************************************************/
@@ -336,7 +340,7 @@ static int SubsdelayCreate( vlc_object_t *p_this )
     var_AddCallback( p_filter, CFG_MIN_START_STOP_INTERVAL, SubsdelayCallback, p_sys );
 
     p_filter->p_sys = p_sys;
-    p_filter->pf_sub_filter = SubsdelayFilter;
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg );
 
index 5b5fc2d..fe78056 100644 (file)
@@ -1159,6 +1159,11 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
     return rv;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .render = Render,
+};
+
 /*****************************************************************************
  * Create: allocates osd-text video thread output method
  *****************************************************************************
@@ -1236,7 +1241,7 @@ static int Create( vlc_object_t *p_this )
     if( LoadFontsFromAttachments( p_filter ) == VLC_ENOMEM )
         goto error;
 
-    p_filter->pf_render = Render;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 
index 1b71c77..5e6774f 100644 (file)
@@ -58,6 +58,10 @@ typedef struct filter_sys_t
     NSString *lastString;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops = {
+    .render = RenderText,
+};
+
 static int  Create (vlc_object_t *p_this)
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -70,7 +74,7 @@ static int  Create (vlc_object_t *p_this)
     p_sys->currentLocale = p_sys->lastString = @"";
     p_sys->speechSynthesizer = [[NSSpeechSynthesizer alloc] init];
 
-    p_filter->pf_render = RenderText;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 874f5c8..ad5109e 100644 (file)
@@ -93,6 +93,14 @@ static void LeaveMTA(void)
     CoUninitialize();
 }
 
+static const struct FilterOperationInitializer {
+    struct vlc_filter_operations ops {};
+    FilterOperationInitializer()
+    {
+        ops.render = RenderText;
+    };
+} filter_ops;
+
 static int Create (vlc_object_t *p_this)
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -157,7 +165,7 @@ static int Create (vlc_object_t *p_this)
 
     LeaveMTA();
 
-    p_filter->pf_render = RenderText;
+    p_filter->ops = &filter_ops.ops;
 
     return VLC_SUCCESS;
 
index f97c5fa..5e710d1 100644 (file)
@@ -169,6 +169,10 @@ static char *svg_GetDocument( filter_t *p_filter, int i_width, int i_height, con
     return psz_result;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .render = RenderText,
+};
+
 /*****************************************************************************
  * Create: allocates svg video thread output method
  *****************************************************************************
@@ -184,7 +188,7 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
 
-    p_filter->pf_render = RenderText;
+    p_filter->ops = &filter_ops;
     svg_LoadTemplate( p_filter );
 
 #if (GLIB_MAJOR_VERSION < 2 || GLIB_MINOR_VERSION < 36)
index 3451c10..4fd9966 100644 (file)
@@ -47,9 +47,13 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
     return VLC_EGENERIC;
 }
 
+static const struct vlc_filter_operations filter_ops = {
+    .render = RenderText,
+};
+
 static int OpenRenderer( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    p_filter->pf_render = RenderText;
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
index 7ec2798..c25711c 100644 (file)
@@ -114,6 +114,7 @@ typedef struct
 {
     filter_chain_t *p_chain;
     filter_t *p_video_filter;
+    struct vlc_filter_operations custom_ops;
 } filter_sys_t;
 
 /* Restart filter callback */
@@ -152,6 +153,10 @@ static const struct filter_video_callbacks filter_video_chain_cbs =
     BufferChainNew, HoldChainDecoderDevice,
 };
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Chain,
+};
+
 /*****************************************************************************
  * Activate: allocate a chroma function
  *****************************************************************************
@@ -213,7 +218,7 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
     }
     assert(p_filter->vctx_out == filter_chain_GetVideoCtxOut( p_sys->p_chain ));
     /* */
-    p_filter->pf_video_filter = Chain;
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
@@ -409,8 +414,12 @@ static int BuildFilterChain( filter_t *p_filter )
                 filter_AddProxyCallbacks( p_filter,
                                           p_sys->p_video_filter,
                                           RestartFilterCallback );
-                if (p_sys->p_video_filter->pf_video_mouse != NULL)
-                    p_filter->pf_video_mouse = ChainMouse;
+                if (p_sys->p_video_filter->ops->video_mouse != NULL)
+                {
+                    p_sys->custom_ops = *p_sys->p_video_filter->ops;
+                    p_sys->p_video_filter->ops = &p_sys->custom_ops;
+                    p_sys->custom_ops.video_mouse = ChainMouse;
+                }
                 es_format_Clean( &fmt_mid );
                 i_ret = VLC_SUCCESS;
                 p_filter->vctx_out = filter_chain_GetVideoCtxOut( p_sys->p_chain );
index f3ece81..062b1ef 100644 (file)
@@ -248,6 +248,13 @@ static void Close(vlc_object_t *obj)
     free(p_sys);
 }
 
+static const struct vlc_filter_operations CVPX_TO_SW_ops = {
+    .filter_video = CVPX_TO_SW_Filter,
+};
+static const struct vlc_filter_operations SW_TO_CVPX_ops = {
+    .filter_video = SW_TO_CVPX_Filter,
+};
+
 static int Open(vlc_object_t *obj)
 {
     filter_t *p_filter = (filter_t *)obj;
@@ -261,9 +268,9 @@ static int Open(vlc_object_t *obj)
     case VLC_CODEC_CVPX_##x: \
         sw_fmt = p_filter->fmt_out.video; \
         if (p_filter->fmt_out.video.i_chroma == VLC_CODEC_##x) \
-            p_filter->pf_video_filter = CVPX_TO_SW_Filter; \
+            p_filter->ops = &CVPX_TO_SW_ops; \
         else if (i420_fcc != 0 && p_filter->fmt_out.video.i_chroma == i420_fcc) { \
-            p_filter->pf_video_filter = CVPX_TO_SW_Filter; \
+            p_filter->ops = &CVPX_TO_SW_ops; \
             sw_fmt.i_chroma = VLC_CODEC_##x; \
         } else return VLC_EGENERIC; \
 
@@ -271,10 +278,10 @@ static int Open(vlc_object_t *obj)
     case VLC_CODEC_CVPX_##x: \
         sw_fmt = p_filter->fmt_in.video; \
         if (p_filter->fmt_in.video.i_chroma == VLC_CODEC_##x) { \
-            p_filter->pf_video_filter = SW_TO_CVPX_Filter; \
+            p_filter->ops = &SW_TO_CVPX_ops; \
         } \
         else if (i420_fcc != 0 && p_filter->fmt_in.video.i_chroma == i420_fcc) { \
-            p_filter->pf_video_filter = SW_TO_CVPX_Filter; \
+            p_filter->ops = &SW_TO_CVPX_ops; \
             sw_fmt.i_chroma = VLC_CODEC_##x; \
         } else return VLC_EGENERIC; \
         b_need_pool = true;
@@ -432,6 +439,10 @@ static vlc_fourcc_t const supported_chromas[] = { VLC_CODEC_CVPX_BGRA,
                                                   VLC_CODEC_CVPX_P010,
                                                   VLC_CODEC_CVPX_UYVY };
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Filter,
+};
+
 static int
 Open_CVPX_to_CVPX(vlc_object_t *obj)
 {
@@ -480,7 +491,7 @@ Open_CVPX_to_CVPX(vlc_object_t *obj)
     }
 
     filter->p_sys = p_sys;
-    filter->pf_video_filter = Filter;
+    filter->ops = &filter_ops;
     filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
     filter->fmt_out.i_codec = filter->fmt_out.video.i_chroma;
     return VLC_SUCCESS;
@@ -553,6 +564,10 @@ static const vlc_fourcc_t supported_sw_chromas[] = {
     VLC_CODEC_UYVY, VLC_CODEC_P010,
 };
 
+static const struct vlc_filter_operations chain_CVPX_ops = {
+    .filter_video = chain_CVPX_Filter, .flush = chain_CVPX_Flush,
+};
+
 static int
 Open_chain_CVPX(vlc_object_t *obj)
 {
@@ -656,8 +671,7 @@ Open_chain_CVPX(vlc_object_t *obj)
 
     filter->vctx_out = vctx_out;
     filter->p_sys = chain;
-    filter->pf_flush = chain_CVPX_Flush;
-    filter->pf_video_filter = chain_CVPX_Filter;
+    filter->ops = &chain_CVPX_ops;
 
     /* Display the current conversion chain in the logs. */
     msg_Dbg(filter, "CVPX conversion chain:");
index ea09775..308bd5c 100644 (file)
@@ -56,6 +56,20 @@ vlc_module_end ()
 VIDEO_FILTER_WRAPPER( GREY_I420 )
 VIDEO_FILTER_WRAPPER( GREY_YUY2 )
 
+static const struct vlc_filter_operations *
+GetFilterOperations( filter_t *filter )
+{
+    switch( filter->fmt_out.video.i_chroma )
+    {
+        case VLC_CODEC_I420:
+            return &GREY_I420_ops;
+        case VLC_CODEC_YUYV:
+            return &GREY_YUY2_ops;
+        default:
+            return NULL;
+    }
+}
+
 /*****************************************************************************
  * Activate: allocate a chroma function
  *****************************************************************************
@@ -78,18 +92,9 @@ static int Activate( vlc_object_t *p_this )
 
     if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_GREY )
         return VLC_EGENERIC;
-
-    switch( p_filter->fmt_out.video.i_chroma )
-    {
-        case VLC_CODEC_I420:
-            p_filter->pf_video_filter = GREY_I420_Filter;
-            break;
-        case VLC_CODEC_YUYV:
-            p_filter->pf_video_filter = GREY_YUY2_Filter;
-            break;
-        default:
-            return VLC_EGENERIC;
-    }
+    p_filter->ops = GetFilterOperations(p_filter);
+    if ( p_filter->ops == NULL )
+        return VLC_EGENERIC;
 
     return VLC_SUCCESS;
 }
index 53e1364..fe27022 100644 (file)
@@ -168,23 +168,23 @@ static int Create( vlc_object_t *p_this )
         case VLC_CODEC_J420:
             if( outfcc != VLC_CODEC_NV12 )
                 return -1;
-            p_filter->pf_video_filter = I420_NV12_Filter;
+            p_filter->ops = &I420_NV12_ops;
             break;
 
         case VLC_CODEC_YV12:
             if( outfcc != VLC_CODEC_NV12 )
                 return -1;
-            p_filter->pf_video_filter = YV12_NV12_Filter;
+            p_filter->ops = &YV12_NV12_ops;
             break;
         case VLC_CODEC_NV12:
             switch( outfcc )
             {
                 case VLC_CODEC_I420:
                 case VLC_CODEC_J420:
-                    p_filter->pf_video_filter = NV12_I420_Filter;
+                    p_filter->ops = &NV12_I420_ops;
                     break;
                 case VLC_CODEC_YV12:
-                    p_filter->pf_video_filter = NV12_YV12_Filter;
+                    p_filter->ops = &NV12_YV12_ops;
                     break;
                 default:
                     return -1;
@@ -195,14 +195,14 @@ static int Create( vlc_object_t *p_this )
             if( outfcc != VLC_CODEC_P010 )
                 return -1;
             pixel_bytes = 2;
-            p_filter->pf_video_filter = I42010B_P010_Filter;
+            p_filter->ops = &I42010B_P010_ops;
             break;
 
         case VLC_CODEC_P010:
             if( outfcc != VLC_CODEC_I420_10L )
                 return -1;
             pixel_bytes = 2;
-            p_filter->pf_video_filter = P010_I42010B_Filter;
+            p_filter->ops = &P010_I42010B_ops;
             break;
 
         default:
index fbb8f90..20bb2ea 100644 (file)
@@ -131,7 +131,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R5G5B6 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R5G5B5");
-                        p_filter->pf_video_filter = I420_R5G5B5_Filter;
+                        p_filter->ops = &I420_R5G5B5_ops;
                     }
                     else if( ( p_filter->fmt_out.video.i_rmask == 0xf800
                             && p_filter->fmt_out.video.i_gmask == 0x07e0
@@ -139,7 +139,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R5G6B5 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R5G6B5");
-                        p_filter->pf_video_filter = I420_R5G6B5_Filter;
+                        p_filter->ops = &I420_R5G6B5_ops;
                     }
                     else
                         return VLC_EGENERIC;
@@ -152,7 +152,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* A8R8G8B8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is A8R8G8B8");
-                        p_filter->pf_video_filter = I420_A8R8G8B8_Filter;
+                        p_filter->ops = &I420_A8R8G8B8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0xff000000
                           && p_filter->fmt_out.video.i_gmask == 0x00ff0000
@@ -160,7 +160,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* R8G8B8A8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is R8G8B8A8");
-                        p_filter->pf_video_filter = I420_R8G8B8A8_Filter;
+                        p_filter->ops = &I420_R8G8B8A8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x0000ff00
                           && p_filter->fmt_out.video.i_gmask == 0x00ff0000
@@ -168,7 +168,7 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* B8G8R8A8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is B8G8R8A8");
-                        p_filter->pf_video_filter = I420_B8G8R8A8_Filter;
+                        p_filter->ops = &I420_B8G8R8A8_ops;
                     }
                     else if( p_filter->fmt_out.video.i_rmask == 0x000000ff
                           && p_filter->fmt_out.video.i_gmask == 0x0000ff00
@@ -176,21 +176,21 @@ static int Activate( vlc_object_t *p_this )
                     {
                         /* A8B8G8R8 pixel format */
                         msg_Dbg(p_this, "RGB pixel format is A8B8G8R8");
-                        p_filter->pf_video_filter = I420_A8B8G8R8_Filter;
+                        p_filter->ops = &I420_A8B8G8R8_ops;
                     }
                     else
                         return VLC_EGENERIC;
                     break;
 #else
                 case VLC_CODEC_RGB8:
-                    p_filter->pf_video_filter = I420_RGB8_Filter;
+                    p_filter->ops = &I420_RGB8_ops;
                     break;
                 case VLC_CODEC_RGB15:
                 case VLC_CODEC_RGB16:
-                    p_filter->pf_video_filter = I420_RGB16_Filter;
+                    p_filter->ops = &I420_RGB16_ops;
                     break;
                 case VLC_CODEC_RGB32:
-                    p_filter->pf_video_filter = I420_RGB32_Filter;
+                    p_filter->ops = &I420_RGB32_ops;
                     break;
 #endif
                 default:
index b18fea3..fb7a787 100644 (file)
@@ -107,6 +107,34 @@ VIDEO_FILTER_WRAPPER( I420_IUYV )
 VIDEO_FILTER_WRAPPER( I420_Y211 )
 #endif
 
+static const struct vlc_filter_operations *
+GetFilterOperations( filter_t *p_filter )
+{
+    switch( p_filter->fmt_out.video.i_chroma )
+    {
+        case VLC_CODEC_YUYV:
+            return &I420_YUY2_ops;
+
+        case VLC_CODEC_YVYU:
+            return &I420_YVYU_ops;
+
+        case VLC_CODEC_UYVY:
+            return &I420_UYVY_ops;
+
+#if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
+        case VLC_FOURCC('I','U','Y','V'):
+            return &I420_IUYV_ops;
+#endif
+
+#if defined (MODULE_NAME_IS_i420_yuy2)
+        case VLC_CODEC_Y211:
+            return &I420_Y211_ops;
+#endif
+        default:
+            return NULL;
+    }
+}
+
 /*****************************************************************************
  * Activate: allocate a chroma function
  *****************************************************************************
@@ -134,33 +162,10 @@ static int Activate( vlc_object_t *p_this )
     if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I420)
         return VLC_EGENERIC;
 
-    switch( p_filter->fmt_out.video.i_chroma )
-    {
-        case VLC_CODEC_YUYV:
-            p_filter->pf_video_filter = I420_YUY2_Filter;
-            break;
-
-        case VLC_CODEC_YVYU:
-            p_filter->pf_video_filter = I420_YVYU_Filter;
-            break;
-
-        case VLC_CODEC_UYVY:
-            p_filter->pf_video_filter = I420_UYVY_Filter;
-            break;
-#if !defined (MODULE_NAME_IS_i420_yuy2_altivec)
-        case VLC_FOURCC('I','U','Y','V'):
-            p_filter->pf_video_filter = I420_IUYV_Filter;
-            break;
-#endif
-
-#if defined (MODULE_NAME_IS_i420_yuy2)
-        case VLC_CODEC_Y211:
-            p_filter->pf_video_filter = I420_Y211_Filter;
-            break;
-#endif
-        default:
-            return VLC_EGENERIC;
-    }
+    /* Find the adequate filter function depending on the output format. */
+    p_filter->ops = GetFilterOperations( p_filter );
+    if( p_filter->ops == NULL )
+        return VLC_EGENERIC;
 
     return VLC_SUCCESS;
 }
index 5ac6918..72315a8 100644 (file)
@@ -87,15 +87,15 @@ static int Activate( vlc_object_t *p_this )
             {
                 case VLC_CODEC_I420:
                 case VLC_CODEC_J420:
-                    p_filter->pf_video_filter = I422_I420_Filter;
+                    p_filter->ops = &I422_I420_ops;
                     break;
 
                 case VLC_CODEC_YV12:
-                    p_filter->pf_video_filter = I422_YV12_Filter;
+                    p_filter->ops = &I422_YV12_ops;
                     break;
 
                 case VLC_CODEC_YUV420A:
-                    p_filter->pf_video_filter = I422_YUVA_Filter;
+                    p_filter->ops = &I422_YUVA_ops;
                     break;
 
                 default:
index 416dbff..eb29dc9 100644 (file)
@@ -89,6 +89,35 @@ VIDEO_FILTER_WRAPPER( I422_IUYV )
 VIDEO_FILTER_WRAPPER( I422_Y211 )
 #endif
 
+
+static const struct vlc_filter_operations*
+GetFilterOperations(filter_t *filter)
+{
+    switch( filter->fmt_out.video.i_chroma )
+    {
+        case VLC_CODEC_YUYV:
+            return &I422_YUY2_ops;
+
+        case VLC_CODEC_YVYU:
+            return &I422_YVYU_ops;
+
+        case VLC_CODEC_UYVY:
+            return &I422_UYVY_ops;
+
+        case VLC_FOURCC('I','U','Y','V'):
+            return &I422_IUYV_ops;
+
+#if defined (MODULE_NAME_IS_i422_yuy2)
+        case VLC_CODEC_Y211:
+            return &I422_Y211_ops;
+#endif
+
+        default:
+            return NULL;
+    }
+
+}
+
 /*****************************************************************************
  * Activate: allocate a chroma function
  *****************************************************************************
@@ -111,42 +140,16 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    switch( p_filter->fmt_in.video.i_chroma )
-    {
-        case VLC_CODEC_I422:
-            switch( p_filter->fmt_out.video.i_chroma )
-            {
-                case VLC_CODEC_YUYV:
-                    p_filter->pf_video_filter = I422_YUY2_Filter;
-                    break;
-
-                case VLC_CODEC_YVYU:
-                    p_filter->pf_video_filter = I422_YVYU_Filter;
-                    break;
-
-                case VLC_CODEC_UYVY:
-                    p_filter->pf_video_filter = I422_UYVY_Filter;
-                    break;
+    /* This is a i422 -> * converter. */
+    if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_I422 )
+        return VLC_EGENERIC;
 
-                case VLC_FOURCC('I','U','Y','V'):
-                    p_filter->pf_video_filter = I422_IUYV_Filter;
-                    break;
 
-#if defined (MODULE_NAME_IS_i422_yuy2)
-                case VLC_CODEC_Y211:
-                    p_filter->pf_video_filter = I422_Y211_Filter;
-                    break;
-#endif
-
-                default:
-                    return -1;
-            }
-            break;
+    p_filter->ops = GetFilterOperations( p_filter );
+    if( p_filter->ops == NULL)
+        return VLC_EGENERIC;
 
-        default:
-            return -1;
-    }
-    return 0;
+    return VLC_SUCCESS;
 }
 
 /* Following functions are local */
index 292fe95..e643f07 100644 (file)
@@ -265,7 +265,7 @@ static int Open (vlc_object_t *obj)
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = I420_RV16_Filter;
+                    filter->ops = &I420_RV16_ops;
                     return VLC_SUCCESS;
             }
             break;
@@ -276,7 +276,7 @@ static int Open (vlc_object_t *obj)
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = YV12_RV16_Filter;
+                    filter->ops = &YV12_RV16_ops;
                     return VLC_SUCCESS;
             }
             break;
@@ -285,10 +285,10 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = I422_I420_Filter;
+                    filter->ops = &I422_I420_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = I422_YV12_Filter;
+                    filter->ops = &I422_YV12_ops;
                     return VLC_SUCCESS;
             }
             break;
@@ -299,7 +299,7 @@ static int Open (vlc_object_t *obj)
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = I444_RV16_Filter;
+                    filter->ops = &I444_RV16_ops;
                     return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -310,12 +310,12 @@ static int Open (vlc_object_t *obj)
                 case VLC_CODEC_RGB24:
                     if (FixRV24 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = YUYV_RV24_Filter;
+                    filter->ops = &YUYV_RV24_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = YUYV_RV16_Filter;
+                    filter->ops = &YUYV_RV16_ops;
                     return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -324,10 +324,10 @@ static int Open (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = UYVY_I420_Filter;
+                    filter->ops = &UYVY_I420_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = UYVY_YV12_Filter;
+                    filter->ops = &UYVY_YV12_ops;
                     return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -484,33 +484,33 @@ static int OpenScaler (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = I420_I420_Scale_Filter;
+                    filter->ops = &I420_I420_Scale_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = I420_YV12_Scale_Filter;
+                    filter->ops = &I420_YV12_Scale_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         return VLC_EGENERIC;
-                    filter->pf_video_filter = I420_RGB_Scale_Filter;
+                    filter->ops = &I420_RGB_Scale_ops;
                     *conv = OMX_IP_BGR565;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB15:
                     if (FixRV15 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I420_RGB_Scale_Filter;
+                    filter->ops = &I420_RGB_Scale_ops;
                     *conv = OMX_IP_BGR555;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB12:
                     if (FixRV12 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I420_RGB_Scale_Filter;
+                    filter->ops = &I420_RGB_Scale_ops;
                     *conv = OMX_IP_BGR444;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB24:
                     if (FixRV24 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I420_RGB_Scale_Filter;
+                    filter->ops = &I420_RGB_Scale_ops;
                     *conv = OMX_IP_BGR888;
                     return VLC_SUCCESS;
             }
@@ -520,33 +520,33 @@ static int OpenScaler (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I420:
-                    filter->pf_video_filter = YV12_I420_Scale_Filter;
+                    filter->ops = &YV12_I420_Scale_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_YV12:
-                    filter->pf_video_filter = YV12_YV12_Scale_Filter;
+                    filter->ops = &YV12_YV12_Scale_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = YV12_RGB_Scale_Filter;
+                    filter->ops = &YV12_RGB_Scale_ops;
                     *conv = OMX_IP_BGR565;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB15:
                     if (FixRV15 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = YV12_RGB_Scale_Filter;
+                    filter->ops = &YV12_RGB_Scale_ops;
                     *conv = OMX_IP_BGR555;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB12:
                     if (FixRV12 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = YV12_RGB_Scale_Filter;
+                    filter->ops = &YV12_RGB_Scale_ops;
                     *conv = OMX_IP_BGR444;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB24:
                     if (FixRV24 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = YV12_RGB_Scale_Filter;
+                    filter->ops = &YV12_RGB_Scale_ops;
                     *conv = OMX_IP_BGR888;
                     return VLC_SUCCESS;
             }
@@ -556,30 +556,30 @@ static int OpenScaler (vlc_object_t *obj)
             switch (filter->fmt_out.video.i_chroma)
             {
                 case VLC_CODEC_I422:
-                    filter->pf_video_filter = I422_I422_Scale_Filter;
+                    filter->ops = &I422_I422_Scale_ops;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB16:
                     if (FixRV16 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I422_RGB_Scale_Filter;
+                    filter->ops = &I422_RGB_Scale_ops;
                     *conv = OMX_IP_BGR565;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB15:
                     if (FixRV15 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I422_RGB_Scale_Filter;
+                    filter->ops = &I422_RGB_Scale_ops;
                     *conv = OMX_IP_BGR555;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB12:
                     if (FixRV12 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I422_RGB_Scale_Filter;
+                    filter->ops = &I422_RGB_Scale_ops;
                     *conv = OMX_IP_BGR444;
                     return VLC_SUCCESS;
                 case VLC_CODEC_RGB24:
                     if (FixRV24 (&filter->fmt_out.video))
                         break;
-                    filter->pf_video_filter = I422_RGB_Scale_Filter;
+                    filter->ops = &I422_RGB_Scale_ops;
                     *conv = OMX_IP_BGR888;
                     return VLC_SUCCESS;
             }
index 9546872..835b658 100644 (file)
@@ -47,6 +47,10 @@ vlc_module_begin ()
     set_callback( OpenFilter )
 vlc_module_end ()
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * OpenFilter: probe the filter and return score
  *****************************************************************************/
@@ -67,7 +71,7 @@ static int OpenFilter( vlc_object_t *p_this )
      || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation)
         return -1;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 3c7bdf7..8d5106f 100644 (file)
@@ -139,6 +139,10 @@ static int GetSwsCpuMask(void);
 /* XXX is it always 3 even for BIG_ENDIAN (blend.c seems to think so) ? */
 #define OFFSET_A (3)
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * OpenScaler: probe the filter and return score
  *****************************************************************************/
@@ -192,7 +196,7 @@ static int OpenScaler( vlc_object_t *p_this )
     }
 
     /* */
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_filter, "%ix%i (%ix%i) chroma: %4.4s -> %ix%i (%ix%i) chroma: %4.4s with scaling using %s",
              p_filter->fmt_in.video.i_visible_width, p_filter->fmt_in.video.i_visible_height,
index a561d94..b48ead6 100644 (file)
@@ -77,7 +77,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_filter->pf_video_filter = Convert_Filter;
+    p_filter->ops = &Convert_ops;
 
     msg_Dbg( p_filter, "YUVP to %4.4s converter",
              (const char*)&p_filter->fmt_out.video.i_chroma );
index cfcb2c3..fa0c3cf 100644 (file)
@@ -84,15 +84,15 @@ static int Activate( vlc_object_t *p_this )
             switch( p_filter->fmt_in.video.i_chroma )
             {
                 case VLC_CODEC_YUYV:
-                    p_filter->pf_video_filter = YUY2_I420_Filter;
+                    p_filter->ops = &YUY2_I420_ops;
                     break;
 
                 case VLC_CODEC_YVYU:
-                    p_filter->pf_video_filter = YVYU_I420_Filter;
+                    p_filter->ops = &YVYU_I420_ops;
                     break;
 
                 case VLC_CODEC_UYVY:
-                    p_filter->pf_video_filter = UYVY_I420_Filter;
+                    p_filter->ops = &UYVY_I420_ops;
                     break;
 
                 default:
index f8aa0b9..b35c62f 100644 (file)
@@ -84,15 +84,15 @@ static int Activate( vlc_object_t *p_this )
             switch( p_filter->fmt_in.video.i_chroma )
             {
                 case VLC_CODEC_YUYV:
-                    p_filter->pf_video_filter = YUY2_I422_Filter;
+                    p_filter->ops = &YUY2_I422_ops;
                     break;
 
                 case VLC_CODEC_YVYU:
-                    p_filter->pf_video_filter = YVYU_I422_Filter;
+                    p_filter->ops = &YVYU_I422_ops;
                     break;
 
                 case VLC_CODEC_UYVY:
-                    p_filter->pf_video_filter = UYVY_I422_Filter;
+                    p_filter->ops = &UYVY_I422_ops;
                     break;
 
                 default:
index 063af77..85cf2bb 100644 (file)
@@ -141,6 +141,16 @@ static int BoolCallback( vlc_object_t *obj, char const *varname,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations planar_filter_ops =
+{
+    .filter_video = FilterPlanar,
+};
+
+static const struct vlc_filter_operations packed_filter_ops =
+{
+    .filter_video = FilterPacked,
+};
+
 /*****************************************************************************
  * Create: allocates adjust video filter
  *****************************************************************************/
@@ -166,7 +176,7 @@ static int Create( vlc_object_t *p_this )
     {
         CASE_PLANAR_YUV
             /* Planar YUV */
-            p_filter->pf_video_filter = FilterPlanar;
+            p_filter->ops = &planar_filter_ops;
             p_sys->pf_process_sat_hue_clip = planar_sat_hue_clip_C;
             p_sys->pf_process_sat_hue = planar_sat_hue_C;
             break;
@@ -174,14 +184,14 @@ static int Create( vlc_object_t *p_this )
         CASE_PLANAR_YUV10
         CASE_PLANAR_YUV9
             /* Planar YUV 9-bit or 10-bit */
-            p_filter->pf_video_filter = FilterPlanar;
+            p_filter->ops = &planar_filter_ops;
             p_sys->pf_process_sat_hue_clip = planar_sat_hue_clip_C_16;
             p_sys->pf_process_sat_hue = planar_sat_hue_C_16;
             break;
 
         CASE_PACKED_YUV_422
             /* Packed YUV 4:2:2 */
-            p_filter->pf_video_filter = FilterPacked;
+            p_filter->ops = &packed_filter_ops;
             p_sys->pf_process_sat_hue_clip = packed_sat_hue_clip_C;
             p_sys->pf_process_sat_hue = packed_sat_hue_C;
             break;
index 001f371..9b894f9 100644 (file)
@@ -82,6 +82,11 @@ typedef struct
     vlc_mutex_t mask_lock;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -122,7 +127,7 @@ static int Create( vlc_object_t *p_this )
     vlc_mutex_init( &p_sys->mask_lock );
     var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback,
                      p_filter );
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index b17bf7a..0f1b166 100644 (file)
@@ -86,6 +86,11 @@ typedef struct
     int left, right;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = &Filter,
+};
+
 
 static int Create(vlc_object_t *p_this)
 {
@@ -156,7 +161,7 @@ static int Create(vlc_object_t *p_this)
             break;
     }
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
@@ -301,4 +306,3 @@ static void combine_side_by_side_yuv420(picture_t *p_inpic, picture_t *p_outpic,
         vout += p_outpic->p[V_PLANE].i_pitch - uv_visible_pitch;
     }
 }
-
index 568a84a..4f360ee 100644 (file)
@@ -94,6 +94,11 @@ typedef struct
     uint8_t *p_old_data;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Create: allocates Distort video thread output method
  *****************************************************************************
@@ -121,7 +126,7 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     /* Initialize the arguments */
     atomic_init( &p_sys->i_window_size,
index 563ff8b..1508683 100644 (file)
@@ -215,6 +215,10 @@ struct filter_sys_t
     } colorList[4];
 };
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
 
 /*****************************************************************************
 * Create: allocates Distort video thread output method
@@ -261,7 +265,7 @@ static int Create( vlc_object_t *p_this )
     if( p_sys->p_image == NULL )
         return VLC_EGENERIC;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
index b33aa08..faf49cf 100644 (file)
@@ -649,7 +649,7 @@ struct filter_sys_t {
 /**
  * It blends 2 picture together.
  */
-static void Blend(filter_t *filter,
+static void DoBlend(filter_t *filter,
                   picture_t *dst, const picture_t *src,
                   int x_offset, int y_offset, int alpha)
 {
@@ -680,6 +680,14 @@ static void Blend(filter_t *filter,
                width, height, alpha);
 }
 
+static const struct FilterOperationInitializer {
+    struct vlc_filter_operations ops {};
+    FilterOperationInitializer()
+    {
+        ops.blend_video = DoBlend;
+    };
+} filter_ops;
+
 static int Open(vlc_object_t *object)
 {
     filter_t *filter = (filter_t *)object;
@@ -699,7 +707,7 @@ static int Open(vlc_object_t *object)
         return VLC_EGENERIC;
     }
 
-    filter->pf_video_blend = Blend;
+    filter->ops = &filter_ops.ops;
     filter->p_sys          = sys;
     return VLC_SUCCESS;
 }
@@ -710,4 +718,3 @@ static void Close(vlc_object_t *object)
     filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( filter->p_sys );
     delete p_sys;
 }
-
index f288638..0a6c17a 100644 (file)
@@ -144,6 +144,11 @@ static int blendbench_LoadImage( vlc_object_t *p_this, picture_t **pp_pic,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Create: allocates video thread output method
  *****************************************************************************/
@@ -162,7 +167,7 @@ static int Create( vlc_object_t *p_this )
     p_sys = p_filter->p_sys;
     p_sys->b_done = false;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     /* needed to get options passed in transcode using the
      * adjust{name=value} syntax */
@@ -252,9 +257,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     vlc_tick_t time = vlc_tick_now();
     for( int i_iter = 0; i_iter < p_sys->i_loops; ++i_iter )
     {
-        p_blend->pf_video_blend( p_blend,
-                                 p_sys->p_base_image, p_sys->p_blend_image,
-                                 0, 0, p_sys->i_alpha );
+        filter_Blend( p_blend, p_sys->p_base_image, p_sys->p_blend_image,
+                      0, 0, p_sys->i_alpha );
     }
     time = vlc_tick_now() - time;
 
index 3fe83a1..d624ddf 100644 (file)
@@ -106,6 +106,11 @@ typedef struct
     uint8_t *p_at;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -143,7 +148,7 @@ static int Create( vlc_object_t *p_this )
     p_sys->p_at = NULL;
 #undef GET_VAR
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 80010ee..580948f 100644 (file)
@@ -144,6 +144,11 @@ static const struct filter_video_callbacks canvas_cbs =
     video_chain_new, NULL,
 };
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -373,7 +378,7 @@ static int Activate( vlc_object_t *p_this )
                   i_canvas_width, i_canvas_height );
     }
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 154fc44..4bc46be 100644 (file)
@@ -376,7 +376,8 @@ Filter(filter_t *filter, picture_t *src)
 
     if (ctx->src_converter)
     {
-        src = ctx->dst_converter->pf_video_filter(ctx->src_converter, src);
+        // TODO
+        src = ctx->dst_converter->ops->filter_video(ctx->src_converter, src);
         if (!src)
             return NULL;
     }
@@ -416,7 +417,7 @@ Filter(filter_t *filter, picture_t *src)
 
     if (ctx->dst_converter)
     {
-        dst = ctx->dst_converter->pf_video_filter(ctx->dst_converter, dst);
+        dst = ctx->dst_converter->ops->filter_video(ctx->dst_converter, dst);
         if (!dst)
             return NULL;
     }
@@ -568,6 +569,12 @@ CVPX_to_CVPX_converter_Create(filter_t *filter, bool to_rgba)
     return converter;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+    .video_mouse = Mouse,
+};
+
 static int
 Open(vlc_object_t *obj, char const *psz_filter)
 {
@@ -677,8 +684,7 @@ Open(vlc_object_t *obj, char const *psz_filter)
     p_sys->psz_filter = psz_filter;
     p_sys->ctx = ctx;
 
-    filter->pf_video_filter = Filter;
-    filter->pf_video_mouse = Mouse;
+    filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 
index 3011b94..5f7e483 100644 (file)
@@ -102,6 +102,16 @@ typedef struct
     atomic_int i_color;
 } filter_sys_t;
 
+static const struct vlc_filter_operations planar_filter_ops =
+{
+    .filter_video = Filter,
+};
+
+static const struct vlc_filter_operations packed_filter_ops =
+{
+    .filter_video = FilterPacked,
+};
+
 /*****************************************************************************
  * Create: allocates adjust video thread output method
  *****************************************************************************
@@ -115,11 +125,11 @@ static int Create( vlc_object_t *p_this )
     switch( p_filter->fmt_in.video.i_chroma )
     {
         CASE_PLANAR_YUV
-            p_filter->pf_video_filter = Filter;
+            p_filter->ops = &planar_filter_ops;
             break;
 
         CASE_PACKED_YUV_422
-            p_filter->pf_video_filter = FilterPacked;
+            p_filter->ops = &packed_filter_ops;
             break;
 
         default:
index 1d2f27f..4471e85 100644 (file)
@@ -122,6 +122,11 @@ typedef struct
     int i_paddright;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * OpenFilter: probe the filter and return score
  *****************************************************************************/
@@ -185,7 +190,7 @@ static int OpenFilter( vlc_object_t *p_this )
         - p_sys->i_cropleft - p_sys->i_cropright
         + p_sys->i_paddleft + p_sys->i_paddright;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_filter, "Crop: Top: %d, Bottom: %d, Left: %d, Right: %d",
              p_sys->i_croptop, p_sys->i_cropbottom, p_sys->i_cropleft,
index 1676a07..714066c 100644 (file)
@@ -53,7 +53,7 @@
 /**
  * Top-level filtering method.
  *
- * Open() sets this up as the processing method (pf_video_filter)
+ * Open() sets this up as the processing method (filter_video)
  * in the filter structure.
  *
  * Note that there is no guarantee that the returned picture directly
@@ -480,6 +480,12 @@ int Mouse( filter_t *p_filter,
 }
 
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_video = Deinterlace,
+    .flush = Flush,
+    .video_mouse = Mouse,
+};
+
 /*****************************************************************************
  * Open
  *****************************************************************************/
@@ -643,9 +649,7 @@ notsupp:
     }
     p_filter->fmt_out.video = fmt;
     p_filter->fmt_out.i_codec = fmt.i_chroma;
-    p_filter->pf_video_filter = Deinterlace;
-    p_filter->pf_flush = Flush;
-    p_filter->pf_video_mouse  = Mouse;
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_filter, "deinterlacing" );
 
index 9351891..d425473 100644 (file)
@@ -82,6 +82,11 @@ static const struct filter_video_callbacks filter_video_edge_cbs =
     new_frame, NULL,
 };
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Opens the filter.
  * Allocates and initializes data needed by the filter. The image needs to
@@ -123,7 +128,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
     /* Set callback function */
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
     p_filter->p_sys = sys;
     return VLC_SUCCESS;
 }
index 7e6683b..0ec8df7 100644 (file)
@@ -122,6 +122,11 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
     image_HandlerDelete( p_image );
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Create
  *****************************************************************************/
@@ -153,7 +158,7 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_sys = p_filter->p_sys;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
index 0e84964..ca57087 100644 (file)
@@ -89,6 +89,11 @@ typedef struct
     uint32_t i_color;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Create
  *****************************************************************************/
@@ -142,7 +147,7 @@ static int Create( vlc_object_t *p_this )
     var_AddCallback( p_filter, FILTER_PREFIX "component",
                      ExtractCallback, p_sys );
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 49b0d3b..312e0eb 100644 (file)
@@ -132,6 +132,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
     return chain.front;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Open( vlc_object_t *p_this)
 {
     filter_t *p_filter = (filter_t*)p_this;
@@ -181,7 +186,7 @@ static int Open( vlc_object_t *p_this)
 
     p_sys->p_previous_pic = NULL;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     /* We don't change neither the format nor the picture */
     if ( p_filter->vctx_in )
index be5fde8..719a762 100644 (file)
@@ -88,6 +88,12 @@ vlc_module_end()
  * Local prototypes
  *****************************************************************************/
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+    .video_mouse = freeze_mouse,
+};
+
 /**
  * Open the filter
  */
@@ -121,8 +127,7 @@ static int Open( vlc_object_t *p_this )
 
     /* init data */
 
-    p_filter->pf_video_filter = Filter;
-    p_filter->pf_video_mouse  = freeze_mouse;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 3a97dbc..ea0aa41 100644 (file)
@@ -123,6 +123,11 @@ static void gaussianblur_InitDistribution( filter_sys_t *p_sys )
     p_sys->pt_distribution = pt_distribution;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
@@ -155,7 +160,7 @@ static int Create( vlc_object_t *p_this )
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     p_sys->f_sigma =
         var_CreateGetFloat( p_filter, FILTER_PREFIX "sigma" );
index 093d207..01f0042 100644 (file)
@@ -110,6 +110,11 @@ typedef struct
     struct vf_priv_s cfg;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Open(vlc_object_t *object)
 {
     filter_t *filter = (filter_t *)object;
@@ -156,8 +161,8 @@ static int Open(vlc_object_t *object)
 #endif
         cfg->filter_line = filter_line_c;
 
-    filter->p_sys           = sys;
-    filter->pf_video_filter = Filter;
+    filter->p_sys = sys;
+    filter->ops   = &filter_ops;
     return VLC_SUCCESS;
 }
 
@@ -236,4 +241,3 @@ static int Callback(vlc_object_t *object, char const *cmd,
 
     return VLC_SUCCESS;
 }
-
index 2267530..b7c599d 100644 (file)
@@ -124,6 +124,11 @@ typedef struct
     int *p_pre_hough;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 /*****************************************************************************
  * Create: allocates Distort video thread output method
  *****************************************************************************
@@ -151,7 +156,7 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
 
-    p_filter->pf_video_filter = Filter;
+    p_filter->ops = &filter_ops;
 
     p_sys->p_pre_hough = NULL;
 
index 174de0a..b63f836 100644 (file)
@@ -378,6 +378,11 @@ static int Callback(vlc_object_t *object, char const *cmd,
     return VLC_SUCCESS;
 }
 
+static const struct vlc_filter_operations filter_ops =
+{
+    .filter_video = Filter,
+};
+
 static int Open(vlc_object_t *object)
 {
     filter_t *filter = (filter_t *)object;
@@ -419,8 +424,8 @@ static int Open(vlc_object_t *object)
     sys->cfg.variance = var_CreateGetFloatCommand(filter, CFG_PREFIX "variance");
     var_AddCallback(filter, CFG_PREFIX "variance", Callback, NULL);
 
-    filter->p_sys           = sys;
-    filter->pf_video_filter = Filter;
+    filter->p_sys = sys;
+    filter->ops   = &filter_ops;
     return VLC_SUCCESS;
 }
 
@@ -432,4 +437,3 @@ static void Close(vlc_object_t *object)
     var_DelCallback(filter, CFG_PREFIX "variance", Callback, NULL);
     free(sys);
 }
-
index beb5797..0dcbca7 100644 (file)
@@ -154,8 +154,13 @@ static int Open(vlc_object_t *this)
     sys->luma_temp = var_CreateGetFloatCommand(filter, FILTER_PREFIX "luma-temp");
     sys->chroma_temp = var_CreateGetFloatCommand(filter, FILTER_PREFIX "chroma-temp");
 
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+
     filter->p_sys = sys;
-    filter->pf_video_filter = Filter;
+    filter->ops = &filter_ops;
 
     var_AddCallback( filter, FILTER_PREFIX "luma-spat", DenoiseCallback, sys );
     var_AddCallback( filter, FILTER_PREFIX "chroma-spat", DenoiseCallback, sys );
index 67f9697..632635c 100644 (file)
@@ -76,7 +76,11 @@ static int Create( vlc_object_t *p_this )
      || p_chroma->pixel_size * 8 != p_chroma->pixel_bits )
         return VLC_EGENERIC;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index e5582bb..b5d2fe0 100644 (file)
@@ -129,8 +129,12 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_hide_timeout = VLC_TICK_FROM_MS( var_InheritInteger( p_filter, "mouse-hide-timeout" ) );
 
     /* */
-    p_filter->pf_video_filter = Filter;
-    p_filter->pf_video_mouse = Mouse;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+        .video_mouse = Mouse,
+    };
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
@@ -419,4 +423,3 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_new, const vlc_mouse_t *p_o
     p_new->i_y = p_sys->i_y + p_new->i_y * ZOOM_FACTOR / p_sys->i_zoom;
     return VLC_SUCCESS;
 }
-
index ab8f9dc..57a1dea 100644 (file)
@@ -155,7 +155,11 @@ static int Create( vlc_object_t *p_this )
     var_AddCallback( p_filter, CFG_PREFIX "split", FilterCallback, p_sys );
     var_AddCallback( p_filter, CFG_PREFIX "direction", FilterCallback, p_sys );
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 4bd5045..b536c0a 100644 (file)
@@ -113,7 +113,11 @@ static int Create( vlc_object_t *p_this )
     }
     p_sys->b_first = true;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
index 9906132..4787f55 100644 (file)
@@ -106,7 +106,11 @@ static int Create( vlc_object_t *p_this )
                      (char*)&(p_fmt->i_chroma) );
             return VLC_EGENERIC;
     }
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     /* Allocate structure */
     p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
index 11bb879..dd2a701 100644 (file)
@@ -216,7 +216,11 @@ static int Open( vlc_object_t *p_this ) {
         return VLC_ENOMEM;
 
     /* init data */
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
     p_sys->i_start_time = p_sys->i_cur_time = p_sys->i_last_time = vlc_tick_now();
 
     return VLC_SUCCESS;
index 1334cd4..ed4e8cb 100644 (file)
@@ -108,7 +108,14 @@ static int OpenFilter( vlc_object_t *p_this )
     p_sys->event_info.p_region = NULL;
     p_sys->i_id = 0;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct FilterOperationInitializer {
+        struct vlc_filter_operations ops {};
+        FilterOperationInitializer()
+        {
+            ops.filter_video = Filter;
+        };
+    } filter_ops;
+    p_filter->ops = &filter_ops.ops;
 
     //create the VIDEO_FILTER_EVENT_VARIABLE
     vlc_value_t val;
@@ -157,7 +164,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     CvPoint pt1, pt2;
     int scale = 1;
     filter_sys_t *p_sys = static_cast<filter_sys_t *>(p_filter->p_sys);
+
     if ((!p_pic) )
     {
         msg_Err( p_filter, "no image array" );
@@ -217,4 +224,3 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     return p_pic;
 }
-
index 2ce6959..d103cc7 100644 (file)
@@ -249,8 +249,12 @@ static int Create( vlc_object_t *p_this )
     msg_Dbg( p_filter, "opencv_wrapper successfully started" );
 #endif
 
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
     p_filter->p_sys = p_sys;
-    p_filter->pf_video_filter = Filter;
 
     return VLC_SUCCESS;
 }
@@ -414,7 +418,7 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
     VlcPictureToIplImage( p_filter, p_pic );
     // Pass the image (as a pointer to the first IplImage*) to the
     // internal OpenCV filter for processing.
-    p_sys->p_opencv->pf_video_filter( p_sys->p_opencv, (picture_t*)&(p_sys->p_cv_image[0]) );
+    p_sys->p_opencv->ops->filter_video( p_sys->p_opencv, (picture_t*)&(p_sys->p_cv_image[0]) );
 
     if(p_sys->i_wrapper_output == PROCESSED) {
         // Processed video
@@ -459,4 +463,3 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
         return NULL;
     }
 }
-
index 91762a8..99d69ca 100644 (file)
@@ -134,7 +134,11 @@ static int Create( vlc_object_t *p_this )
 
     var_AddCallback( p_filter, CFG_PREFIX "level", FilterCallback, p_sys );
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index bf0192d..24fa4bc 100644 (file)
@@ -252,7 +252,11 @@ static int OpenPostproc( vlc_object_t *p_this )
     var_AddCallback( p_filter, FILTER_PREFIX "q", PPQCallback, NULL );
     var_AddCallback( p_filter, FILTER_PREFIX "name", PPNameCallback, NULL );
 
-    p_filter->pf_video_filter = PostprocPict;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = PostprocPict,
+    };
+    p_filter->ops = &filter_ops;
 
     msg_Warn( p_filter, "Quantification table was not set by video decoder. "
                         "Postprocessing won't look good." );
index 94c5764..5295ffc 100644 (file)
@@ -96,7 +96,11 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     p_sys->x = 10;
     p_sys->y = 10;
index bef3936..80b5775 100644 (file)
@@ -202,8 +202,12 @@ static int Open( vlc_object_t *p_this )
     var_AddCallback( p_filter, CFG_PREFIX "rotation",     puzzle_Callback, p_sys );
     var_AddCallback( p_filter, CFG_PREFIX "mode",     puzzle_Callback, p_sys );
 
-    p_filter->pf_video_filter = Filter;
-    p_filter->pf_video_mouse = puzzle_mouse;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+        .video_mouse = puzzle_mouse,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index a190c35..c674899 100644 (file)
@@ -90,7 +90,12 @@ static int Create( vlc_object_t *p_this )
     if( p_sys == NULL )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
-    p_filter->pf_video_filter = Filter;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     p_sys->f_angle = 0.0;
     p_sys->last_date = 0;
index 005ba96..48b9d92 100644 (file)
@@ -118,6 +118,16 @@ static void fetch_trigo( filter_sys_t *sys, int *i_sin, int *i_cos )
     *i_cos = sincos.cos;
 }
 
+static const struct vlc_filter_operations planar_filter_ops =
+{
+    .filter_video = Filter,
+};
+
+static const struct vlc_filter_operations packed_filter_ops =
+{
+    .filter_video = FilterPacked,
+};
+
 /*****************************************************************************
  * Create: allocates Distort video filter
  *****************************************************************************/
@@ -135,11 +145,11 @@ static int Create( vlc_object_t *p_this )
     switch( p_filter->fmt_in.video.i_chroma )
     {
         CASE_PLANAR_YUV
-            p_filter->pf_video_filter = Filter;
+            p_filter->ops = &planar_filter_ops;
             break;
 
         CASE_PACKED_YUV_422
-            p_filter->pf_video_filter = FilterPacked;
+            p_filter->ops = &packed_filter_ops;
             break;
 
         default:
index ef5189e..648be69 100644 (file)
@@ -74,7 +74,12 @@ static int OpenFilter( vlc_object_t *p_this )
 
 #warning Converter cannot (really) change output format.
     video_format_ScaleCropAr( &p_filter->fmt_out.video, &p_filter->fmt_in.video );
-    p_filter->pf_video_filter = Filter;
+
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     msg_Dbg( p_filter, "%ix%i -> %ix%i", p_filter->fmt_in.video.i_width,
              p_filter->fmt_in.video.i_height, p_filter->fmt_out.video.i_width,
index 48ca076..f655cb4 100644 (file)
@@ -148,7 +148,7 @@ typedef struct
 } filter_sys_t;
 
 /*****************************************************************************
- * Create: initialize and set pf_video_filter()
+ * Create: initialize and set ops
  *****************************************************************************/
 static int Create( vlc_object_t *p_this )
 {
@@ -197,7 +197,11 @@ static int Create( vlc_object_t *p_this )
     if( p_sys->psz_path == NULL )
         p_sys->psz_path = config_GetUserDir( VLC_PICTURES_DIR );
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 9ca567c..aa653ff 100644 (file)
@@ -143,7 +143,11 @@ static int Create( vlc_object_t *p_this )
              var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "intensity" ) );
     var_AddCallback( p_filter, CFG_PREFIX "intensity", FilterCallback, NULL );
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index 76972de..a53ca5c 100644 (file)
@@ -118,7 +118,11 @@ static int Create( vlc_object_t *p_this )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
index a9e8dcb..ab48f74 100644 (file)
@@ -432,9 +432,13 @@ static int Open(vlc_object_t *object)
             goto error;
     }
 
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+        .video_mouse = Mouse,
+    };
+    filter->ops = &filter_ops;
     filter->p_sys           = sys;
-    filter->pf_video_filter = Filter;
-    filter->pf_video_mouse  = Mouse;
     return VLC_SUCCESS;
 error:
     free(sys);
index 90ae4b4..7c0a478 100644 (file)
@@ -143,7 +143,11 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     /* init data */
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
     p_sys->i_start_time = p_sys->i_cur_time = p_sys->i_last_time = vlc_tick_now();
 
     return VLC_SUCCESS;
index eae6c96..e732251 100644 (file)
@@ -90,7 +90,11 @@ static int Create( vlc_object_t *p_this )
     if( !p_sys )
         return VLC_ENOMEM;
 
-    p_filter->pf_video_filter = Filter;
+    static const struct vlc_filter_operations filter_ops =
+    {
+        .filter_video = Filter,
+    };
+    p_filter->ops = &filter_ops;
 
     p_sys->f_angle = 0.0;
     p_sys->last_date = 0;
index 5ca0e75..3e8b878 100644 (file)
@@ -111,6 +111,10 @@ static void *Thread(void *);
 const GLfloat lightZeroColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
 const GLfloat lightZeroPosition[] = {0.0f, 3.0f, 10.0f, 0.0f};
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_audio = DoWork,
+};
+
 /**
  * Open the module.
  * @param p_this: the filter object
@@ -160,7 +164,7 @@ static int Open(vlc_object_t * p_this)
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    p_filter->ops = &filter_ops;
 
     return VLC_SUCCESS;
 }
index fa8f2cc..eeeeae9 100644 (file)
@@ -104,6 +104,11 @@ static void Flush( filter_t * );
 
 static void *Thread( void * );
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_audio = DoWork,
+    .flush = Flush,
+};
+
 /*****************************************************************************
  * Open: open a scope effect plugin
  *****************************************************************************/
@@ -154,8 +159,7 @@ static int Open( vlc_object_t *p_this )
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
-    p_filter->pf_flush = Flush;
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 }
 
index f4b636f..b0e2d0e 100644 (file)
@@ -157,6 +157,14 @@ struct filter_sys_t
 static block_t *DoWork( filter_t *, block_t * );
 static void *Thread( void * );
 
+static const struct FilterOperationInitializer {
+    struct vlc_filter_operations ops {};
+    FilterOperationInitializer()
+    {
+        ops.filter_audio = DoWork;
+    };
+} filter_ops;
+
 /**
  * Open the module
  * @param p_this: the filter object
@@ -200,7 +208,7 @@ static int Open( vlc_object_t * p_this )
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    p_filter->ops = &filter_ops.ops;
     return VLC_SUCCESS;
 
 error:
index db693df..21c34ad 100644 (file)
@@ -188,6 +188,11 @@ typedef struct
     vlc_thread_t    thread;
 } filter_sys_t;
 
+static const struct vlc_filter_operations filter_ops = {
+    .filter_audio = DoWork,
+    .flush = Flush,
+};
+
 /*****************************************************************************
  * Open: open the visualizer
  *****************************************************************************/
@@ -323,8 +328,7 @@ static int Open( vlc_object_t *p_this )
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
-    p_filter->pf_flush = Flush;
+    p_filter->ops = &filter_ops;
     return VLC_SUCCESS;
 
 error:
index dbbb061..9abea74 100644 (file)
@@ -97,6 +97,14 @@ struct filter_sys_t
 static block_t *DoWork( filter_t *, block_t * );
 static void *Thread( void * );
 
+static const struct FilterOperationInitializer {
+    struct vlc_filter_operations ops {};
+    FilterOperationInitializer()
+    {
+        ops.filter_audio = DoWork;
+    };
+} filter_ops;
+
 /**
  * Open the module
  * @param p_this: the filter object
@@ -141,7 +149,7 @@ static int Open( vlc_object_t * p_this )
 
     p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
     p_filter->fmt_out.audio = p_filter->fmt_in.audio;
-    p_filter->pf_audio_filter = DoWork;
+    p_filter->ops = &filter_ops.ops;
 
     return VLC_SUCCESS;
 
index 11a77e9..d2d2b32 100644 (file)
@@ -84,7 +84,9 @@ filter_t *aout_filter_Create(vlc_object_t *obj, const filter_owner_t *restrict o
         filter = NULL;
     }
     else
-        assert (filter->pf_audio_filter != NULL);
+    {
+        assert (filter->ops != NULL && filter->ops->filter_audio != NULL);
+    }
     return filter;
 }
 
@@ -286,7 +288,7 @@ static block_t *aout_FiltersPipelinePlay(filter_t *const *filters,
 
         /* Please note that p_block->i_nb_samples & i_buffer
          * shall be set by the filter plug-in. */
-        block = filter->pf_audio_filter (filter, block);
+        block = filter->ops->filter_audio (filter, block);
     }
     return block;
 }
index 3cfc115..8fd570d 100644 (file)
@@ -109,7 +109,7 @@ vlc_audio_meter_AddPlugin(struct vlc_audio_meter *meter, const char *chain,
         if (plugin->filter == NULL)
             goto error;
 
-        assert(plugin->filter->pf_audio_drain == NULL); /* Not supported */
+        assert(plugin->filter->ops->drain_audio == NULL); /* Not supported */
     }
 
     vlc_mutex_lock(&meter->lock);
@@ -198,7 +198,7 @@ vlc_audio_meter_Process(struct vlc_audio_meter *meter, block_t *block, vlc_tick_
         {
             plugin->last_date = date + block->i_length;
 
-            block_t *same_block = filter->pf_audio_filter(filter, block);
+            block_t *same_block = filter->ops->filter_audio(filter, block);
             assert(same_block == block); (void) same_block;
         }
     }
@@ -215,8 +215,8 @@ vlc_audio_meter_Flush(struct vlc_audio_meter *meter)
     vlc_list_foreach(plugin, &meter->plugins, node)
     {
         filter_t *filter = plugin->filter;
-        if (filter != NULL && filter->pf_flush != NULL)
-            filter->pf_flush(filter);
+        if (filter != NULL && filter->ops->flush != NULL)
+            filter->ops->flush(filter);
     }
 
     vlc_mutex_unlock(&meter->lock);
index e8c1cae..ed23e1d 100644 (file)
@@ -164,7 +164,7 @@ int filter_Blend( vlc_blender_t *p_blend,
     if( !p_blend->p_module )
         return VLC_EGENERIC;
 
-    p_blend->pf_video_blend( p_blend, p_dst, p_src, i_dst_x, i_dst_y, i_alpha );
+    p_blend->ops->blend_video( p_blend, p_dst, p_src, i_dst_x, i_dst_y, i_alpha );
     return VLC_SUCCESS;
 }
 
index 176135b..29d7509 100644 (file)
@@ -429,7 +429,7 @@ static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic
     for( ; f != NULL; f = f->next )
     {
         filter_t *p_filter = &f->filter;
-        p_pic = p_filter->pf_video_filter( p_filter, p_pic );
+        p_pic = p_filter->ops->filter_video( p_filter, p_pic );
         if( !p_pic )
             break;
         if( !vlc_picture_chain_IsEmpty( &f->pending ) )
@@ -482,7 +482,7 @@ void filter_chain_SubSource( filter_chain_t *p_chain, spu_t *spu,
     for( chained_filter_t *f = p_chain->first; f != NULL; f = f->next )
     {
         filter_t *p_filter = &f->filter;
-        subpicture_t *p_subpic = p_filter->pf_sub_source( p_filter, display_date );
+        subpicture_t *p_subpic = p_filter->ops->source_sub( p_filter, display_date );
         if( p_subpic )
             spu_PutSubpicture( spu, p_subpic );
     }
@@ -494,7 +494,7 @@ subpicture_t *filter_chain_SubFilter( filter_chain_t *p_chain, subpicture_t *p_s
     {
         filter_t *p_filter = &f->filter;
 
-        p_subpic = p_filter->pf_sub_filter( p_filter, p_subpic );
+        p_subpic = p_filter->ops->filter_sub( p_filter, p_subpic );
 
         if( !p_subpic )
             break;
@@ -511,13 +511,13 @@ int filter_chain_MouseFilter( filter_chain_t *p_chain, vlc_mouse_t *p_dst, const
         filter_t *p_filter = &f->filter;
         vlc_mouse_t *p_mouse = f->mouse;
 
-        if( p_filter->pf_video_mouse && p_mouse )
+        if( p_filter->ops->video_mouse && p_mouse )
         {
             vlc_mouse_t old = *p_mouse;
             vlc_mouse_t filtered = current;
 
             *p_mouse = current;
-            if( p_filter->pf_video_mouse( p_filter, &filtered, &old ) )
+            if( p_filter->ops->video_mouse( p_filter, &filtered, &old) )
                 return VLC_EGENERIC;
             current = filtered;
         }
index faa05d9..e8f508c 100644 (file)
@@ -270,7 +270,7 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
             video_format_Copy( &p_image->p_converter->fmt_out.video, p_fmt_out);
         }
 
-        p_pic = p_image->p_converter->pf_video_filter( p_image->p_converter, p_pic );
+        p_pic = p_image->p_converter->ops->filter_video( p_image->p_converter, p_pic );
     }
     else
     {
@@ -434,7 +434,7 @@ static block_t *ImageWrite( image_handler_t *p_image, picture_t *p_pic,
         picture_Hold( p_pic );
 
         p_tmp_pic =
-            p_image->p_converter->pf_video_filter( p_image->p_converter, p_pic );
+            p_image->p_converter->ops->filter_video( p_image->p_converter, p_pic );
 
         if( likely(p_tmp_pic != NULL) )
         {
@@ -569,7 +569,7 @@ static picture_t *ImageConvert( image_handler_t *p_image, picture_t *p_pic,
 
     picture_Hold( p_pic );
 
-    return p_image->p_converter->pf_video_filter( p_image->p_converter, p_pic );
+    return p_image->p_converter->ops->filter_video( p_image->p_converter, p_pic );
 }
 
 /**
index 8766e7b..fefcf21 100644 (file)
@@ -343,7 +343,7 @@ static int SpuRenderText(spu_t *spu,
     text->fmt_out.video.i_height =
     text->fmt_out.video.i_visible_height = i_original_height;
 
-    int i_ret = text->pf_render(text, region, region, chroma_list);
+    int i_ret = text->ops->render(text, region, region, chroma_list);
 
     vlc_mutex_unlock(&sys->textlock);
     return i_ret;
@@ -996,7 +996,7 @@ static void SpuRenderRegion(spu_t *spu,
                 scale_yuvp->fmt_out.video = region->fmt;
                 scale_yuvp->fmt_out.video.i_chroma = chroma_list[0];
 
-                picture = scale_yuvp->pf_video_filter(scale_yuvp, picture);
+                picture = scale_yuvp->ops->filter_video(scale_yuvp, picture);
                 if (!picture) {
                     /* Well we will try conversion+scaling */
                     msg_Warn(spu, "%4.4s to %4.4s conversion failed",
@@ -1027,7 +1027,7 @@ static void SpuRenderRegion(spu_t *spu,
                 scale->fmt_out.video.i_visible_height =
                     spu_scale_h(region->fmt.i_visible_height, scale_size);
 
-                picture = scale->pf_video_filter(scale, picture);
+                picture = scale->ops->filter_video(scale, picture);
                 if (!picture)
                     msg_Err(spu, "scaling failed");
             }