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
457#define UPDATE_SUB_HARD (1 << 22) // subtitle opts. that need full reinit457#define UPDATE_SUB_HARD (1 << 22) // subtitle opts. that need full reinit
458#define UPDATE_SUB_EXTS (1 << 23) // update internal list of sub exts458#define UPDATE_SUB_EXTS (1 << 23) // update internal list of sub exts
459#define UPDATE_VIDEO (1 << 24) // force redraw if needed459#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)
461 462
462// All bits between _FIRST and _LAST (inclusive)463// All bits between _FIRST and _LAST (inclusive)
463#define UPDATE_OPTS_MASK \464#define UPDATE_OPTS_MASK \
464 (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))465 (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))
465 466
466// type_float/type_double: string "default" is parsed as NaN (and reverse)467// 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)
468 469
469// type time: string "no" maps to MP_NOPTS_VALUE (if unset, NOPTS is rejected)470// 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)
471 472
472// type channels: disallow "auto" (still accept ""), limit list to at most 1 item.473// 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)
474 475
475// type_float/type_double: controls if pretty print should trim trailing zeros476// 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)
477 478
478// Like M_OPT_TYPE_OPTIONAL_PARAM.479// Like M_OPT_TYPE_OPTIONAL_PARAM.
479#define M_OPT_OPTIONAL_PARAM (1 << 30)480#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
111#define OPT_BASE_STRUCT struct mp_vo_opts111#define OPT_BASE_STRUCT struct mp_vo_opts
112 112
113static const m_option_t mp_vo_opt_list[] = {113static 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},
115 {"taskbar-progress", OPT_BOOL(taskbar_progress)},115 {"taskbar-progress", OPT_BOOL(taskbar_progress)},
116 {"drag-and-drop", OPT_CHOICE(drag_and_drop, {"no", -2}, {"auto", -1},116 {"drag-and-drop", OPT_CHOICE(drag_and_drop, {"no", -2}, {"auto", -1},
117 {"replace", DND_REPLACE},117 {"replace", DND_REPLACE},
player/command.c+1−4
@@ -56,7 +56,6 @@ · 55 unmodified lines
56#include "options/m_config_frontend.h"56#include "options/m_config_frontend.h"
57#include "options/parse_configfile.h"57#include "options/parse_configfile.h"
58#include "osdep/getpid.h"58#include "osdep/getpid.h"
59#include "video/out/gpu/context.h"
60#include "video/out/vo.h"59#include "video/out/vo.h"
61#include "video/csputils.h"60#include "video/csputils.h"
62#include "video/hwdec.h"61#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
7380 mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);7379 mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
7381 }7380 }
7382 7381
7383 if (opt_ptr == &opts->vo->video_driver_list ||7382 if (flags & UPDATE_VO) {
7384 opt_ptr == &opts->ra_ctx_opts->context_list ||
7385 opt_ptr == &opts->ra_ctx_opts->context_type_list) {
7386 struct track *track = mpctx->current_track[0][STREAM_VIDEO];7383 struct track *track = mpctx->current_track[0][STREAM_VIDEO];
7387 uninit_video_out(mpctx);7384 uninit_video_out(mpctx);
7388 handle_force_window(mpctx, true);7385 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
216 {0}216 {0}
217 },217 },
218 .size = sizeof(struct ra_ctx_opts),218 .size = sizeof(struct ra_ctx_opts),
219 .change_flags = UPDATE_VO,
219};220};
220 221
221static struct ra_ctx *create_in_contexts(struct vo *vo, const char *name,222static 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