summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-02 22:28:11 +0200
committerwm4 <wm4@nowhere>2014-09-02 22:28:11 +0200
commitbf74a4cc4665f152212c0e165bbe2a20d535021c (patch)
treefe0ba754f0525cd3345be86e092d6e471fbdb734
parent6c1e5285181a0799c689ab71fc703fa67917e303 (diff)
downloadmpv-bf74a4cc4665f152212c0e165bbe2a20d535021c.tar.bz2
mpv-bf74a4cc4665f152212c0e165bbe2a20d535021c.tar.xz
player: add --media-title option
Requested by ChrisK2.
-rw-r--r--DOCS/man/options.rst5
-rw-r--r--options/options.c1
-rw-r--r--options/options.h1
-rw-r--r--player/command.c4
4 files changed, 11 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 66a8825c01..18391ae118 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -3032,6 +3032,11 @@ Miscellaneous
You can also try to use ``--no-correct-pts`` for files with completely
broken timestamps.
+``--media-title=<string>``
+ Force the contents of the ``media-title`` property to this value. Useful
+ for scripts which want to set a title, without overriding the user's
+ setting in ``--title``.
+
``--slave-broken``
Switches on the old slave mode. This is for testing only, and incompatible
to the removed ``--slave`` switch.
diff --git a/options/options.c b/options/options.c
index a0671404e7..2523146feb 100644
--- a/options/options.c
+++ b/options/options.c
@@ -379,6 +379,7 @@ const m_option_t mp_opts[] = {
// vo name (X classname) and window title strings
OPT_STRING("x11-name", vo.winname, 0),
OPT_STRING("title", wintitle, 0),
+ OPT_STRING("media-title", media_title, 0),
// set aspect ratio of monitor - useful for 16:9 TV-out
OPT_FLOATRANGE("monitoraspect", vo.force_monitor_aspect, 0, 0.0, 9.0),
OPT_FLOATRANGE("monitorpixelaspect", vo.monitor_pixel_aspect, 0, 0.2, 9.0),
diff --git a/options/options.h b/options/options.h
index c8a24de372..b1a7ec0952 100644
--- a/options/options.h
+++ b/options/options.h
@@ -79,6 +79,7 @@ typedef struct MPOpts {
int allow_win_drag;
char *wintitle;
+ char *media_title;
int force_rgba_osd;
// ranges -100 - 100, 1000 if the vo default should be used
diff --git a/player/command.c b/player/command.c
index 02f8ce55bf..3e5849fe80 100644
--- a/player/command.c
+++ b/player/command.c
@@ -229,6 +229,10 @@ static int mp_property_media_title(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
char *name = NULL;
+ if (mpctx->opts->media_title)
+ name = mpctx->opts->media_title;
+ if (name && name[0])
+ return m_property_strdup_ro(action, arg, name);
if (mpctx->resolve_result)
name = mpctx->resolve_result->title;
if (name && name[0])