[vlc-commits] sub source: use a typed close callback in the operations structure
Steve Lhomme
git at videolan.org
Mon Oct 12 15:56:09 CEST 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 9 11:00:57 2020 +0200| [3eb94a9f06028735c183519aac17be516ba621b6] | committer: Steve Lhomme
sub source: use a typed close callback in the operations structure
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3eb94a9f06028735c183519aac17be516ba621b6
---
modules/spu/audiobargraph_v.c | 16 +++++-----------
modules/spu/dynamicoverlay/dynamicoverlay.c | 9 ++++-----
modules/spu/logo.c | 16 +++++-----------
modules/spu/marq.c | 9 ++++-----
modules/spu/mosaic.c | 9 ++++-----
modules/spu/rss.c | 9 ++++-----
6 files changed, 26 insertions(+), 42 deletions(-)
diff --git a/modules/spu/audiobargraph_v.c b/modules/spu/audiobargraph_v.c
index 1f7225bbe8..61560996c1 100644
--- a/modules/spu/audiobargraph_v.c
+++ b/modules/spu/audiobargraph_v.c
@@ -67,7 +67,7 @@ static const char *const ppsz_pos_descriptions[] =
static int OpenSub (vlc_object_t *);
static int OpenVideo(vlc_object_t *);
-static void Close (vlc_object_t *);
+static void Close (filter_t *);
vlc_module_begin ()
@@ -75,7 +75,7 @@ vlc_module_begin ()
set_subcategory(SUBCAT_VIDEO_SUBPIC)
set_capability("sub source", 0)
- set_callbacks(OpenSub, Close)
+ set_callback(OpenSub)
set_description(N_("Audio Bar Graph Video sub source"))
set_shortname(N_("Audio Bar Graph Video"))
add_shortcut("audiobargraph_v")
@@ -488,16 +488,11 @@ out:
}
static const struct vlc_filter_operations filter_sub_ops = {
- .source_sub = FilterSub,
+ .source_sub = FilterSub, .close = Close
};
-static void CloseVideo( filter_t *p_filter )
-{
- Close( VLC_OBJECT(p_filter) );
-}
-
static const struct vlc_filter_operations filter_video_ops = {
- .filter_video = FilterVideo, .close = CloseVideo,
+ .filter_video = FilterVideo, .close = Close,
};
/**
@@ -597,9 +592,8 @@ static int OpenVideo(vlc_object_t *p_this)
/**
* Common close function
*/
-static void Close(vlc_object_t *p_this)
+static void Close(filter_t *p_filter)
{
- filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
vlc_object_t *vlc = VLC_OBJECT(vlc_object_instance(p_filter));
diff --git a/modules/spu/dynamicoverlay/dynamicoverlay.c b/modules/spu/dynamicoverlay/dynamicoverlay.c
index 37cdf7936d..3640ad0686 100644
--- a/modules/spu/dynamicoverlay/dynamicoverlay.c
+++ b/modules/spu/dynamicoverlay/dynamicoverlay.c
@@ -45,7 +45,7 @@
* Local prototypes
*****************************************************************************/
static int Create( vlc_object_t * );
-static void Destroy( vlc_object_t * );
+static void Destroy( filter_t * );
static subpicture_t *Filter( filter_t *, vlc_tick_t );
static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
@@ -74,7 +74,7 @@ vlc_module_begin ()
add_loadfile("overlay-output", NULL, OUTPUT_TEXT, OUTPUT_LONGTEXT)
add_shortcut( "overlay" )
- set_callbacks( Create, Destroy )
+ set_callback( Create )
vlc_module_end ()
static const char *const ppsz_filter_options[] = {
@@ -82,7 +82,7 @@ static const char *const ppsz_filter_options[] = {
};
static const struct vlc_filter_operations filter_ops = {
- .source_sub = Filter,
+ .source_sub = Filter, .close = Destroy,
};
/*****************************************************************************
@@ -136,9 +136,8 @@ static int Create( vlc_object_t *p_this )
*****************************************************************************
* Terminate an output method created by adjustCreateOutputMethod
*****************************************************************************/
-static void Destroy( vlc_object_t *p_this )
+static void Destroy( filter_t *p_filter )
{
- filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
BufferDestroy( &p_sys->input );
diff --git a/modules/spu/logo.c b/modules/spu/logo.c
index f4b3d23ab2..feb21af8f1 100644
--- a/modules/spu/logo.c
+++ b/modules/spu/logo.c
@@ -81,14 +81,14 @@ static const char *const ppsz_pos_descriptions[] =
static int OpenSub ( vlc_object_t * );
static int OpenVideo( vlc_object_t * );
-static void Close ( vlc_object_t * );
+static void Close ( filter_t * );
vlc_module_begin ()
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_SUBPIC )
set_help(LOGO_HELP)
set_capability( "sub source", 0 )
- set_callbacks( OpenSub, Close )
+ set_callback( OpenSub )
set_description( N_("Logo sub source") )
set_shortname( N_("Logo overlay") )
add_shortcut( "logo" )
@@ -216,18 +216,13 @@ static int OpenVideo( vlc_object_t *p_this )
}
static const struct vlc_filter_operations filter_sub_ops = {
- .source_sub = FilterSub,
+ .source_sub = FilterSub, .close = Close,
};
-static void CloseVideo( filter_t *p_filter )
-{
- Close( VLC_OBJECT(p_filter) );
-}
-
static const struct vlc_filter_operations filter_video_ops = {
.filter_video = FilterVideo,
.video_mouse = Mouse,
- .close = CloseVideo,
+ .close = Close,
};
/**
@@ -319,9 +314,8 @@ static int OpenCommon( vlc_object_t *p_this, bool b_sub )
/**
* Common close function
*/
-static void Close( vlc_object_t *p_this )
+static void Close( filter_t *p_filter )
{
- filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
for( int i = 0; ppsz_filter_callbacks[i]; i++ )
diff --git a/modules/spu/marq.c b/modules/spu/marq.c
index 31657aa047..1129877a72 100644
--- a/modules/spu/marq.c
+++ b/modules/spu/marq.c
@@ -44,7 +44,7 @@
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
-static void DestroyFilter( vlc_object_t * );
+static void DestroyFilter( filter_t * );
static subpicture_t *Filter( filter_t *, vlc_tick_t );
static char *MarqueeReadFile( filter_t *, const char * );
@@ -140,7 +140,7 @@ vlc_module_begin ()
set_shortname( N_("Marquee" ))
set_description( N_("Marquee display") )
set_help(MARQUEE_HELP)
- set_callbacks( CreateFilter, DestroyFilter )
+ set_callback( CreateFilter )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_SUBPIC )
add_string( CFG_PREFIX "marquee", "VLC", MSG_TEXT, MSG_LONGTEXT,
@@ -179,7 +179,7 @@ static const char *const ppsz_filter_options[] = {
};
static const struct vlc_filter_operations filter_ops = {
- .source_sub = Filter,
+ .source_sub = Filter, .close = DestroyFilter,
};
/*****************************************************************************
@@ -240,9 +240,8 @@ static int CreateFilter( vlc_object_t *p_this )
/*****************************************************************************
* DestroyFilter: destroy marquee video filter
*****************************************************************************/
-static void DestroyFilter( vlc_object_t *p_this )
+static void DestroyFilter( filter_t *p_filter )
{
- filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
/* Delete the marquee variables */
diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
index 4a2f6b3c59..3c9f0b8538 100644
--- a/modules/spu/mosaic.c
+++ b/modules/spu/mosaic.c
@@ -45,7 +45,7 @@
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
-static void DestroyFilter ( vlc_object_t * );
+static void DestroyFilter ( filter_t * );
static subpicture_t *Filter ( filter_t *, vlc_tick_t );
static int MosaicCallback ( vlc_object_t *, char const *, vlc_value_t,
@@ -177,7 +177,7 @@ vlc_module_begin ()
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_SUBPIC)
set_capability( "sub source", 0 )
- set_callbacks( CreateFilter, DestroyFilter )
+ set_callback( CreateFilter )
add_integer_with_range( CFG_PREFIX "alpha", 255, 0, 255,
ALPHA_TEXT, ALPHA_LONGTEXT, false )
@@ -272,7 +272,7 @@ static void mosaic_ParseSetOffsets( vlc_object_t *p_this,
mosaic_ParseSetOffsets( VLC_OBJECT( a ), b, c )
static const struct vlc_filter_operations filter_ops = {
- .source_sub = Filter,
+ .source_sub = Filter, .close = DestroyFilter,
};
/*****************************************************************************
@@ -379,9 +379,8 @@ static int CreateFilter( vlc_object_t *p_this )
/*****************************************************************************
* DestroyFilter: destroy mosaic video filter
*****************************************************************************/
-static void DestroyFilter( vlc_object_t *p_this )
+static void DestroyFilter( filter_t *p_filter )
{
- filter_t *p_filter = (filter_t*)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
#define DEL_CB( name ) \
diff --git a/modules/spu/rss.c b/modules/spu/rss.c
index 08c5ea5957..f5a9129498 100644
--- a/modules/spu/rss.c
+++ b/modules/spu/rss.c
@@ -50,7 +50,7 @@
* Local prototypes
*****************************************************************************/
static int CreateFilter ( vlc_object_t * );
-static void DestroyFilter( vlc_object_t * );
+static void DestroyFilter( filter_t * );
static subpicture_t *Filter( filter_t *, vlc_tick_t );
static struct rss_feed_t *FetchRSS( filter_t * );
@@ -191,7 +191,7 @@ vlc_module_begin ()
set_capability( "sub source", 1 )
set_shortname( N_("RSS / Atom") )
set_help(RSS_HELP)
- set_callbacks( CreateFilter, DestroyFilter )
+ set_callback( CreateFilter )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_SUBPIC )
add_string( CFG_PREFIX "urls", NULL, MSG_TEXT, MSG_LONGTEXT, false )
@@ -241,7 +241,7 @@ static void InitCurrentContext(filter_sys_t *p_sys)
}
static const struct vlc_filter_operations filter_ops = {
- .source_sub = Filter,
+ .source_sub = Filter, .close = DestroyFilter,
};
/*****************************************************************************
@@ -338,9 +338,8 @@ error:
/*****************************************************************************
* DestroyFilter: destroy RSS video filter
*****************************************************************************/
-static void DestroyFilter( vlc_object_t *p_this )
+static void DestroyFilter( filter_t *p_filter )
{
- filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys = p_filter->p_sys;
vlc_timer_destroy( p_sys->timer );
More information about the vlc-commits
mailing list