mirror of https://github.com/mpv-player/mpv
commands: rename osd_show_[property_]text and osd_show_progression
osd_show_[property_]text => show_text osd_show_progression => show_progress show_text, osd_show_property_text and osd_show_text both map to the code for the previous osd_show_property_text. The only special thing about osd_show_text is that you don't need to escape "$". Also, unfortunately osd_show_property_text requires escaping things twice, one time for the command parser, and the other time for the property formatting code, while osd_show_text needed only one level of escaping.
This commit is contained in:
parent
950999dd7b
commit
a749c61437
14
command.c
14
command.c
|
@ -2313,22 +2313,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case MP_CMD_OSD_SHOW_TEXT:
|
case MP_CMD_SHOW_TEXT: {
|
||||||
set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
|
|
||||||
(cmd->args[1].v.i <
|
|
||||||
0 ? osd_duration : cmd->args[1].v.i),
|
|
||||||
"%s", cmd->args[0].v.s);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MP_CMD_OSD_SHOW_PROPERTY_TEXT: {
|
|
||||||
char *txt = m_properties_expand_string(mp_properties,
|
char *txt = m_properties_expand_string(mp_properties,
|
||||||
cmd->args[0].v.s,
|
cmd->args[0].v.s,
|
||||||
mpctx);
|
mpctx);
|
||||||
// if no argument supplied use default osd_duration, else <arg> ms.
|
// if no argument supplied use default osd_duration, else <arg> ms.
|
||||||
if (txt) {
|
if (txt) {
|
||||||
set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
|
set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
|
||||||
(cmd->args[1].v.i <
|
(cmd->args[1].v.i < 0 ? osd_duration : cmd->args[1].v.i),
|
||||||
0 ? osd_duration : cmd->args[1].v.i),
|
|
||||||
"%s", txt);
|
"%s", txt);
|
||||||
free(txt);
|
free(txt);
|
||||||
}
|
}
|
||||||
|
@ -2392,7 +2384,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||||
mpctx->stop_play = PT_STOP;
|
mpctx->stop_play = PT_STOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_CMD_OSD_SHOW_PROGRESSION:
|
case MP_CMD_SHOW_PROGRESS:
|
||||||
mp_show_osd_progression(mpctx);
|
mp_show_osd_progression(mpctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,8 @@ SPACE switch pause
|
||||||
ENTER playlist_next 1 # skip to next file or quit
|
ENTER playlist_next 1 # skip to next file or quit
|
||||||
< playlist_prev # skip to previous file
|
< playlist_prev # skip to previous file
|
||||||
o osd # cycle through OSD mode
|
o osd # cycle through OSD mode
|
||||||
I osd_show_property_text "${filename}" # display filename in osd
|
I show_text "${filename}" # display filename in osd
|
||||||
P osd_show_progression
|
P show_progress
|
||||||
z switch sub-delay -0.1 # subtract 100 ms delay from subs
|
z switch sub-delay -0.1 # subtract 100 ms delay from subs
|
||||||
x switch sub-delay +0.1 # add
|
x switch sub-delay +0.1 # add
|
||||||
g sub_step -1 # immediately display next subtitle
|
g sub_step -1 # immediately display next subtitle
|
||||||
|
|
|
@ -109,9 +109,8 @@ static const mp_cmd_t mp_cmds[] = {
|
||||||
{ MP_CMD_PLAYLIST_PREV, "playlist_prev", { OARG_INT(0) } },
|
{ MP_CMD_PLAYLIST_PREV, "playlist_prev", { OARG_INT(0) } },
|
||||||
{ MP_CMD_SUB_STEP, "sub_step", { ARG_INT, OARG_INT(0) } },
|
{ MP_CMD_SUB_STEP, "sub_step", { ARG_INT, OARG_INT(0) } },
|
||||||
{ MP_CMD_OSD, "osd", { OARG_INT(-1) } },
|
{ MP_CMD_OSD, "osd", { OARG_INT(-1) } },
|
||||||
{ MP_CMD_OSD_SHOW_TEXT, "osd_show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
|
{ MP_CMD_SHOW_TEXT, "show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
|
||||||
{ MP_CMD_OSD_SHOW_PROPERTY_TEXT, "osd_show_property_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
|
{ MP_CMD_SHOW_PROGRESS, "show_progress", },
|
||||||
{ MP_CMD_OSD_SHOW_PROGRESSION, "osd_show_progression", },
|
|
||||||
{ MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } },
|
{ MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } },
|
||||||
#ifdef CONFIG_TV
|
#ifdef CONFIG_TV
|
||||||
{ MP_CMD_TV_START_SCAN, "tv_start_scan", },
|
{ MP_CMD_TV_START_SCAN, "tv_start_scan", },
|
||||||
|
@ -197,6 +196,9 @@ static const struct legacy_cmd legacy_cmds[] = {
|
||||||
{"set_property", "no-osd set"},
|
{"set_property", "no-osd set"},
|
||||||
{"set_property_osd", "set"},
|
{"set_property_osd", "set"},
|
||||||
{"speed_set", "set speed"},
|
{"speed_set", "set speed"},
|
||||||
|
{"osd_show_text", "show_text"},
|
||||||
|
{"osd_show_property_text", "show_text"},
|
||||||
|
{"osd_show_progression", "show_progress"},
|
||||||
// Approximate
|
// Approximate
|
||||||
{"pt_step 1", "playlist_next"},
|
{"pt_step 1", "playlist_next"},
|
||||||
{"pt_step -1", "playlist_prev"},
|
{"pt_step -1", "playlist_prev"},
|
||||||
|
|
|
@ -39,7 +39,6 @@ enum mp_command_type {
|
||||||
MP_CMD_TV_SET_CHANNEL,
|
MP_CMD_TV_SET_CHANNEL,
|
||||||
MP_CMD_EDL_MARK,
|
MP_CMD_EDL_MARK,
|
||||||
MP_CMD_TV_LAST_CHANNEL,
|
MP_CMD_TV_LAST_CHANNEL,
|
||||||
MP_CMD_OSD_SHOW_TEXT,
|
|
||||||
MP_CMD_TV_SET_FREQ,
|
MP_CMD_TV_SET_FREQ,
|
||||||
MP_CMD_TV_SET_NORM,
|
MP_CMD_TV_SET_NORM,
|
||||||
MP_CMD_SWITCH_RATIO,
|
MP_CMD_SWITCH_RATIO,
|
||||||
|
@ -50,8 +49,8 @@ enum mp_command_type {
|
||||||
MP_CMD_KEYDOWN_EVENTS,
|
MP_CMD_KEYDOWN_EVENTS,
|
||||||
MP_CMD_SET,
|
MP_CMD_SET,
|
||||||
MP_CMD_GET_PROPERTY,
|
MP_CMD_GET_PROPERTY,
|
||||||
MP_CMD_OSD_SHOW_PROPERTY_TEXT,
|
MP_CMD_SHOW_TEXT,
|
||||||
MP_CMD_OSD_SHOW_PROGRESSION,
|
MP_CMD_SHOW_PROGRESS,
|
||||||
MP_CMD_RADIO_STEP_CHANNEL,
|
MP_CMD_RADIO_STEP_CHANNEL,
|
||||||
MP_CMD_RADIO_SET_CHANNEL,
|
MP_CMD_RADIO_SET_CHANNEL,
|
||||||
MP_CMD_RADIO_SET_FREQ,
|
MP_CMD_RADIO_SET_FREQ,
|
||||||
|
|
Loading…
Reference in New Issue