options: add osd-playing-msg-duration

This commit is contained in:
Guido Cella 2022-04-08 00:00:00 +02:00 committed by Dudemanguy
parent 86dfdf083b
commit d6affda0a7
4 changed files with 10 additions and 1 deletions

View File

@ -4062,6 +4062,10 @@ OSD
See `Property Expansion`_.
``--osd-playing-msg-duration=<time>``
Set the duration of ``osd-playing-msg`` in ms. If this is unset,
``osd-playing-msg`` stays on screen for the duration of ``osd-duration``.
``--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.

View File

@ -748,6 +748,8 @@ static const m_option_t mp_opts[] = {
{"term-playing-msg", OPT_STRING(playing_msg)},
{"osd-playing-msg", OPT_STRING(osd_playing_msg)},
{"osd-playing-msg-duration", OPT_INT(osd_playing_msg_duration),
M_RANGE(0, 3600000)},
{"term-status-msg", OPT_STRING(status_msg), .flags = UPDATE_OSD},
{"osd-status-msg", OPT_STRING(osd_status_msg), .flags = UPDATE_OSD},
{"osd-msg1", OPT_STRING(osd_msg[0]), .flags = UPDATE_OSD},

View File

@ -233,6 +233,7 @@ typedef struct MPOpts {
char *term_title;
char *playing_msg;
char *osd_playing_msg;
int osd_playing_msg_duration;
char *status_msg;
char *osd_status_msg;
char *osd_msg[3];

View File

@ -1139,7 +1139,9 @@ static void handle_playback_restart(struct MPContext *mpctx)
if (opts->osd_playing_msg && opts->osd_playing_msg[0]) {
char *msg =
mp_property_expand_escaped_string(mpctx, opts->osd_playing_msg);
set_osd_msg(mpctx, 1, opts->osd_duration, "%s", msg);
set_osd_msg(mpctx, 1, opts->osd_playing_msg_duration ?
opts->osd_playing_msg_duration : opts->osd_duration,
"%s", msg);
talloc_free(msg);
}
}