mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
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.
This commit is contained in:
parent
a07b99540c
commit
f2cd4a0e75
@ -2119,6 +2119,9 @@
|
|||||||
Set the window title. Properties are expanded on playback start.
|
Set the window title. Properties are expanded on playback start.
|
||||||
(See property_expansion_.)
|
(See property_expansion_.)
|
||||||
|
|
||||||
|
*NOTE*: There is a danger of this causing significant CPU usage,
|
||||||
|
depending on the properties used and the window manager.
|
||||||
|
|
||||||
--tv=<option1:option2:...>
|
--tv=<option1:option2:...>
|
||||||
This option tunes various properties of the TV capture module. For
|
This option tunes various properties of the TV capture module. For
|
||||||
watching TV with mpv, use ``tv://`` or ``tv://<channel_number>`` or
|
watching TV with mpv, use ``tv://`` or ``tv://<channel_number>`` or
|
||||||
|
@ -1117,6 +1117,22 @@ static bool mp_get_cache_idle(struct MPContext *mpctx)
|
|||||||
return idle;
|
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__))
|
#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
|
||||||
|
|
||||||
// append time in the hh:mm:ss format (plus fractions if wanted)
|
// 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;
|
struct MPOpts *opts = &mpctx->opts;
|
||||||
sh_video_t * const sh_video = mpctx->sh_video;
|
sh_video_t * const sh_video = mpctx->sh_video;
|
||||||
|
|
||||||
|
vo_update_window_title(mpctx);
|
||||||
|
|
||||||
if (opts->quiet)
|
if (opts->quiet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2358,16 +2376,6 @@ static int fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
|
|||||||
return -partial_fill;
|
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)
|
static void update_fps(struct MPContext *mpctx)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ENCODING
|
#ifdef CONFIG_ENCODING
|
||||||
|
Loading…
Reference in New Issue
Block a user