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. 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 --overlapsub
Allows the next subtitle to be displayed while the current one is still 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 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("term-osd-esc", term_osd_esc, 0, OPTDEF_STR("\x1b[A\r\x1b[K")),
OPT_STRING("playing-msg", playing_msg, 0), OPT_STRING("playing-msg", playing_msg, 0),
OPT_STRING("status-msg", status_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}, {"slave-broken", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
OPT_FLAG("idle", player_idle_mode, CONF_GLOBAL), OPT_FLAG("idle", player_idle_mode, CONF_GLOBAL),

View File

@ -1437,6 +1437,12 @@ static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full)
} }
} }
saddf_osd_function_sym(buffer, sym); saddf_osd_function_sym(buffer, sym);
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); sadd_hhmmssff(buffer, get_current_time(mpctx), fractions);
if (full) { if (full) {
saddf(buffer, " / "); saddf(buffer, " / ");
@ -1444,6 +1450,7 @@ static void sadd_osd_status(char **buffer, struct MPContext *mpctx, bool full)
sadd_percentage(buffer, get_percent_pos(mpctx)); sadd_percentage(buffer, get_percent_pos(mpctx));
} }
} }
}
// OSD messages initated by seeking commands are added lazily with this // OSD messages initated by seeking commands are added lazily with this
// function, because multiple successive seek commands can be coalesced. // function, because multiple successive seek commands can be coalesced.

View File

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