summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-17 22:06:29 +0100
committerwm4 <wm4@nowhere>2019-12-17 23:06:10 +0100
commite75d28effd324d9383ee92304f2eba9a4f0d13c6 (patch)
tree19fc3758248ad47edbb2a25984c5bf092cf0dad6 /player
parentdf7d5a1689e6f39c00e6ff86829921d1fa6db095 (diff)
downloadmpv-e75d28effd324d9383ee92304f2eba9a4f0d13c6.tar.bz2
mpv-e75d28effd324d9383ee92304f2eba9a4f0d13c6.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/command.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/player/command.c b/player/command.c
index b31b42e9bc..81b1bb810c 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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)