mirror of https://github.com/mpv-player/mpv
commands: add print_text input command to print text on the terminal
In theory, this could take over the role of the get_property slave command, and is more general.
This commit is contained in:
parent
c9df2c8bd8
commit
32fe890cc1
|
@ -160,6 +160,10 @@ osd [<level>]
|
|||
Toggle OSD level. If <level> is specified, set the OSD mode
|
||||
(see ``--osd-level`` for valid values).
|
||||
|
||||
print_text "<string>"
|
||||
Print text to stdout. The string can contain properties, which are expanded
|
||||
like in ``--playing-msg``.
|
||||
|
||||
show_text "<string>" [<duration>] [<level>]
|
||||
Show text on the OSD. The string can contain properties, which are expanded
|
||||
like in ``--playing-msg``. This can be used to show playback time, filename,
|
||||
|
|
|
@ -1936,6 +1936,15 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
break;
|
||||
}
|
||||
|
||||
case MP_CMD_PRINT_TEXT: {
|
||||
char *txt = mp_property_expand_string(mpctx, cmd->args[0].v.s);
|
||||
if (txt) {
|
||||
mp_msg(MSGT_GLOBAL, MSGL_INFO, "%s\n", txt);
|
||||
talloc_free(txt);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MP_CMD_SHOW_TEXT: {
|
||||
char *txt = mp_property_expand_string(mpctx, cmd->args[0].v.s);
|
||||
if (txt) {
|
||||
|
|
|
@ -132,6 +132,7 @@ static const mp_cmd_t mp_cmds[] = {
|
|||
}},
|
||||
{ MP_CMD_SUB_STEP, "sub_step", { ARG_INT } },
|
||||
{ MP_CMD_OSD, "osd", { OARG_INT(-1) } },
|
||||
{ MP_CMD_PRINT_TEXT, "print_text", { ARG_STRING } },
|
||||
{ MP_CMD_SHOW_TEXT, "show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
|
||||
{ MP_CMD_SHOW_PROGRESS, "show_progress", },
|
||||
{ MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } },
|
||||
|
|
|
@ -51,6 +51,7 @@ enum mp_command_type {
|
|||
MP_CMD_KEYDOWN_EVENTS,
|
||||
MP_CMD_SET,
|
||||
MP_CMD_GET_PROPERTY,
|
||||
MP_CMD_PRINT_TEXT,
|
||||
MP_CMD_SHOW_TEXT,
|
||||
MP_CMD_SHOW_PROGRESS,
|
||||
MP_CMD_RADIO_STEP_CHANNEL,
|
||||
|
|
Loading…
Reference in New Issue