diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/out/opengl/video.c | 1 | ||||
-rw-r--r-- | video/out/vo.c | 36 | ||||
-rw-r--r-- | video/out/vo.h | 1 |
3 files changed, 36 insertions, 2 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index bb3730022a..bbf88e2747 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -414,7 +414,6 @@ const struct m_sub_options gl_video_conf = { }, .size = sizeof(struct gl_video_opts), .defaults = &gl_video_opts_def, - .change_flags = UPDATE_RENDERER, }; static void uninit_rendering(struct gl_video *p); diff --git a/video/out/vo.c b/video/out/vo.c index e52495e195..217baac632 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -167,6 +167,8 @@ struct vo_internal { int opt_framedrop; }; +extern const struct m_sub_options gl_video_conf; + static void forget_frames(struct vo *vo); static void *vo_thread(void *ptr); @@ -210,10 +212,33 @@ static void dispatch_wakeup_cb(void *ptr) vo_wakeup(vo); } +static void update_opts(void *p) +{ + struct vo *vo = p; + + if (m_config_cache_update(vo->opts_cache)) { + // "Legacy" update of video position related options. + if (vo->driver->control) + 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); + } +} + // Does not include thread- and VO uninit. static void dealloc_vo(struct vo *vo) { forget_frames(vo); // implicitly synchronized + + // These must be free'd before vo->in->dispatch. + talloc_free(vo->opts_cache); + talloc_free(vo->gl_opts_cache); + pthread_mutex_destroy(&vo->in->lock); pthread_cond_destroy(&vo->in->wakeup); talloc_free(vo); @@ -254,9 +279,18 @@ static struct vo *vo_create(bool probing, struct mpv_global *global, pthread_mutex_init(&vo->in->lock, NULL); pthread_cond_init(&vo->in->wakeup, NULL); - vo->opts_cache = m_config_cache_alloc(vo, global, &vo_sub_opts); + vo->opts_cache = m_config_cache_alloc(NULL, global, &vo_sub_opts); vo->opts = vo->opts_cache->opts; + m_config_cache_set_dispatch_change_cb(vo->opts_cache, vo->in->dispatch, + update_opts, vo); + +#if HAVE_GL + 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); +#endif + mp_input_set_mouse_transform(vo->input_ctx, NULL, NULL); if (vo->driver->encode != !!vo->encode_lavc_ctx) goto error; diff --git a/video/out/vo.h b/video/out/vo.h index 82ec284219..c3145d5a5d 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -400,6 +400,7 @@ struct vo { struct m_config_cache *opts_cache; // cache for ->opts struct mp_vo_opts *opts; + struct m_config_cache *gl_opts_cache; bool want_redraw; // redraw as soon as possible |