command: add commands to enable/disable input sections

For now, it's mostly for testing. It also might allow to create key
binding state machines, but this sounds questionable.
This commit is contained in:
wm4 2013-06-23 01:28:28 +02:00
parent 776e2893a2
commit fc422f5aeb
4 changed files with 34 additions and 0 deletions

View File

@ -266,6 +266,21 @@ vf set|add|toggle|del "filter1=params,filter2,..."
- ``b vf set ""`` remove all video filters on ``b``
- ``c vf toggle lavfi=gradfun`` toggle debanding on ``c``
enable_section "<section>" [default|exclusive]
Enable all key bindings in the named input section.
The enabled input sections form a stack. Bindings in sections on the top of
the stack are preferred to lower sections. This command puts the section
on top of the stack. If the section was already on the stack, it's
implicitly removed beforehand. (A section can't be on the stack twice.)
If ``exclusive`` is specified as second argument, all sections below the
newly enabled section are disabled. They will be re-enabled as soon as
all exclusive above them are removed.
disable_section "<section>"
Disable the named input section. Undoes ``enable_section``.
Undocumented commands: tv_start_scan, tv_step_channel, tv_step_norm,
tv_step_chanlist, tv_set_channel, tv_last_channel, tv_set_freq, tv_step_freq,
tv_set_norm, dvb_set_channel, radio_step_channel, radio_set_channel,

View File

@ -2412,6 +2412,15 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
mplayer_put_key(mpctx->key_fifo, cmd->args[0].v.i);
break;
case MP_CMD_ENABLE_INPUT_SECTION:
mp_input_enable_section(mpctx->input, cmd->args[0].v.s,
cmd->args[1].v.i == 1 ? MP_INPUT_EXCLUSIVE : 0);
break;
case MP_CMD_DISABLE_INPUT_SECTION:
mp_input_disable_section(mpctx->input, cmd->args[0].v.s);
break;
case MP_CMD_VO_CMDLINE:
if (mpctx->video_out) {
char *s = cmd->args[0].v.s;

View File

@ -194,6 +194,13 @@ static const mp_cmd_t mp_cmds[] = {
.v.f = 1 },
}},
{ MP_CMD_ENABLE_INPUT_SECTION, "enable_section", {
ARG_STRING,
OARG_CHOICE(0, ({"default", 0},
{"exclusive", 1})),
}},
{ MP_CMD_DISABLE_INPUT_SECTION, "disable_section", { ARG_STRING } },
{ MP_CMD_AF_SWITCH, "af_switch", { ARG_STRING } },
{ MP_CMD_AF_ADD, "af_add", { ARG_STRING } },
{ MP_CMD_AF_DEL, "af_del", { ARG_STRING } },

View File

@ -67,6 +67,9 @@ enum mp_command_type {
MP_CMD_TV_START_SCAN,
MP_CMD_STOP,
MP_CMD_ENABLE_INPUT_SECTION,
MP_CMD_DISABLE_INPUT_SECTION,
/// DVB commands
MP_CMD_DVB_SET_CHANNEL = 5101,