From 073858fcddddc757dcfb0e10640d19ac8d6d925d Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Wed, 14 Feb 2024 11:26:05 -0600 Subject: vo: remove VOCTRL_SET_EQUALIZER and simplify into UPDATE_VIDEO Since 03cf150ff3516789d581214177f291d46310aaf4, the only purpose of this VOCTRL was to signal a redraw to the vo. It actualy could have been removed in 531868fe0d2a35fbbff78d9a9ff8f96df73e69fd, but this was missed. The UPDATE_VIDEO flag is better anyway because it allows us to handle a wide variety of options scattered around that require the VO to update itself and redraw. We can remove both of the custom callbacks in vo.c and only leave the VOCTRL_VO_OPTS_CHANGED one. Additionally, that commit also introduced vo_set_want_redraw, but this is redundant and not needed. The VOs that use VOCTRL_UPDATE_RENDER_OPTS already set vo->want_redraw, and those are the only VOs where these options are relevant in the first place. So we can remove this as well and just let the big callback in player/command do everything. --- player/command.c | 2 +- video/out/vo.c | 28 ---------------------------- video/out/vo.h | 2 -- video/out/vo_gpu.c | 3 --- video/out/vo_gpu_next.c | 1 - video/out/vo_libmpv.c | 3 --- video/out/vo_vdpau.c | 3 --- 7 files changed, 1 insertion(+), 41 deletions(-) diff --git a/player/command.c b/player/command.c index 08257a0bbb..3273684227 100644 --- a/player/command.c +++ b/player/command.c @@ -7122,7 +7122,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, if (flags & UPDATE_VIDEO) { if (mpctx->video_out) { - vo_set_want_redraw(mpctx->video_out); + vo_control(mpctx->video_out, VOCTRL_UPDATE_RENDER_OPTS, NULL); mp_wakeup_core(mpctx); } } diff --git a/video/out/vo.c b/video/out/vo.c index 6e4f41645d..2400f8de61 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -236,7 +236,6 @@ static void update_opts(void *p) if (m_config_cache_update(vo->opts_cache)) { read_opts(vo); - if (vo->driver->control) { vo->driver->control(vo, VOCTRL_VO_OPTS_CHANGED, NULL); // "Legacy" update of video position related options. @@ -244,18 +243,6 @@ static void update_opts(void *p) vo->driver->control(vo, VOCTRL_SET_PANSCAN, NULL); } } - - if (vo->gl_opts_cache && m_config_cache_update(vo->gl_opts_cache)) { - // "Legacy" update of video GL renderer related options. - if (vo->driver->control) - vo->driver->control(vo, VOCTRL_UPDATE_RENDER_OPTS, NULL); - } - - if (m_config_cache_update(vo->eq_opts_cache)) { - // "Legacy" update of video equalizer related options. - if (vo->driver->control) - vo->driver->control(vo, VOCTRL_SET_EQUALIZER, NULL); - } } // Does not include thread- and VO uninit. @@ -318,12 +305,7 @@ static struct vo *vo_create(bool probing, struct mpv_global *global, update_opts, vo); vo->gl_opts_cache = m_config_cache_alloc(NULL, global, &gl_video_conf); - m_config_cache_set_dispatch_change_cb(vo->gl_opts_cache, vo->in->dispatch, - update_opts, vo); - vo->eq_opts_cache = m_config_cache_alloc(NULL, global, &mp_csp_equalizer_conf); - m_config_cache_set_dispatch_change_cb(vo->eq_opts_cache, vo->in->dispatch, - update_opts, vo); mp_input_set_mouse_transform(vo->input_ctx, NULL, NULL); if (vo->driver->encode != !!vo->encode_lavc_ctx) @@ -1235,16 +1217,6 @@ void vo_redraw(struct vo *vo) mp_mutex_unlock(&in->lock); } -// Same as vo_redraw but the redraw is delayed until it -// is detected in the playloop. -void vo_set_want_redraw(struct vo *vo) -{ - struct vo_internal *in = vo->in; - mp_mutex_lock(&in->lock); - in->want_redraw = true; - mp_mutex_unlock(&in->lock); -} - bool vo_want_redraw(struct vo *vo) { struct vo_internal *in = vo->in; diff --git a/video/out/vo.h b/video/out/vo.h index 7c5ed67736..2ed971c146 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -67,7 +67,6 @@ enum mp_voctrl { VOCTRL_RESUME, VOCTRL_SET_PANSCAN, - VOCTRL_SET_EQUALIZER, // Triggered by any change to mp_vo_opts. This is for convenience. In theory, // you could install your own listener. @@ -513,7 +512,6 @@ bool vo_still_displaying(struct vo *vo); void vo_request_wakeup_on_done(struct vo *vo); bool vo_has_frame(struct vo *vo); void vo_redraw(struct vo *vo); -void vo_set_want_redraw(struct vo *vo); bool vo_want_redraw(struct vo *vo); void vo_seek_reset(struct vo *vo); void vo_destroy(struct vo *vo); diff --git a/video/out/vo_gpu.c b/video/out/vo_gpu.c index 6abe20b0d7..584a86096b 100644 --- a/video/out/vo_gpu.c +++ b/video/out/vo_gpu.c @@ -186,9 +186,6 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_SET_PANSCAN: resize(vo); return VO_TRUE; - case VOCTRL_SET_EQUALIZER: - vo->want_redraw = true; - return VO_TRUE; case VOCTRL_SCREENSHOT: { struct vo_frame *frame = vo_get_current_vo_frame(vo); if (frame) diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 31b4200779..444651fda6 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1425,7 +1425,6 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_SET_PANSCAN: resize(vo); return VO_TRUE; - case VOCTRL_SET_EQUALIZER: case VOCTRL_PAUSE: if (p->is_interpolated) vo->want_redraw = true; diff --git a/video/out/vo_libmpv.c b/video/out/vo_libmpv.c index 972588ee3e..8a686022a1 100644 --- a/video/out/vo_libmpv.c +++ b/video/out/vo_libmpv.c @@ -608,9 +608,6 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_PAUSE: vo->want_redraw = true; return VO_TRUE; - case VOCTRL_SET_EQUALIZER: - vo->want_redraw = true; - return VO_TRUE; case VOCTRL_SET_PANSCAN: mp_mutex_lock(&ctx->lock); ctx->need_resize = true; diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index f1f6f3ae71..b22dcba0ce 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -1071,9 +1071,6 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_SET_PANSCAN: checked_resize(vo); return VO_TRUE; - case VOCTRL_SET_EQUALIZER: - vo->want_redraw = true; - return true; case VOCTRL_RESET: forget_frames(vo, true); return true; -- cgit v1.2.3