summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-21 15:56:54 +0200
committerwm4 <wm4@nowhere>2016-09-21 17:35:00 +0200
commit75d12c174f0b5bb03c71872241f965ac674221d7 (patch)
tree39fb3f2026bdad9c3daece97183d048bef3b96be /player/command.c
parent14c232bdbfbb16f427632d579430fa1a522f7f73 (diff)
downloadmpv-75d12c174f0b5bb03c71872241f965ac674221d7.tar.bz2
mpv-75d12c174f0b5bb03c71872241f965ac674221d7.tar.xz
options: make input options generally runtime-settable
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 3a496e6de1..4bb26303b1 100644
--- a/player/command.c
+++ b/player/command.c
@@ -97,6 +97,9 @@ struct command_ctx {
int64_t hook_seq; // for hook_handler.seq
struct ao_hotplug *hotplug;
+
+ char *cur_ipc;
+ char *cur_ipc_input;
};
struct overlay {
@@ -5581,6 +5584,7 @@ void mp_notify(struct MPContext *mpctx, int event, void *arg)
void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
{
struct MPContext *mpctx = ctx;
+ struct command_ctx *cmd = mpctx->command_ctx;
if (flags & UPDATE_TERM)
mp_update_logging(mpctx);
@@ -5608,6 +5612,23 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags)
mp_force_video_refresh(mpctx);
}
}
+
+ if (flags & UPDATE_INPUT) {
+ mp_input_update_opts(mpctx->input);
+
+ // Rather coarse change-detection, but sufficient effort.
+ struct MPOpts *opts = mpctx->opts;
+ 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);
+ }
+ }
}
void mp_notify_property(struct MPContext *mpctx, const char *property)