mirror of
https://github.com/mpv-player/mpv
synced 2025-02-23 08:26:56 +00:00
player: add --osd-playing-msg option
This commit is contained in:
parent
291d986810
commit
2da246b9f7
@ -2190,6 +2190,13 @@ OSD
|
||||
non-default cases when seeking. Expands properties. See
|
||||
`Property Expansion`_.
|
||||
|
||||
``--osd-playing-msg=<string>``
|
||||
Show a message on OSD when playback starts. The string is expanded for
|
||||
properties, e.g. ``--osd-playing-msg='file: ${filename}'`` will show the
|
||||
message ``file:`` followed by a space and the currently played filename.
|
||||
|
||||
See `Property Expansion`_.
|
||||
|
||||
``--osd-bar-align-x=<-1-1>``
|
||||
Position of the OSD bar. -1 is far left, 0 is centered, 1 is far right.
|
||||
Fractional values (like 0.5) are allowed.
|
||||
|
@ -515,6 +515,7 @@ const m_option_t mp_opts[] = {
|
||||
OPT_STRING("term-osd-bar-chars", term_osd_bar_chars, 0),
|
||||
|
||||
OPT_STRING("term-playing-msg", playing_msg, 0),
|
||||
OPT_STRING("osd-playing-msg", osd_playing_msg, 0),
|
||||
OPT_STRING("term-status-msg", status_msg, 0),
|
||||
OPT_STRING("osd-status-msg", osd_status_msg, 0),
|
||||
|
||||
|
@ -143,6 +143,7 @@ typedef struct MPOpts {
|
||||
int term_osd_bar;
|
||||
char *term_osd_bar_chars;
|
||||
char *playing_msg;
|
||||
char *osd_playing_msg;
|
||||
char *status_msg;
|
||||
char *osd_status_msg;
|
||||
char *heartbeat_cmd;
|
||||
|
@ -871,11 +871,19 @@ void run_playloop(struct MPContext *mpctx)
|
||||
mpctx->hrseek_active = false;
|
||||
mp_notify(mpctx, MPV_EVENT_PLAYBACK_RESTART, NULL);
|
||||
mpctx->restart_complete = true;
|
||||
if (opts->playing_msg && !mpctx->playing_msg_shown) {
|
||||
char *msg =
|
||||
mp_property_expand_escaped_string(mpctx, opts->playing_msg);
|
||||
MP_INFO(mpctx, "%s\n", msg);
|
||||
talloc_free(msg);
|
||||
if (!mpctx->playing_msg_shown) {
|
||||
if (opts->playing_msg) {
|
||||
char *msg =
|
||||
mp_property_expand_escaped_string(mpctx, opts->playing_msg);
|
||||
MP_INFO(mpctx, "%s\n", msg);
|
||||
talloc_free(msg);
|
||||
}
|
||||
if (opts->osd_playing_msg) {
|
||||
char *msg =
|
||||
mp_property_expand_escaped_string(mpctx, opts->osd_playing_msg);
|
||||
set_osd_msg(mpctx, 1, opts->osd_duration, "%s", msg);
|
||||
talloc_free(msg);
|
||||
}
|
||||
}
|
||||
mpctx->playing_msg_shown = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user