History

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.

Guido Cella committed 2 years ago

Commit a5937ac1 parent d384a6b4 files · +9 −10Browse files

Unified · Split

4 files
  1. options/m_option.h +6 −5
  2. options/options.c +1 −1
  3. player/command.c +1 −4
  4. video/out/gpu/context.c +1 −0
options/m_option.h+6−5
@@ -457,23 +457,24 @@ char *format_file_size(int64_t size); · 456 unmodified lines
457457 #define UPDATE_SUB_HARD (1 << 22) // subtitle opts. that need full reinit
458458 #define UPDATE_SUB_EXTS (1 << 23) // update internal list of sub exts
459459 #define UPDATE_VIDEO (1 << 24) // force redraw if needed
460−#define UPDATE_OPT_LAST (1 << 24)
460+#define UPDATE_VO (1 << 25) // reinit the VO
461+#define UPDATE_OPT_LAST (1 << 25)
461462
462463 // All bits between _FIRST and _LAST (inclusive)
463464 #define UPDATE_OPTS_MASK \
464465 (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))
465466
466467 // type_float/type_double: string "default" is parsed as NaN (and reverse)
467−#define M_OPT_DEFAULT_NAN (1 << 25)
468+#define M_OPT_DEFAULT_NAN (1 << 26)
468469
469470 // type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected)
470−#define M_OPT_ALLOW_NO (1 << 26)
471+#define M_OPT_ALLOW_NO (1 << 27)
471472
472473 // type channels: disallow "auto" (still accept ""), limit list to at most 1 item.
473−#define M_OPT_CHANNELS_LIMITED (1 << 27)
474+#define M_OPT_CHANNELS_LIMITED (1 << 28)
474475
475476 // type_float/type_double: controls if pretty print should trim trailing zeros
476−#define M_OPT_FIXED_LEN_PRINT (1 << 28)
477+#define M_OPT_FIXED_LEN_PRINT (1 << 29)
477478
478479 // Like M_OPT_TYPE_OPTIONAL_PARAM.
479480 #define M_OPT_OPTIONAL_PARAM (1 << 30)
options/options.c+1−1
@@ -111,7 +111,7 @@ static const struct m_sub_options screenshot_conf = { · 110 unmodified lines
111111 #define OPT_BASE_STRUCT struct mp_vo_opts
112112
113113 static const m_option_t mp_vo_opt_list[] = {
114− {"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list)},
114+ {"vo", OPT_SETTINGSLIST(video_driver_list, &vo_obj_list), .flags = UPDATE_VO},
115115 {"taskbar-progress", OPT_BOOL(taskbar_progress)},
116116 {"drag-and-drop", OPT_CHOICE(drag_and_drop, {"no", -2}, {"auto", -1},
117117 {"replace", DND_REPLACE},
player/command.c+1−4
@@ -56,7 +56,6 @@ · 55 unmodified lines
5656 #include "options/m_config_frontend.h"
5757 #include "options/parse_configfile.h"
5858 #include "osdep/getpid.h"
59−#include "video/out/gpu/context.h"
6059 #include "video/out/vo.h"
6160 #include "video/csputils.h"
6261 #include "video/hwdec.h"
@@ -7380,9 +7379,7 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, · 7317 unmodified lines
73807379 mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
73817380 }
73827381
7383− if (opt_ptr == &opts->vo->video_driver_list ||
7384− opt_ptr == &opts->ra_ctx_opts->context_list ||
7385− opt_ptr == &opts->ra_ctx_opts->context_type_list) {
7382+ if (flags & UPDATE_VO) {
73867383 struct track *track = mpctx->current_track[0][STREAM_VIDEO];
73877384 uninit_video_out(mpctx);
73887385 handle_force_window(mpctx, true);
video/out/gpu/context.c+1−0
@@ -216,6 +216,7 @@ const struct m_sub_options ra_ctx_conf = { · 215 unmodified lines
216216 {0}
217217 },
218218 .size = sizeof(struct ra_ctx_opts),
219+ .change_flags = UPDATE_VO,
219220 };
220221
221222 static struct ra_ctx *create_in_contexts(struct vo *vo, const char *name,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t