summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2013-06-15 20:42:26 -0700
committerwm4 <wm4@nowhere>2013-06-16 06:17:44 +0200
commitf2cd4a0e750fc3f1a642f8389e9d95c38868f588 (patch)
tree06c6b5cda338f0459a5d8c49509f44e115f35227 /core/mplayer.c
parenta07b99540c7b19b271d60c00f435895e01b2de17 (diff)
downloadmpv-f2cd4a0e750fc3f1a642f8389e9d95c38868f588.tar.bz2
mpv-f2cd4a0e750fc3f1a642f8389e9d95c38868f588.tar.xz
mplayer: update window title if its properties change
This allows having properties like time-pos in the window title update properly. There is a danger of this causing significant CPU usage, depending on the properties used and the window manager.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 4d6afd656c..b6d2923818 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -1117,6 +1117,22 @@ static bool mp_get_cache_idle(struct MPContext *mpctx)
return idle;
}
+static void vo_update_window_title(struct MPContext *mpctx)
+{
+ if (!mpctx->video_out)
+ return;
+ char *title = mp_property_expand_string(mpctx, mpctx->opts.wintitle);
+ if (!mpctx->video_out->window_title ||
+ strcmp(title, mpctx->video_out->window_title))
+ {
+ talloc_free(mpctx->video_out->window_title);
+ mpctx->video_out->window_title = talloc_steal(mpctx, title);
+ vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
+ } else {
+ talloc_free(title);
+ }
+}
+
#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
// append time in the hh:mm:ss format (plus fractions if wanted)
@@ -1164,6 +1180,8 @@ static void print_status(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
+ vo_update_window_title(mpctx);
+
if (opts->quiet)
return;
@@ -2358,16 +2376,6 @@ static int fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
return -partial_fill;
}
-static void vo_update_window_title(struct MPContext *mpctx)
-{
- if (!mpctx->video_out)
- return;
- char *title = mp_property_expand_string(mpctx, mpctx->opts.wintitle);
- talloc_free(mpctx->video_out->window_title);
- mpctx->video_out->window_title = talloc_steal(mpctx, title);
- vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
-}
-
static void update_fps(struct MPContext *mpctx)
{
#ifdef CONFIG_ENCODING