osd: add --osd-status-msg option for custom OSD status

This commit is contained in:
wm4 2013-02-16 22:14:33 +01:00
parent bd835cdeea
commit 6b3e7740f1
4 changed files with 20 additions and 5 deletions

View File

@ -1404,6 +1404,12 @@
Default: 0.
--osd-status-msg=<string>
Show a custom string during playback instead of the standard status text.
This overrides the status text used for ``--osd-level=3``, when using the
``show_progress`` command (by default mapped to ``P``), or in some
non-default cases when seeking. Expands properties. See ``--playing-msg``.
--overlapsub
Allows the next subtitle to be displayed while the current one is still
visible (default is to enable the support only for specific formats). This

View File

@ -678,6 +678,7 @@ const m_option_t mplayer_opts[]={
OPT_STRING("term-osd-esc", term_osd_esc, 0, OPTDEF_STR("\x1b[A\r\x1b[K")),
OPT_STRING("playing-msg", playing_msg, 0),
OPT_STRING("status-msg", status_msg, 0),
OPT_STRING("osd-status-msg", osd_status_msg, 0),
{"slave-broken", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
OPT_FLAG("idle", player_idle_mode, CONF_GLOBAL),

View File

@ -1437,11 +1437,18 @@ static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full)
}
}
saddf_osd_function_sym(buffer, sym);
sadd_hhmmssff(buffer, get_current_time(mpctx), fractions);
if (full) {
saddf(buffer, " / ");
sadd_hhmmssff(buffer, get_time_length(mpctx), fractions);
sadd_percentage(buffer, get_percent_pos(mpctx));
char *custom_msg = mpctx->opts.osd_status_msg;
if (custom_msg && full) {
char *text = mp_property_expand_string(mpctx, custom_msg);
*buffer = talloc_strdup_append(*buffer, text);
talloc_free(text);
} else {
sadd_hhmmssff(buffer, get_current_time(mpctx), fractions);
if (full) {
saddf(buffer, " / ");
sadd_hhmmssff(buffer, get_time_length(mpctx), fractions);
sadd_percentage(buffer, get_percent_pos(mpctx));
}
}
}

View File

@ -77,6 +77,7 @@ typedef struct MPOpts {
char *term_osd_esc;
char *playing_msg;
char *status_msg;
char *osd_status_msg;
int player_idle_mode;
int consolecontrols;
int doubleclick_time;