mirror of
https://github.com/mpv-player/mpv
synced 2025-01-31 04:02:06 +00:00
command: add an apply-profile command
This will actually update all associated options (which is trivial now with the recent changes).
This commit is contained in:
parent
a3e8ff624c
commit
cb604d5412
@ -691,6 +691,14 @@ Input Commands that are Possibly Subject to Change
|
||||
``af-command "<label>" "<cmd>" "<args>"``
|
||||
Same as ``vf-command``, but for audio filters.
|
||||
|
||||
``apply-profile "<name>"``
|
||||
Apply the contents of a named profile. This is like using ``profile=name``
|
||||
in a config file, except you can map it to a key binding to change it at
|
||||
runtime.
|
||||
|
||||
There is no such thing as "unapplying" a profile - applying a profile
|
||||
merely sets all option values listed within the profile.
|
||||
|
||||
Undocumented commands: ``tv-last-channel`` (TV/DVB only),
|
||||
``ao-reload`` (experimental/internal).
|
||||
|
||||
|
@ -224,6 +224,8 @@ const struct mp_cmd_def mp_cmds[] = {
|
||||
{"reselect", 1})),
|
||||
}},
|
||||
|
||||
{ MP_CMD_APPLY_PROFILE, "apply-profile", {ARG_STRING } },
|
||||
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -114,6 +114,8 @@ enum mp_command_type {
|
||||
|
||||
MP_CMD_RESCAN_EXTERNAL_FILES,
|
||||
|
||||
MP_CMD_APPLY_PROFILE,
|
||||
|
||||
// Internal
|
||||
MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p
|
||||
};
|
||||
|
@ -5514,6 +5514,14 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re
|
||||
break;
|
||||
}
|
||||
|
||||
case MP_CMD_APPLY_PROFILE: {
|
||||
char *profile = cmd->args[0].v.s;
|
||||
int flags = mpctx->initialized ? M_SETOPT_RUNTIME : 0;
|
||||
if (m_config_set_profile(mpctx->mconfig, profile, flags) < 0)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user