[vlc-devel] [PATCH v3 02/18] filters: remove the duplicate new mouse state
Steve Lhomme
robux4 at ycbcr.xyz
Tue Aug 18 16:58:29 CEST 2020
We pass the new state and we received the modified value in the same variable.
---
include/vlc_filter.h | 3 +--
modules/spu/logo.c | 7 +++----
modules/video_chroma/chain.c | 5 ++---
modules/video_filter/ci_filters.m | 5 ++---
modules/video_filter/deinterlace/deinterlace.c | 6 ++----
modules/video_filter/freeze.c | 7 +++----
modules/video_filter/magnify.c | 8 ++++----
modules/video_filter/puzzle.c | 5 ++---
modules/video_filter/puzzle.h | 3 +--
modules/video_filter/transform.c | 3 +--
src/misc/filter_chain.c | 2 +-
11 files changed, 22 insertions(+), 32 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 9574c318d98..a85c36bd4b2 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -149,8 +149,7 @@ struct filter_t
* 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,
- const struct vlc_mouse_t *p_new );
+ const struct vlc_mouse_t *p_old);
};
/** Private structure for the owner of the filter */
diff --git a/modules/spu/logo.c b/modules/spu/logo.c
index faadfc2e973..c8d1b02445b 100644
--- a/modules/spu/logo.c
+++ b/modules/spu/logo.c
@@ -189,7 +189,7 @@ static int OpenCommon( vlc_object_t *, bool b_sub );
static subpicture_t *FilterSub( filter_t *, vlc_tick_t );
static picture_t *FilterVideo( filter_t *, picture_t * );
-static int Mouse( filter_t *, vlc_mouse_t *, const vlc_mouse_t *, const vlc_mouse_t * );
+static int Mouse( filter_t *, vlc_mouse_t *, const vlc_mouse_t * );
static int LogoCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
@@ -512,10 +512,9 @@ exit:
return p_dst;
}
-static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+static int Mouse( filter_t *p_filter, vlc_mouse_t *p_new,
+ const vlc_mouse_t *p_old )
{
- VLC_UNUSED( p_mouse );
filter_sys_t *p_sys = p_filter->p_sys;
vlc_mutex_lock( &p_sys->lock );
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index af110ec761c..7ec2798cc3c 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -362,11 +362,10 @@ static int BuildChromaChain( filter_t *p_filter )
}
static int ChainMouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+ const vlc_mouse_t *p_old )
{
- (void) p_old;
filter_sys_t *p_sys = p_filter->p_sys;
- return filter_chain_MouseFilter( p_sys->p_chain, p_mouse, p_new );
+ return filter_chain_MouseFilter( p_sys->p_chain, p_mouse, p_old );
}
static int BuildFilterChain( filter_t *p_filter )
diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index 95ab2dd5252..154fc44012c 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -433,10 +433,9 @@ error:
}
static int
-Mouse(filter_t *filter, struct vlc_mouse_t *mouse,
- const struct vlc_mouse_t *old, const struct vlc_mouse_t *new)
+Mouse(filter_t *filter, struct vlc_mouse_t *new,
+ const struct vlc_mouse_t *old)
{
- VLC_UNUSED(mouse);
filter_sys_t *sys = filter->p_sys;
sys->old_mouse = *old;
sys->mouse = *new;
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index c552b1ab034..1676a07f8ca 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -154,8 +154,7 @@ static void Flush( filter_t *p_filter );
*/
static int Mouse( filter_t *p_filter,
vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old,
- const vlc_mouse_t *p_new );
+ const vlc_mouse_t *p_old );
/**
* Stops and uninitializes the filter, and deallocates memory.
@@ -471,10 +470,9 @@ void Flush( filter_t *p_filter )
int Mouse( filter_t *p_filter,
vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+ const vlc_mouse_t *p_old )
{
VLC_UNUSED(p_old);
- VLC_UNUSED(p_new);
filter_sys_t *p_sys = p_filter->p_sys;
if( p_sys->context.settings.b_half_height )
p_mouse->i_y *= 2;
diff --git a/modules/video_filter/freeze.c b/modules/video_filter/freeze.c
index 133b11efdae..be5fde8e9d9 100644
--- a/modules/video_filter/freeze.c
+++ b/modules/video_filter/freeze.c
@@ -60,7 +60,7 @@ typedef struct
static picture_t *Filter( filter_t *, picture_t * );
static int freeze_mouse( filter_t *, vlc_mouse_t *,
- const vlc_mouse_t *, const vlc_mouse_t * );
+ const vlc_mouse_t * );
static int freeze_allocate_data( filter_t *, picture_t * );
static void freeze_free_allocated_data( filter_t * );
@@ -222,10 +222,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic_in ) {
/*
* mouse callback
**/
-static int freeze_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+static int freeze_mouse( filter_t *p_filter, vlc_mouse_t *p_new,
+ const vlc_mouse_t *p_old )
{
- VLC_UNUSED(p_mouse);
filter_sys_t *p_sys = p_filter->p_sys;
const video_format_t *p_fmt_in = &p_filter->fmt_in.video;
diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index ca98e13d5d1..e5582bbc0ff 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -59,7 +59,7 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
static picture_t *Filter( filter_t *, picture_t * );
-static int Mouse( filter_t *, vlc_mouse_t *, const vlc_mouse_t *, const vlc_mouse_t * );
+static int Mouse( filter_t *, vlc_mouse_t *, const vlc_mouse_t * );
/* */
static void DrawZoomStatus( uint8_t *, int i_pitch, int i_width, int i_height,
@@ -327,7 +327,7 @@ static void DrawRectangle( uint8_t *pb_dst, int i_pitch, int i_width, int i_heig
memset( &pb_dst[(y+i_h-1) * i_pitch + x], 0xff, i_w );
}
-static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+static int Mouse( filter_t *p_filter, vlc_mouse_t *p_new, const vlc_mouse_t *p_old )
{
filter_sys_t *p_sys = p_filter->p_sys;
const video_format_t *p_fmt = &p_filter->fmt_in.video;
@@ -415,8 +415,8 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p
return VLC_EGENERIC;
/* */
- p_mouse->i_x = p_sys->i_x + p_new->i_x * ZOOM_FACTOR / p_sys->i_zoom;
- p_mouse->i_y = p_sys->i_y + p_new->i_y * ZOOM_FACTOR / p_sys->i_zoom;
+ p_new->i_x = p_sys->i_x + p_new->i_x * ZOOM_FACTOR / p_sys->i_zoom;
+ p_new->i_y = p_sys->i_y + p_new->i_y * ZOOM_FACTOR / p_sys->i_zoom;
return VLC_SUCCESS;
}
diff --git a/modules/video_filter/puzzle.c b/modules/video_filter/puzzle.c
index 80a9806a3f5..bef39368bc4 100644
--- a/modules/video_filter/puzzle.c
+++ b/modules/video_filter/puzzle.c
@@ -624,10 +624,9 @@ int puzzle_Callback( vlc_object_t *p_this, char const *psz_var,
}
/* mouse callback */
-int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
- const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
+int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_new,
+ const vlc_mouse_t *p_old )
{
- VLC_UNUSED(p_mouse);
filter_sys_t *p_sys = p_filter->p_sys;
const video_format_t *p_fmt_in = &p_filter->fmt_in.video;
diff --git a/modules/video_filter/puzzle.h b/modules/video_filter/puzzle.h
index a866d676bdf..8874310edab 100644
--- a/modules/video_filter/puzzle.h
+++ b/modules/video_filter/puzzle.h
@@ -74,7 +74,6 @@ struct vlc_mouse_t;
picture_t *Filter( filter_t *, picture_t * );
int puzzle_Callback( vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void * );
-int puzzle_mouse( filter_t *, struct vlc_mouse_t *, const struct vlc_mouse_t *,
- const struct vlc_mouse_t * );
+int puzzle_mouse( filter_t *, struct vlc_mouse_t *, const struct vlc_mouse_t * );
#endif
diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 7b6a3577207..a9e8dcb1479 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -289,10 +289,9 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
}
static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
- const vlc_mouse_t *mold, const vlc_mouse_t *mnew)
+ const vlc_mouse_t *mold)
{
VLC_UNUSED( mold );
- VLC_UNUSED( mnew );
const video_format_t *fmt = &filter->fmt_out.video;
const filter_sys_t *sys = filter->p_sys;
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 8079c6125f8..c8004496e80 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -518,7 +518,7 @@ int filter_chain_MouseFilter( filter_chain_t *p_chain, vlc_mouse_t *p_dst, const
vlc_mouse_t filtered = current;
*p_mouse = current;
- if( p_filter->pf_video_mouse( p_filter, &filtered, &old, ¤t ) )
+ if( p_filter->pf_video_mouse( p_filter, &filtered, &old ) )
return VLC_EGENERIC;
current = filtered;
}
--
2.26.2
More information about the vlc-devel
mailing list