mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 06:03:45 +01:00
commands: Add set_property_osd and step_property_osd
This commit is contained in:
parent
606d6fa65b
commit
a0854c1978
@ -261,6 +261,10 @@ set_mouse_pos <x> <y>
|
||||
set_property <property> <value>
|
||||
Set a property.
|
||||
|
||||
set_property_osd <property> <value>
|
||||
Same as above, but show the new value on the OSD in the standard
|
||||
manner defined for that property (if any).
|
||||
|
||||
speed_incr <value>
|
||||
Add <value> to the current playback speed.
|
||||
|
||||
@ -275,6 +279,10 @@ step_property <property> [value] [direction]
|
||||
not given or zero. The direction is reversed if direction is less
|
||||
than zero.
|
||||
|
||||
step_property_osd <property> [value] [direction]
|
||||
Same as above, but show the new value on the OSD in the standard
|
||||
manner defined for that property (if any).
|
||||
|
||||
stop
|
||||
Stop playback.
|
||||
|
||||
|
11
command.c
11
command.c
@ -2443,6 +2443,7 @@ 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 case_fallthrough_hack = 0;
|
||||
if (!set_property_command(mpctx, cmd))
|
||||
switch (cmd->id) {
|
||||
case MP_CMD_SEEK:{
|
||||
@ -2469,6 +2470,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_CMD_SET_PROPERTY_OSD:
|
||||
case_fallthrough_hack = 1;
|
||||
|
||||
case MP_CMD_SET_PROPERTY:{
|
||||
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE,
|
||||
cmd->args[1].v.s, mpctx);
|
||||
@ -2479,9 +2483,14 @@ 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)
|
||||
show_property_osd(mpctx, cmd->args[0].v.s);
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_CMD_STEP_PROPERTY_OSD:
|
||||
case_fallthrough_hack = 1;
|
||||
|
||||
case MP_CMD_STEP_PROPERTY:{
|
||||
void* arg = NULL;
|
||||
int r,i;
|
||||
@ -2520,6 +2529,8 @@ 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)
|
||||
show_property_osd(mpctx, cmd->args[0].v.s);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -205,8 +205,10 @@ static const mp_cmd_t mp_cmds[] = {
|
||||
{ MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", 0, { {-1,{0}} } },
|
||||
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SET_PROPERTY, "set_property", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SET_PROPERTY_OSD, "set_property_osd", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
|
||||
{ MP_CMD_GET_PROPERTY, "get_property", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
|
||||
{ MP_CMD_STEP_PROPERTY, "step_property", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
|
||||
{ MP_CMD_SEEK_CHAPTER, "seek_chapter", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
|
@ -90,6 +90,7 @@ typedef enum {
|
||||
MP_CMD_KEYDOWN_EVENTS,
|
||||
MP_CMD_VO_BORDER,
|
||||
MP_CMD_SET_PROPERTY,
|
||||
MP_CMD_SET_PROPERTY_OSD,
|
||||
MP_CMD_GET_PROPERTY,
|
||||
MP_CMD_OSD_SHOW_PROPERTY_TEXT,
|
||||
MP_CMD_SEEK_CHAPTER,
|
||||
@ -113,6 +114,7 @@ typedef enum {
|
||||
MP_CMD_RADIO_SET_FREQ,
|
||||
MP_CMD_SET_MOUSE_POS,
|
||||
MP_CMD_STEP_PROPERTY,
|
||||
MP_CMD_STEP_PROPERTY_OSD,
|
||||
MP_CMD_RADIO_STEP_FREQ,
|
||||
MP_CMD_TV_STEP_FREQ,
|
||||
MP_CMD_LOOP,
|
||||
|
Loading…
Reference in New Issue
Block a user