player: add --media-title option

Requested by ChrisK2.
This commit is contained in:
wm4 2014-09-02 22:28:11 +02:00
parent 6c1e528518
commit bf74a4cc46
4 changed files with 11 additions and 0 deletions

View File

@ -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.

View File

@ -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),

View File

@ -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

View File

@ -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])