[vlc-devel] [PATCH v5 01/24] filters: initialize the output mouse state to the new state
Steve Lhomme
robux4 at ycbcr.xyz
Mon Aug 24 09:41:42 CEST 2020
Avoid some boiler plate copy for filters not modifying the output.
---
modules/spu/logo.c | 2 +-
modules/video_filter/ci_filters.m | 1 -
modules/video_filter/deinterlace/deinterlace.c | 2 +-
modules/video_filter/freeze.c | 2 +-
modules/video_filter/magnify.c | 1 -
modules/video_filter/puzzle.c | 5 +----
modules/video_filter/transform.c | 2 +-
src/misc/filter_chain.c | 2 +-
8 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/modules/spu/logo.c b/modules/spu/logo.c
index fa1ee0307c0..faadfc2e973 100644
--- a/modules/spu/logo.c
+++ b/modules/spu/logo.c
@@ -515,6 +515,7 @@ exit:
static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
+ VLC_UNUSED( p_mouse );
filter_sys_t *p_sys = p_filter->p_sys;
vlc_mutex_lock( &p_sys->lock );
@@ -556,7 +557,6 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
}
vlc_mutex_unlock( &p_sys->lock );
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index 4bc8bca0d92..95ab2dd5252 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -441,7 +441,6 @@ Mouse(filter_t *filter, struct vlc_mouse_t *mouse,
sys->old_mouse = *old;
sys->mouse = *new;
sys->mouse_moved = true;
- *mouse = *new;
return VLC_SUCCESS;
}
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 01d7ad5e616..c552b1ab034 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -474,7 +474,7 @@ int Mouse( filter_t *p_filter,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
VLC_UNUSED(p_old);
- *p_mouse = *p_new;
+ 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 656b4252652..133b11efdae 100644
--- a/modules/video_filter/freeze.c
+++ b/modules/video_filter/freeze.c
@@ -225,6 +225,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic_in ) {
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 )
{
+ 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;
@@ -235,7 +236,6 @@ static int freeze_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
if ( unlikely(!p_sys->b_init) )
{
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index 555859b8f5c..ca98e13d5d1 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -415,7 +415,6 @@ static int Mouse( filter_t *p_filter, vlc_mouse_t *p_mouse, const vlc_mouse_t *p
return VLC_EGENERIC;
/* */
- *p_mouse = *p_new;
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;
return VLC_SUCCESS;
diff --git a/modules/video_filter/puzzle.c b/modules/video_filter/puzzle.c
index 35e0a090ce4..80a9806a3f5 100644
--- a/modules/video_filter/puzzle.c
+++ b/modules/video_filter/puzzle.c
@@ -627,6 +627,7 @@ int puzzle_Callback( vlc_object_t *p_this, char const *psz_var,
int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
{
+ 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;
@@ -636,7 +637,6 @@ int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
return VLC_EGENERIC;
if (! p_sys->b_init || p_sys->b_change_param) {
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
@@ -656,7 +656,6 @@ int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
else
{
/* otherwise we can forward the mouse */
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
}
@@ -679,7 +678,6 @@ int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
/* do not take into account if border clicked */
if ((p_new->i_x <= i_border_width) || (p_new->i_y <= i_border_height) || (p_new->i_x >= (int) p_fmt_in->i_width - i_border_width) || (p_new->i_y >= (int) p_fmt_in->i_height - i_border_height ) )
{
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
else if( p_sys->i_selected == NO_PCE )
@@ -740,7 +738,6 @@ int puzzle_mouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
else /* jigsaw puzzle mode */
{
if ((p_sys->ps_desk_planes == NULL) || (p_sys->ps_pict_planes == NULL) || (p_sys->ps_puzzle_array == NULL) || (p_sys->ps_pieces == NULL)) {
- *p_mouse = *p_new;
return VLC_SUCCESS;
}
diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index e0da5468232..7b6a3577207 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -292,11 +292,11 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
const vlc_mouse_t *mold, const vlc_mouse_t *mnew)
{
VLC_UNUSED( mold );
+ VLC_UNUSED( mnew );
const video_format_t *fmt = &filter->fmt_out.video;
const filter_sys_t *sys = filter->p_sys;
- *mouse = *mnew;
sys->convert(&mouse->i_x, &mouse->i_y,
fmt->i_visible_width, fmt->i_visible_height,
mouse->i_x, mouse->i_y);
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 55f7e07ac2f..d3964fdd78b 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -517,7 +517,7 @@ int filter_chain_MouseFilter( filter_chain_t *p_chain, vlc_mouse_t *p_dst, const
if( p_filter->pf_video_mouse && p_mouse )
{
vlc_mouse_t old = *p_mouse;
- vlc_mouse_t filtered;
+ vlc_mouse_t filtered = current;
*p_mouse = current;
if( p_filter->pf_video_mouse( p_filter, &filtered, &old, ¤t ) )
--
2.26.2
More information about the vlc-devel
mailing list