diff options
Diffstat (limited to 'player')
-rw-r--r-- | player/core.h | 2 | ||||
-rw-r--r-- | player/misc.c | 20 | ||||
-rw-r--r-- | player/osd.c | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/player/core.h b/player/core.h index 4303daa78a..abe1316b41 100644 --- a/player/core.h +++ b/player/core.h @@ -181,6 +181,7 @@ typedef struct MPContext { char *term_osd_subs; char *term_osd_contents; char *last_window_title; + struct voctrl_playback_state vo_playback_state; int add_osd_seek_info; // bitfield of enum mp_osd_seek_info double osd_visible; // for the osd bar only @@ -462,6 +463,7 @@ double get_relative_time(struct MPContext *mpctx); void merge_playlist_files(struct playlist *pl); float mp_get_cache_percent(struct MPContext *mpctx); bool mp_get_cache_idle(struct MPContext *mpctx); +void update_vo_playback_state(struct MPContext *mpctx); void update_window_title(struct MPContext *mpctx, bool force); void error_on_track(struct MPContext *mpctx, struct track *track); int stream_dump(struct MPContext *mpctx, const char *source_filename); diff --git a/player/misc.c b/player/misc.c index add73e5a17..1e67adbe32 100644 --- a/player/misc.c +++ b/player/misc.c @@ -153,6 +153,26 @@ bool mp_get_cache_idle(struct MPContext *mpctx) return idle; } +void update_vo_playback_state(struct MPContext *mpctx) +{ + if (mpctx->video_out) { + struct voctrl_playback_state oldstate = mpctx->vo_playback_state; + struct voctrl_playback_state newstate = { + .paused = mpctx->paused, + .percent_pos = get_percent_pos(mpctx), + }; + + if (oldstate.paused != newstate.paused || + oldstate.percent_pos != newstate.percent_pos) { + vo_control(mpctx->video_out, + VOCTRL_UPDATE_PLAYBACK_STATE, &newstate); + mpctx->vo_playback_state = newstate; + } + } else { + mpctx->vo_playback_state = (struct voctrl_playback_state){ 0 }; + } +} + void update_window_title(struct MPContext *mpctx, bool force) { if (!mpctx->video_out && !mpctx->ao) { diff --git a/player/osd.c b/player/osd.c index 596386ebae..cb49131cc1 100644 --- a/player/osd.c +++ b/player/osd.c @@ -164,6 +164,7 @@ static void print_status(struct MPContext *mpctx) struct MPOpts *opts = mpctx->opts; update_window_title(mpctx, false); + update_vo_playback_state(mpctx); if (!opts->use_terminal) return; |