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
691691 ``af-command "<label>" "<cmd>" "<args>"``
692692 Same as ``vf-command``, but for audio filters.
693693
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+
694702 Undocumented commands: ``tv-last-channel`` (TV/DVB only),
695703 ``ao-reload`` (experimental/internal).
696704
input/cmd_list.c+2−0
@@ -224,6 +224,8 @@ const struct mp_cmd_def mp_cmds[] = { · 223 unmodified lines
224224 {"reselect", 1})),
225225 }},
226226
227+ { MP_CMD_APPLY_PROFILE, "apply-profile", {ARG_STRING } },
228+
227229 {0}
228230 };
229231
input/cmd_list.h+2−0
@@ -114,6 +114,8 @@ enum mp_command_type { · 113 unmodified lines
114114
115115 MP_CMD_RESCAN_EXTERNAL_FILES,
116116
117+ MP_CMD_APPLY_PROFILE,
118+
117119 // Internal
118120 MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p
119121 };
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
55145514 break;
55155515 }
55165516
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+
55175525 default:
55185526 MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name);
55195527 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