From 2f72eecd890da9c6f460b1351e02b90610dff88c Mon Sep 17 00:00:00 2001 From: xylosper Date: Wed, 12 Mar 2014 14:41:34 +0900 Subject: command: set 'media-title' property for bluray disc with meta-data --- player/command.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index c797a81800..74f32cc8b6 100644 --- a/player/command.c +++ b/player/command.c @@ -182,6 +182,19 @@ static int mp_property_filename(m_option_t *prop, int action, void *arg, return r; } +static int media_title_from_stream(struct stream *stream, char **name) +{ + if (!stream) + return false; + switch (stream->type) { + case STREAMTYPE_DVD: + case STREAMTYPE_BLURAY: + return stream_control(stream, STREAM_CTRL_GET_DISC_NAME, name); + default: + return false; + } +} + static int mp_property_media_title(m_option_t *prop, int action, void *arg, MPContext *mpctx) { @@ -194,11 +207,8 @@ static int mp_property_media_title(m_option_t *prop, int action, void *arg, name = demux_info_get(mpctx->master_demuxer, "title"); if (name && name[0]) return m_property_strdup_ro(prop, action, arg, name); - struct stream *stream = mpctx->master_demuxer->stream; - if (stream && stream->type == STREAMTYPE_DVD && - stream_control(stream, STREAM_CTRL_GET_DVD_VOLUME_ID, &name) && - name) - { + if (media_title_from_stream(mpctx->master_demuxer->stream, &name) + && name) { int r = m_property_strdup_ro(prop, action, arg, name); talloc_free(name); return r; -- cgit v1.2.3