From 03cf150ff3516789d581214177f291d46310aaf4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 22 Aug 2017 17:01:35 +0200 Subject: video: redo video equalizer option handling I really wouldn't care much about this, but some parts of the core code are under HAVE_GPL, so there's some need to get rid of it. Simply turn the video equalizer from its current fine-grained handling with vf/vo fallbacks into global options. This makes updating them much simpler. This removes any possibility of applying video equalizers in filters, which affects vf_scale, and the previously removed vf_eq. Not a big loss, since the preferred VOs have this builtin. Remove video equalizer handling from vo_direct3d, vo_sdl, vo_vaapi, and vo_xv. I'm not going to waste my time on these legacy VOs. vo.eq_opts_cache exists _only_ to send a VOCTRL_SET_EQUALIZER, which exists _only_ to trigger a redraw. This seems silly, but for now I feel like this is less of a pain. The rest of the equalizer using code is self-updating. See commit 96b906a51d5 for how some video equalizer code was GPL only. Some command line option names and ranges can probably be traced back to a GPL only committer, but we don't consider these copyrightable. --- video/out/vo.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'video/out/vo.c') diff --git a/video/out/vo.c b/video/out/vo.c index 217baac632..f9c5d04e24 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -228,6 +228,12 @@ static void update_opts(void *p) 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. @@ -238,6 +244,7 @@ static void dealloc_vo(struct vo *vo) // These must be free'd before vo->in->dispatch. talloc_free(vo->opts_cache); talloc_free(vo->gl_opts_cache); + talloc_free(vo->eq_opts_cache); pthread_mutex_destroy(&vo->in->lock); pthread_cond_destroy(&vo->in->wakeup); @@ -291,6 +298,10 @@ static struct vo *vo_create(bool probing, struct mpv_global *global, update_opts, vo); #endif + 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) goto error; -- cgit v1.2.3