mirror of https://github.com/mpv-player/mpv
commands: change input commands to make OSD usage explicit
Most input commands had their own policy whether to display an OSD message for user feedback or not. Some commands had two variants, one that showed an OSD message and one that didn't (e.g. step_property_osd and step_property). Change it such that all commands show a message on the OSD. Add a "no-osd" modifier that disables OSD for that command. Rename the "step_property" and "step_property_osd" command to "switch", and rename "set_property" and "set_property_osd" to "set". Note that commands which haven't used OSD before still don't use OSD. That will possibly be fixed later. (E.g. "screenshot" could display an OSD message instead of just printing a message on the terminal.) The chapter and edition properties still produce OSD messages even with "no-osd", because they don't map so well to the property_osd_display[] mechanism.
This commit is contained in:
parent
6096966dee
commit
a668ae0ff9
68
command.c
68
command.c
|
@ -558,7 +558,6 @@ static int mp_property_editions(m_option_t *prop, int action, void *arg,
|
|||
static int mp_property_angle(m_option_t *prop, int action, void *arg,
|
||||
MPContext *mpctx)
|
||||
{
|
||||
struct MPOpts *opts = &mpctx->opts;
|
||||
struct demuxer *demuxer = mpctx->master_demuxer;
|
||||
int angle = -1;
|
||||
int angles;
|
||||
|
@ -618,8 +617,6 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
|
|||
resync_audio_stream(sh_audio);
|
||||
}
|
||||
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration,
|
||||
"Angle: %d/%d", angle, angles);
|
||||
return M_PROPERTY_OK;
|
||||
}
|
||||
|
||||
|
@ -1897,6 +1894,7 @@ static struct property_osd_display {
|
|||
{ "saturation", _("Saturation"), .osd_progbar = OSD_SATURATION },
|
||||
{ "hue", _("Hue"), .osd_progbar = OSD_HUE },
|
||||
{ "vsync", _("VSync: %s") },
|
||||
{ "angle", _("Angle: %s") },
|
||||
// subs
|
||||
{ "sub", _("Subtitles: %s") },
|
||||
{ "sub_pos", _("Sub position: %s/100") },
|
||||
|
@ -2065,31 +2063,32 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
sh_audio_t *const sh_audio = mpctx->sh_audio;
|
||||
sh_video_t *const sh_video = mpctx->sh_video;
|
||||
int osd_duration = opts->osd_duration;
|
||||
int osdl = cmd->on_osd ? 1 : OSD_LEVEL_INVISIBLE;
|
||||
int case_fallthrough_hack = 0;
|
||||
switch (cmd->id) {
|
||||
case MP_CMD_SEEK: {
|
||||
mpctx->add_osd_seek_info = true;
|
||||
float v = cmd->args[0].v.f;
|
||||
int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
|
||||
int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0;
|
||||
int function;
|
||||
if (abs == 2) { // Absolute seek to a timestamp in seconds
|
||||
queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact);
|
||||
mpctx->osd_function = v > get_current_time(mpctx) ?
|
||||
OSD_FFW : OSD_REW;
|
||||
function = v > get_current_time(mpctx) ? OSD_FFW : OSD_REW;
|
||||
} else if (abs) { /* Absolute seek by percentage */
|
||||
queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact);
|
||||
mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
|
||||
function = OSD_FFW; // Direction isn't set correctly
|
||||
} else {
|
||||
queue_seek(mpctx, MPSEEK_RELATIVE, v, exact);
|
||||
mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW;
|
||||
function = (v > 0) ? OSD_FFW : OSD_REW;
|
||||
}
|
||||
if (cmd->on_osd) {
|
||||
mpctx->add_osd_seek_info = true;
|
||||
mpctx->osd_function = function;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MP_CMD_SET_PROPERTY_OSD:
|
||||
case_fallthrough_hack = 1;
|
||||
|
||||
case MP_CMD_SET_PROPERTY: {
|
||||
case MP_CMD_SET: {
|
||||
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE,
|
||||
cmd->args[1].v.s, mpctx);
|
||||
if (r == M_PROPERTY_UNKNOWN)
|
||||
|
@ -2099,7 +2098,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
||||
"Failed to set property '%s' to '%s'.\n",
|
||||
cmd->args[0].v.s, cmd->args[1].v.s);
|
||||
else if (case_fallthrough_hack)
|
||||
else if (cmd->on_osd)
|
||||
show_property_osd(mpctx, cmd->args[0].v.s);
|
||||
if (r <= 0)
|
||||
mp_msg(MSGT_GLOBAL, MSGL_INFO,
|
||||
|
@ -2107,10 +2106,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
break;
|
||||
}
|
||||
|
||||
case MP_CMD_STEP_PROPERTY_OSD:
|
||||
case_fallthrough_hack = 1;
|
||||
|
||||
case MP_CMD_STEP_PROPERTY: {
|
||||
case MP_CMD_SWITCH: {
|
||||
void *arg = NULL;
|
||||
int r, i;
|
||||
double d;
|
||||
|
@ -2149,7 +2145,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
||||
"Failed to increment property '%s' by %f.\n",
|
||||
cmd->args[0].v.s, cmd->args[1].v.f);
|
||||
else if (case_fallthrough_hack)
|
||||
else if (cmd->on_osd)
|
||||
show_property_osd(mpctx, cmd->args[0].v.s);
|
||||
if (r <= 0)
|
||||
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n",
|
||||
|
@ -2209,7 +2205,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
case MP_CMD_SPEED_INCR: {
|
||||
float v = cmd->args[0].v.f;
|
||||
mp_property_do("speed", M_PROPERTY_STEP_UP, &v, mpctx);
|
||||
show_property_osd(mpctx, "speed");
|
||||
if (cmd->on_osd)
|
||||
show_property_osd(mpctx, "speed");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2221,7 +2218,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
if (case_fallthrough_hack)
|
||||
v *= mpctx->opts.playback_speed;
|
||||
mp_property_do("speed", M_PROPERTY_SET, &v, mpctx);
|
||||
show_property_osd(mpctx, "speed");
|
||||
if (cmd->on_osd)
|
||||
show_property_osd(mpctx, "speed");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2267,7 +2265,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
}
|
||||
#endif
|
||||
if (available)
|
||||
set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, 1, osd_duration,
|
||||
set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, osdl, osd_duration,
|
||||
"Sub delay: %d ms", ROUND(sub_delay * 1000));
|
||||
}
|
||||
break;
|
||||
|
@ -2282,9 +2280,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
opts->osd_level = (opts->osd_level + 1) % (max + 1);
|
||||
else
|
||||
opts->osd_level = v > max ? max : v;
|
||||
/* Show OSD state when disabled, but not when an explicit
|
||||
argument is given to the OSD command, i.e. in slave mode. */
|
||||
if (v == -1 && opts->osd_level <= 1)
|
||||
if (cmd->on_osd && opts->osd_level <= 1)
|
||||
set_osd_tmsg(mpctx, OSD_MSG_OSD_STATUS, 0, osd_duration,
|
||||
"OSD: %s",
|
||||
opts->osd_level ? mp_gtext("enabled") :
|
||||
|
@ -2386,7 +2382,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
else
|
||||
radio_step_channel(mpctx->stream, RADIO_CHANNEL_LOWER);
|
||||
if (radio_get_channel_name(mpctx->stream)) {
|
||||
set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
|
||||
set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration,
|
||||
"Channel: %s",
|
||||
radio_get_channel_name(mpctx->stream));
|
||||
}
|
||||
|
@ -2397,7 +2393,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
if (mpctx->stream && mpctx->stream->type == STREAMTYPE_RADIO) {
|
||||
radio_set_channel(mpctx->stream, cmd->args[0].v.s);
|
||||
if (radio_get_channel_name(mpctx->stream)) {
|
||||
set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
|
||||
set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration,
|
||||
"Channel: %s",
|
||||
radio_get_channel_name(mpctx->stream));
|
||||
}
|
||||
|
@ -2426,7 +2422,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
#ifdef CONFIG_PVR
|
||||
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
|
||||
pvr_set_freq(mpctx->stream, ROUND(cmd->args[0].v.f));
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
|
||||
pvr_get_current_channelname(mpctx->stream),
|
||||
pvr_get_current_stationname(mpctx->stream));
|
||||
}
|
||||
|
@ -2439,7 +2435,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
#ifdef CONFIG_PVR
|
||||
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
|
||||
pvr_force_freq_step(mpctx->stream, ROUND(cmd->args[0].v.f));
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: f %d",
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: f %d",
|
||||
pvr_get_current_channelname(mpctx->stream),
|
||||
pvr_get_current_frequency(mpctx->stream));
|
||||
}
|
||||
|
@ -2460,7 +2456,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
tv_step_channel(get_tvh(mpctx), TV_CHANNEL_LOWER);
|
||||
}
|
||||
if (tv_channel_list) {
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
|
||||
"Channel: %s", tv_channel_current->name);
|
||||
//vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
}
|
||||
|
@ -2469,7 +2465,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
else if (mpctx->stream &&
|
||||
mpctx->stream->type == STREAMTYPE_PVR) {
|
||||
pvr_set_channel_step(mpctx->stream, cmd->args[0].v.i);
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
|
||||
pvr_get_current_channelname(mpctx->stream),
|
||||
pvr_get_current_stationname(mpctx->stream));
|
||||
}
|
||||
|
@ -2498,7 +2494,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
if (get_tvh(mpctx)) {
|
||||
tv_set_channel(get_tvh(mpctx), cmd->args[0].v.s);
|
||||
if (tv_channel_list) {
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
|
||||
"Channel: %s", tv_channel_current->name);
|
||||
//vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
}
|
||||
|
@ -2506,7 +2502,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
#ifdef CONFIG_PVR
|
||||
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
|
||||
pvr_set_channel(mpctx->stream, cmd->args[0].v.s);
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
|
||||
pvr_get_current_channelname(mpctx->stream),
|
||||
pvr_get_current_stationname(mpctx->stream));
|
||||
}
|
||||
|
@ -2531,7 +2527,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
if (get_tvh(mpctx)) {
|
||||
tv_last_channel(get_tvh(mpctx));
|
||||
if (tv_channel_list) {
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
|
||||
set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
|
||||
"Channel: %s", tv_channel_current->name);
|
||||
//vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
}
|
||||
|
@ -2539,7 +2535,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
#ifdef CONFIG_PVR
|
||||
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
|
||||
pvr_set_lastchannel(mpctx->stream);
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
|
||||
set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
|
||||
pvr_get_current_channelname(mpctx->stream),
|
||||
pvr_get_current_stationname(mpctx->stream));
|
||||
}
|
||||
|
@ -2599,9 +2595,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
|||
mp_msg(MSGT_CPLAYER, MSGL_INFO, "Setting vo cmd line to '%s'.\n",
|
||||
s);
|
||||
if (vo_control(mpctx->video_out, VOCTRL_SET_COMMAND_LINE, s) > 0) {
|
||||
set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "vo='%s'", s);
|
||||
set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "vo='%s'", s);
|
||||
} else {
|
||||
set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "Failed!");
|
||||
set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "Failed!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -138,11 +138,9 @@ static const mp_cmd_t mp_cmds[] = {
|
|||
{ MP_CMD_RUN, "run", { ARG_STRING } },
|
||||
|
||||
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", { ARG_INT } },
|
||||
{ MP_CMD_SET_PROPERTY, "set_property", { ARG_STRING, ARG_STRING } },
|
||||
{ MP_CMD_SET_PROPERTY_OSD, "set_property_osd", { ARG_STRING, ARG_STRING } },
|
||||
{ MP_CMD_SET, "set", { ARG_STRING, ARG_STRING } },
|
||||
{ MP_CMD_GET_PROPERTY, "get_property", { ARG_STRING } },
|
||||
{ MP_CMD_STEP_PROPERTY, "step_property", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } },
|
||||
{ MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } },
|
||||
{ MP_CMD_SWITCH, "switch", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } },
|
||||
|
||||
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", { ARG_INT, ARG_INT } },
|
||||
|
||||
|
@ -164,40 +162,44 @@ static const mp_cmd_t mp_cmds[] = {
|
|||
struct legacy_cmd {
|
||||
const char *old, *new;
|
||||
};
|
||||
#define LEGACY_STEP(old) {old, "step_property_osd " old}
|
||||
#define LEGACY_STEP(old) {old, "switch " old}
|
||||
static const struct legacy_cmd legacy_cmds[] = {
|
||||
LEGACY_STEP("loop"),
|
||||
{"seek_chapter", "step_property_osd chapter"},
|
||||
{"switch_angle", "step_property_osd angle"},
|
||||
{"seek_chapter", "switch chapter"},
|
||||
{"switch_angle", "switch angle"},
|
||||
LEGACY_STEP("pause"),
|
||||
LEGACY_STEP("volume"),
|
||||
LEGACY_STEP("mute"),
|
||||
LEGACY_STEP("audio_delay"),
|
||||
LEGACY_STEP("switch_audio"),
|
||||
LEGACY_STEP("balance"),
|
||||
{"vo_fullscreen", "step_property fullscreen"},
|
||||
{"vo_fullscreen", "no-osd switch fullscreen"},
|
||||
LEGACY_STEP("panscan"),
|
||||
{"vo_ontop", "step_property_osd ontop"},
|
||||
{"vo_rootwin", "step_property_osd rootwin"},
|
||||
{"vo_border", "step_property_osd border"},
|
||||
{"frame_drop", "step_property_osd framedropping"},
|
||||
{"vo_ontop", "switch ontop"},
|
||||
{"vo_rootwin", "switch rootwin"},
|
||||
{"vo_border", "switch border"},
|
||||
{"frame_drop", "switch framedropping"},
|
||||
LEGACY_STEP("gamma"),
|
||||
LEGACY_STEP("brightness"),
|
||||
LEGACY_STEP("contrast"),
|
||||
LEGACY_STEP("saturation"),
|
||||
LEGACY_STEP("hue"),
|
||||
{"switch_vsync", "step_property_osd vsync"},
|
||||
{"sub_select", "step_property_osd sub"},
|
||||
{"switch_vsync", "switch vsync"},
|
||||
{"sub_select", "switch sub"},
|
||||
LEGACY_STEP("sub_pos"),
|
||||
LEGACY_STEP("sub_delay"),
|
||||
LEGACY_STEP("sub_visibility"),
|
||||
{"forced_subs_only", "step_property_osd sub_forced_only"},
|
||||
{"forced_subs_only", "switch sub_forced_only"},
|
||||
LEGACY_STEP("sub_scale"),
|
||||
LEGACY_STEP("ass_use_margins"),
|
||||
{"tv_set_brightness", "tv_brightness"},
|
||||
{"tv_set_hue", "tv_hue"},
|
||||
{"tv_set_saturation", "tv_saturation"},
|
||||
{"tv_set_contrast", "tv_contrast"},
|
||||
{"step_property_osd", "switch"},
|
||||
{"step_property", "no-osd switch"},
|
||||
{"set_property", "no-osd set"},
|
||||
{"set_property_osd", "set"},
|
||||
{"pt_step 1", "playlist_next"},
|
||||
{"pt_step -1", "playlist_prev"},
|
||||
{0}
|
||||
|
@ -686,18 +688,31 @@ int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static char *skip_ws(char *str)
|
||||
{
|
||||
while (str[0] == ' ' || str[0] == '\t')
|
||||
++str;
|
||||
return str;
|
||||
}
|
||||
|
||||
static char *skip_no_ws(char *str)
|
||||
{
|
||||
while (str[0] && !(str[0] == ' ' || str[0] == '\t'))
|
||||
++str;
|
||||
return str;
|
||||
}
|
||||
|
||||
mp_cmd_t *mp_input_parse_cmd(char *str)
|
||||
{
|
||||
int i, l;
|
||||
int pausing = 0;
|
||||
int on_osd = MP_ON_OSD_AUTO;
|
||||
char *ptr;
|
||||
const mp_cmd_t *cmd_def;
|
||||
mp_cmd_t *cmd = NULL;
|
||||
void *tmp = NULL;
|
||||
|
||||
// Ignore heading spaces.
|
||||
while (str[0] == ' ' || str[0] == '\t')
|
||||
++str;
|
||||
str = skip_ws(str);
|
||||
|
||||
if (strncmp(str, "pausing ", 8) == 0) {
|
||||
pausing = 1;
|
||||
|
@ -713,6 +728,8 @@ mp_cmd_t *mp_input_parse_cmd(char *str)
|
|||
str = &str[19];
|
||||
}
|
||||
|
||||
str = skip_ws(str);
|
||||
|
||||
for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) {
|
||||
size_t old_len = strlen(entry->old);
|
||||
if (strncasecmp(entry->old, str, old_len) == 0) {
|
||||
|
@ -725,7 +742,14 @@ mp_cmd_t *mp_input_parse_cmd(char *str)
|
|||
}
|
||||
}
|
||||
|
||||
ptr = str + strcspn(str, "\t ");
|
||||
str = skip_ws(str);
|
||||
|
||||
if (strncmp(str, "no-osd ", 7) == 0) {
|
||||
on_osd = MP_ON_OSD_NO;
|
||||
str = &str[7];
|
||||
}
|
||||
|
||||
ptr = skip_no_ws(str);
|
||||
if (*ptr != 0)
|
||||
l = ptr - str;
|
||||
else
|
||||
|
@ -735,7 +759,8 @@ mp_cmd_t *mp_input_parse_cmd(char *str)
|
|||
goto error;
|
||||
|
||||
for (i = 0; mp_cmds[i].name != NULL; i++) {
|
||||
if (strncasecmp(mp_cmds[i].name, str, l) == 0)
|
||||
const char *cmd = mp_cmds[i].name;
|
||||
if (strncasecmp(cmd, str, l) == 0 && strlen(cmd) == l)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -749,6 +774,7 @@ mp_cmd_t *mp_input_parse_cmd(char *str)
|
|||
.id = cmd_def->id,
|
||||
.name = talloc_strdup(cmd, cmd_def->name),
|
||||
.pausing = pausing,
|
||||
.on_osd = on_osd,
|
||||
};
|
||||
|
||||
ptr = str;
|
||||
|
|
|
@ -51,8 +51,7 @@ enum mp_command_type {
|
|||
MP_CMD_RUN,
|
||||
MP_CMD_SUB_LOAD,
|
||||
MP_CMD_KEYDOWN_EVENTS,
|
||||
MP_CMD_SET_PROPERTY,
|
||||
MP_CMD_SET_PROPERTY_OSD,
|
||||
MP_CMD_SET,
|
||||
MP_CMD_GET_PROPERTY,
|
||||
MP_CMD_OSD_SHOW_PROPERTY_TEXT,
|
||||
MP_CMD_OSD_SHOW_PROGRESSION,
|
||||
|
@ -60,8 +59,7 @@ enum mp_command_type {
|
|||
MP_CMD_RADIO_SET_CHANNEL,
|
||||
MP_CMD_RADIO_SET_FREQ,
|
||||
MP_CMD_SET_MOUSE_POS,
|
||||
MP_CMD_STEP_PROPERTY,
|
||||
MP_CMD_STEP_PROPERTY_OSD,
|
||||
MP_CMD_SWITCH,
|
||||
MP_CMD_RADIO_STEP_FREQ,
|
||||
MP_CMD_TV_STEP_FREQ,
|
||||
MP_CMD_TV_START_SCAN,
|
||||
|
@ -104,6 +102,11 @@ enum mp_command_type {
|
|||
// Key FIFO was full - release events may be lost, zero button-down status
|
||||
#define MP_INPUT_RELEASE_ALL -5
|
||||
|
||||
enum mp_on_osd {
|
||||
MP_ON_OSD_NO = 0,
|
||||
MP_ON_OSD_AUTO,
|
||||
};
|
||||
|
||||
enum mp_input_section_flags {
|
||||
// If a key binding is not defined in the current section, search the
|
||||
// default section for it ("default" refers to bindings with no section
|
||||
|
@ -129,6 +132,7 @@ typedef struct mp_cmd {
|
|||
struct mp_cmd_arg args[MP_CMD_MAX_ARGS];
|
||||
int nargs;
|
||||
int pausing;
|
||||
enum mp_on_osd on_osd;
|
||||
struct mp_cmd *queue_next;
|
||||
} mp_cmd_t;
|
||||
|
||||
|
|
1
mp_osd.h
1
mp_osd.h
|
@ -33,6 +33,7 @@
|
|||
|
||||
#define MAX_OSD_LEVEL 3
|
||||
#define MAX_TERM_OSD_LEVEL 1
|
||||
#define OSD_LEVEL_INVISIBLE 4
|
||||
|
||||
struct MPContext;
|
||||
|
||||
|
|
|
@ -1240,6 +1240,8 @@ static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int id, int level,
|
|||
static void set_osd_msg_va(struct MPContext *mpctx, int id, int level, int time,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
if (level == OSD_LEVEL_INVISIBLE)
|
||||
return;
|
||||
mp_osd_msg_t *msg = add_osd_msg(mpctx, id, level, time);
|
||||
msg->msg = talloc_vasprintf(msg, fmt, ap);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue