diff options
-rw-r--r-- | DOCS/man/en/input.rst | 2 | ||||
-rw-r--r-- | player/command.c | 9 | ||||
-rw-r--r-- | stream/stream.h | 1 | ||||
-rw-r--r-- | stream/stream_dvd.c | 9 | ||||
-rw-r--r-- | stream/stream_dvdnav.c | 7 |
5 files changed, 28 insertions, 0 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index c4a18cb7ba..a98bc4a28a 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -543,6 +543,8 @@ an option at runtime. Otherwise, if the currently played file has a ``title`` tag, use that. + Otherwise, if the media type is DVD, return the volume ID of DVD. + Otherwise, return the ``filename`` property. ``demuxer`` diff --git a/player/command.c b/player/command.c index 5f39817d46..4d4f552ffa 100644 --- a/player/command.c +++ b/player/command.c @@ -194,6 +194,15 @@ 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) + { + int r = m_property_strdup_ro(prop, action, arg, name); + talloc_free(name); + return r; + } } return mp_property_filename(prop, action, arg, mpctx); } diff --git a/stream/stream.h b/stream/stream.h index 9361884657..0ccf9557e2 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -99,6 +99,7 @@ enum stream_ctrl { STREAM_CTRL_GET_BASE_FILENAME, STREAM_CTRL_GET_NAV_EVENT, // struct mp_nav_event** STREAM_CTRL_NAV_CMD, // struct mp_nav_cmd* + STREAM_CTRL_GET_DVD_VOLUME_ID, }; struct stream_lang_req { diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 27b539901d..7e3c9c1cc3 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -727,6 +727,15 @@ static int control(stream_t *stream,int cmd,void* arg) memcpy(req->palette, d->cur_pgc->palette, sizeof(req->palette)); return STREAM_OK; } + case STREAM_CTRL_GET_DVD_VOLUME_ID: + { + char buffer[128]; + if (DVDUDFVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0 + && DVDISOVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0) + return STREAM_ERROR; + *(char**)arg = talloc_strdup(NULL, buffer); + return STREAM_OK; + } } return STREAM_UNSUPPORTED; } diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index ca17846921..537047fe04 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -602,6 +602,13 @@ static int control(stream_t *stream, int cmd, void *arg) handle_cmd(stream, (struct mp_nav_cmd *)arg); return STREAM_OK; } + case STREAM_CTRL_GET_DVD_VOLUME_ID: { + const char *volume = NULL; + if (dvdnav_get_title_string(dvdnav, &volume) != DVDNAV_STATUS_OK || !volume) + return STREAM_ERROR; + *(char**)arg = talloc_strdup(NULL, volume); + return STREAM_OK; + } } return STREAM_UNSUPPORTED; |