summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-03-30 03:13:17 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-03-31 19:15:08 +0300
commit0f590fce191097887a81d0a6676cb0a943ce54e4 (patch)
tree96c5113754a72c72d6cf01255adaa061bfb76018 /command.c
parent694c067e19dcbabe8f6121923fe628b9bfa6ac32 (diff)
downloadmpv-0f590fce191097887a81d0a6676cb0a943ce54e4.tar.bz2
mpv-0f590fce191097887a81d0a6676cb0a943ce54e4.tar.xz
core: Clean up OSD seek info logic
Clean up the code and make the behavior more consistent. Before bits of the OSD information were triggered in different places, and various property commands that affect playback position only showed the seek bar while the main seek command also triggered showing the percentage in OSD text. Now only the seek and chapter commands trigger all information and others nothing (which is consistent with most property behavior).
Diffstat (limited to 'command.c')
-rw-r--r--command.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/command.c b/command.c
index 5e76158116..8fc8c85e7d 100644
--- a/command.c
+++ b/command.c
@@ -2227,7 +2227,7 @@ static struct {
/// set/adjust or toggle command
int toggle;
/// progressbar type
- int osd_progbar;
+ int osd_progbar; // -1 is special value for seek indicators
/// osd msg id if it must be shared
int osd_id;
/// osd msg template
@@ -2235,7 +2235,7 @@ static struct {
} set_prop_cmd[] = {
// general
{ "loop", MP_CMD_LOOP, 0, 0, -1, MSGTR_LoopStatus },
- { "chapter", MP_CMD_SEEK_CHAPTER, 0, 0, -1, NULL },
+ { "chapter", MP_CMD_SEEK_CHAPTER, 0, -1, -1, NULL },
{ "angle", MP_CMD_SWITCH_ANGLE, 0, 0, -1, NULL },
{ "pause", MP_CMD_PAUSE, 0, 0, -1, NULL },
// audio
@@ -2317,7 +2317,9 @@ static int set_property_command(MPContext *mpctx, mp_cmd_t *cmd)
if (r <= 0)
return 1;
- if (set_prop_cmd[i].osd_progbar) {
+ if (set_prop_cmd[i].osd_progbar == -1)
+ mpctx->add_osd_seek_info = true;
+ else if (set_prop_cmd[i].osd_progbar) {
if (prop->type == CONF_TYPE_INT) {
if (mp_property_do(pname, M_PROPERTY_GET, &r, mpctx) > 0)
set_osd_bar(mpctx, set_prop_cmd[i].osd_progbar,
@@ -2386,8 +2388,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SEEK:{
float v;
int abs;
- if (sh_video)
- mpctx->osd_show_percentage = sh_video->fps;
+ mpctx->add_osd_seek_info = true;
v = cmd->args[0].v.f;
abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
if (abs == 2) { /* Absolute seek to a specific timestamp in seconds */