This will actually update all associated options (which is trivial now with the recent changes).
Unified · Split
| @@ -691,6 +691,14 @@ Input Commands that are Possibly Subject to Change · 690 unmodified lines | ||
| 691 | 691 | ``af-command "<label>" "<cmd>" "<args>"`` |
| 692 | 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 | + | |
| 694 | 702 | Undocumented commands: ``tv-last-channel`` (TV/DVB only), |
| 695 | 703 | ``ao-reload`` (experimental/internal). |
| 696 | 704 | |
| @@ -224,6 +224,8 @@ const struct mp_cmd_def mp_cmds[] = { · 223 unmodified lines | ||
| 224 | 224 | {"reselect", 1})), |
| 225 | 225 | }}, |
| 226 | 226 | |
| 227 | + { MP_CMD_APPLY_PROFILE, "apply-profile", {ARG_STRING } }, | |
| 228 | + | |
| 227 | 229 | {0} |
| 228 | 230 | }; |
| 229 | 231 | |
| @@ -114,6 +114,8 @@ enum mp_command_type { · 113 unmodified lines | ||
| 114 | 114 | |
| 115 | 115 | MP_CMD_RESCAN_EXTERNAL_FILES, |
| 116 | 116 | |
| 117 | + MP_CMD_APPLY_PROFILE, | |
| 118 | + | |
| 117 | 119 | // Internal |
| 118 | 120 | MP_CMD_COMMAND_LIST, // list of sub-commands in args[0].v.p |
| 119 | 121 | }; |
| @@ -5514,6 +5514,14 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re · 5513 unmodified lines | ||
| 5514 | 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 | 5525 | default: |
| 5518 | 5526 | MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name); |
| 5519 | 5527 | return -1; |