summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorMartin Herkt <lachs0r@srsfckn.biz>2015-11-15 23:03:48 +0100
committerMartin Herkt <lachs0r@srsfckn.biz>2015-11-15 23:18:24 +0100
commitbf0b178e71d76c839d6d17c42a83536e444ba31d (patch)
treede21f2f308d4f1c4558330d6fd9dbc9a9a325fa4 /player
parent883d3114138a8f9a03f778165de553b7cdb99bee (diff)
downloadmpv-bf0b178e71d76c839d6d17c42a83536e444ba31d.tar.bz2
mpv-bf0b178e71d76c839d6d17c42a83536e444ba31d.tar.xz
win32: support taskbar button progress indicator
This adds support for the progress indicator taskbar extension that was introduced with Windows 7 and Windows Server 2008 R2. I don’t like this solution because it keeps its own state and introduces another VOCTRL, but I couldn’t come up with anything less messy. closes #2399
Diffstat (limited to 'player')
-rw-r--r--player/core.h2
-rw-r--r--player/misc.c20
-rw-r--r--player/osd.c1
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;