mirror of https://github.com/mpv-player/mpv
command: slightly simplify input-ipc-server change detection/init
The generic change detection now handles this just as well. The way how this function is manually called at init is slightly gross. Make that part slightly more explicit to hopefully avoid confusion.
This commit is contained in:
parent
df7d5a1689
commit
e75d28effd
|
@ -702,9 +702,9 @@ static const m_option_t mp_opts[] = {
|
|||
|
||||
OPT_FLAG("input-terminal", consolecontrols, UPDATE_TERM),
|
||||
|
||||
OPT_STRING("input-file", input_file, M_OPT_FILE | UPDATE_INPUT,
|
||||
OPT_STRING("input-file", input_file, M_OPT_FILE,
|
||||
.deprecation_message = "use --input-ipc-server"),
|
||||
OPT_STRING("input-ipc-server", ipc_path, M_OPT_FILE | UPDATE_INPUT),
|
||||
OPT_STRING("input-ipc-server", ipc_path, M_OPT_FILE),
|
||||
|
||||
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, screenshot_conf, 0),
|
||||
OPT_STRING("screenshot-template", screenshot_template, 0),
|
||||
|
|
|
@ -101,9 +101,6 @@ struct command_ctx {
|
|||
|
||||
struct ao_hotplug *hotplug;
|
||||
|
||||
char *cur_ipc;
|
||||
char *cur_ipc_input;
|
||||
|
||||
struct mp_cmd_ctx *cache_dump_cmd; // in progress cache dumping
|
||||
};
|
||||
|
||||
|
@ -5964,8 +5961,8 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
|
|||
{
|
||||
struct MPContext *mpctx = ctx;
|
||||
struct MPOpts *opts = mpctx->opts;
|
||||
struct command_ctx *cmd = mpctx->command_ctx;
|
||||
void *opt_ptr = co ? co->data : NULL; // NULL on start
|
||||
bool init = !co;
|
||||
void *opt_ptr = init ? NULL : co->data; // NULL on start
|
||||
|
||||
if (co)
|
||||
mp_notify_property(mpctx, co->name);
|
||||
|
@ -6001,20 +5998,12 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
|
|||
}
|
||||
}
|
||||
|
||||
if (flags & UPDATE_INPUT) {
|
||||
if (flags & UPDATE_INPUT)
|
||||
mp_input_update_opts(mpctx->input);
|
||||
|
||||
// Rather coarse change-detection, but sufficient effort.
|
||||
if (!bstr_equals(bstr0(cmd->cur_ipc), bstr0(opts->ipc_path)) ||
|
||||
!bstr_equals(bstr0(cmd->cur_ipc_input), bstr0(opts->input_file)))
|
||||
{
|
||||
talloc_free(cmd->cur_ipc);
|
||||
talloc_free(cmd->cur_ipc_input);
|
||||
cmd->cur_ipc = talloc_strdup(cmd, opts->ipc_path);
|
||||
cmd->cur_ipc_input = talloc_strdup(cmd, opts->input_file);
|
||||
mp_uninit_ipc(mpctx->ipc_ctx);
|
||||
mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
|
||||
}
|
||||
if (init || opt_ptr == &opts->ipc_path || opt_ptr == &opts->input_file) {
|
||||
mp_uninit_ipc(mpctx->ipc_ctx);
|
||||
mpctx->ipc_ctx = mp_init_ipc(mpctx->clients, mpctx->global);
|
||||
}
|
||||
|
||||
if (flags & UPDATE_AUDIO)
|
||||
|
|
Loading…
Reference in New Issue