summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-02 00:09:03 +0200
committerwm4 <wm4@nowhere>2014-09-02 00:12:52 +0200
commit2da246b9f715a5694263b1ed3dee30b2001b6ed4 (patch)
tree97fa275f2c0a6fd4b2d6f489262b188a8d6574ba
parent291d98681051713a13efaa2e381cf1e3f8efaa70 (diff)
downloadmpv-2da246b9f715a5694263b1ed3dee30b2001b6ed4.tar.bz2
mpv-2da246b9f715a5694263b1ed3dee30b2001b6ed4.tar.xz
player: add --osd-playing-msg option
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--options/options.c1
-rw-r--r--options/options.h1
-rw-r--r--player/playloop.c18
4 files changed, 22 insertions, 5 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 5125756457..66a8825c01 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -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.
diff --git a/options/options.c b/options/options.c
index d436cb7535..a0671404e7 100644
--- a/options/options.c
+++ b/options/options.c
@@ -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),
diff --git a/options/options.h b/options/options.h
index 83593c837a..c8a24de372 100644
--- a/options/options.h
+++ b/options/options.h
@@ -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;
diff --git a/player/playloop.c b/player/playloop.c
index a53c2c4b96..0e35dcb88b 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -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;
}