m_option: add UPDATE_VO flag

This will allow reiniting the VO when more options are changed without
hardcoding them in options.c

Also reinit the VO when changing --gpu-debug and --gpu-sw.
This commit is contained in:
Guido Cella 2024-07-04 09:41:41 +02:00 committed by Dudemanguy
parent d384a6b793
commit a5937ac7e3
4 changed files with 9 additions and 10 deletions

View File

@ -457,23 +457,24 @@ char *format_file_size(int64_t size);
#define UPDATE_SUB_HARD (1 << 22) // subtitle opts. that need full reinit
#define UPDATE_SUB_EXTS (1 << 23) // update internal list of sub exts
#define UPDATE_VIDEO (1 << 24) // force redraw if needed
#define UPDATE_OPT_LAST (1 << 24)
#define UPDATE_VO (1 << 25) // reinit the VO
#define UPDATE_OPT_LAST (1 << 25)
// All bits between _FIRST and _LAST (inclusive)
#define UPDATE_OPTS_MASK \
(((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))
// type_float/type_double: string "default" is parsed as NaN (and reverse)
#define M_OPT_DEFAULT_NAN (1 << 25)
#define M_OPT_DEFAULT_NAN (1 << 26)
// type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected)
#define M_OPT_ALLOW_NO (1 << 26)
#define M_OPT_ALLOW_NO (1 << 27)
// type channels: disallow "auto" (still accept ""), limit list to at most 1 item.
#define M_OPT_CHANNELS_LIMITED (1 << 27)
#define M_OPT_CHANNELS_LIMITED (1 << 28)
// type_float/type_double: controls if pretty print should trim trailing zeros
#define M_OPT_FIXED_LEN_PRINT (1 << 28)
#define M_OPT_FIXED_LEN_PRINT (1 << 29)
// Like M_OPT_TYPE_OPTIONAL_PARAM.
#define M_OPT_OPTIONAL_PARAM (1 << 30)

View File

@ -111,7 +111,7 @@ static const struct m_sub_options screenshot_conf = {
#define OPT_BASE_STRUCT struct mp_vo_opts
static const m_option_t mp_vo_opt_list[] = {
{"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list)},
{"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list), .flags = UPDATE_VO},
{"taskbar-progress", OPT_BOOL(taskbar_progress)},
{"drag-and-drop", OPT_CHOICE(drag_and_drop, {"no", -2}, {"auto", -1},
{"replace", DND_REPLACE},

View File

@ -56,7 +56,6 @@
#include "options/m_config_frontend.h"
#include "options/parse_configfile.h"
#include "osdep/getpid.h"
#include "video/out/gpu/context.h"
#include "video/out/vo.h"
#include "video/csputils.h"
#include "video/hwdec.h"
@ -7380,9 +7379,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
}
if (opt_ptr == &opts->vo->video_driver_list ||
opt_ptr == &opts->ra_ctx_opts->context_list ||
opt_ptr == &opts->ra_ctx_opts->context_type_list) {
if (flags & UPDATE_VO) {
struct track *track = mpctx->current_track[0][STREAM_VIDEO];
uninit_video_out(mpctx);
handle_force_window(mpctx, true);

View File

@ -216,6 +216,7 @@ const struct m_sub_options ra_ctx_conf = {
{0}
},
.size = sizeof(struct ra_ctx_opts),
.change_flags = UPDATE_VO,
};
static struct ra_ctx *create_in_contexts(struct vo *vo, const char *name,