summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-08-10 18:53:45 -0500
committerDudemanguy <random342@airmail.cc>2023-08-13 19:58:20 +0000
commitc62b45ec2ab020dad04a95aff3c85aab631b1f32 (patch)
tree3c3c41ef746155f0d7687e2266abac47c00292c9
parent6ea08be59ac503f7309a19a50d5e664426e8c9f3 (diff)
downloadmpv-c62b45ec2ab020dad04a95aff3c85aab631b1f32.tar.bz2
mpv-c62b45ec2ab020dad04a95aff3c85aab631b1f32.tar.xz
player: add --term-remaining-playtime option
The OSC reports the speed-adjusted remaining time, but the terminal does not. This is a weird mismatch and the OSC's default behavior makes sense, so let's just do some division and add an option to disable it. Also named "remaining-playtime" after the OSC option. Fixes #10445.
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--DOCS/man/options.rst4
-rw-r--r--options/options.c2
-rw-r--r--options/options.h1
-rw-r--r--player/osd.c3
5 files changed, 11 insertions, 1 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 95740f98e5..7d02d8ef46 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -36,6 +36,8 @@ Interface changes
- change `--audiotrack-pcm-float` default from `no` to `yes`
- add video-params/aspect-name
- change type of `--sub-pos` to float
+ - The remaining time printed in the terminal is now adjusted for speed by default.
+ You can disable this with `--no-term-remaining-playtime`.
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 9a6d18cff3..8616dded9e 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -4787,6 +4787,10 @@ Terminal
See `Property Expansion`_.
+``--term-remaining-playtime``, ``--no-term-remaining-playtime``
+ When printing out the time on the terminal, show the remaining time adjusted by
+ playback speed. Default: ``yes``
+
``--term-status-msg=<string>``
Print out a custom string during playback instead of the standard status
line. Expands properties. See `Property Expansion`_.
diff --git a/options/options.c b/options/options.c
index d8b68cb448..027c93e904 100644
--- a/options/options.c
+++ b/options/options.c
@@ -752,6 +752,7 @@ static const m_option_t mp_opts[] = {
{"term-osd-bar", OPT_BOOL(term_osd_bar), .flags = UPDATE_OSD},
{"term-osd-bar-chars", OPT_STRING(term_osd_bar_chars), .flags = UPDATE_OSD},
+ {"term-remaining-playtime", OPT_BOOL(term_remaining_playtime), .flags = UPDATE_OSD},
{"term-title", OPT_STRING(term_title), .flags = UPDATE_OSD},
{"term-playing-msg", OPT_STRING(playing_msg)},
@@ -1024,6 +1025,7 @@ static const struct MPOpts mp_default_opts = {
.frame_dropping = 1,
.term_osd = 2,
.term_osd_bar_chars = "[-+-]",
+ .term_remaining_playtime = true,
.consolecontrols = true,
.playlist_pos = -1,
.play_frames = -1,
diff --git a/options/options.h b/options/options.h
index 36764ea84e..d635901202 100644
--- a/options/options.h
+++ b/options/options.h
@@ -231,6 +231,7 @@ typedef struct MPOpts {
int term_osd;
bool term_osd_bar;
char *term_osd_bar_chars;
+ bool term_remaining_playtime;
char *term_title;
char *playing_msg;
char *osd_playing_msg;
diff --git a/player/osd.c b/player/osd.c
index a6b0aa8614..92647a793e 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -195,9 +195,10 @@ static char *get_term_status_msg(struct MPContext *mpctx)
saddf(&line, ": ");
// Playback position
+ double speed = opts->term_remaining_playtime ? mpctx->video_speed : 1;
sadd_hhmmssff(&line, get_playback_time(mpctx), opts->osd_fractions);
saddf(&line, " / ");
- sadd_hhmmssff(&line, get_time_length(mpctx), opts->osd_fractions);
+ sadd_hhmmssff(&line, get_time_length(mpctx) / speed, opts->osd_fractions);
sadd_percentage(&line, get_percent_pos(mpctx));