History

command: add an apply-profile command

This will actually update all associated options (which is trivial now with the recent changes).

wm4 committed 10 years ago

Commit cb604d51 parent a3e8ff64 files · +20 −0Browse files

Unified · Split

4 files
  1. DOCS/man/input.rst +8 −0
  2. input/cmd_list.c +2 −0
  3. input/cmd_list.h +2 −0
  4. player/command.c +8 −0
DOCS/man/input.rst+8−0
@@ -691,6 +691,14 @@ Input Commands that are Possibly Subject to Change · 690 unmodified lines
691``af-command "<label>" "<cmd>" "<args>"``691``af-command "<label>" "<cmd>" "<args>"``
692 Same as ``vf-command``, but for audio filters.692 Same as ``vf-command``, but for audio filters.
693 693
694``apply-profile "<name>"``
695 Apply the contents of a named profile. This is like using ``profile=name``
696 in a config file, except you can map it to a key binding to change it at
697 runtime.
698
699 There is no such thing as "unapplying" a profile - applying a profile
700 merely sets all option values listed within the profile.
701
694Undocumented commands: ``tv-last-channel`` (TV/DVB only),702Undocumented commands: ``tv-last-channel`` (TV/DVB only),
695``ao-reload`` (experimental/internal).703``ao-reload`` (experimental/internal).
696 704
input/cmd_list.c+2−0
@@ -224,6 +224,8 @@ const struct mp_cmd_def mp_cmds[] = { · 223 unmodified lines
224 {"reselect", 1})),224 {"reselect", 1})),
225 }},225 }},
226 226
227 { MP_CMD_APPLY_PROFILE, "apply-profile", {ARG_STRING } },
228
227 {0}229 {0}
228};230};
229 231
input/cmd_list.h+2−0
@@ -114,6 +114,8 @@ enum mp_command_type { · 113 unmodified lines
114 114
115 MP_CMD_RESCAN_EXTERNAL_FILES,115 MP_CMD_RESCAN_EXTERNAL_FILES,
116 116
117 MP_CMD_APPLY_PROFILE,
118
117 // Internal119 // Internal
118 MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p120 MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p
119};121};
player/command.c+8−0
@@ -5514,6 +5514,14 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re · 5513 unmodified lines
5514 break;5514 break;
5515 }5515 }
5516 5516
5517 case MP_CMD_APPLY_PROFILE: {
5518 char *profile = cmd->args[0].v.s;
5519 int flags = mpctx->initialized ? M_SETOPT_RUNTIME : 0;
5520 if (m_config_set_profile(mpctx->mconfig, profile, flags) < 0)
5521 return -1;
5522 break;
5523 }
5524
5517 default:5525 default:
5518 MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name);5526 MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name);
5519 return -1;5527 return -1;

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