diff options
author | wm4 <wm4@nowhere> | 2014-12-13 20:25:31 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-13 20:25:56 +0100 |
commit | 5b618ef62976370ca184839d0bd8efd615e9f20e (patch) | |
tree | 8be94ca30d18ff40e86fe1b6f4f216cc81078e10 /stream/stream_dvdnav.c | |
parent | c3275f7e531dc95f68e7a293d1e75684d75725f2 (diff) | |
download | mpv-5b618ef62976370ca184839d0bd8efd615e9f20e.tar.bz2 mpv-5b618ef62976370ca184839d0bd8efd615e9f20e.tar.xz |
command, dvd: add property which returns list of DVD titles
This was requested.
It seems libdvdread can't get the duration for titlesets other than the
currently opened title. The data structures contain dangling pointers
for these, and MPlayer works this around by opening every title
separately for the purpose of dumping the title list.
Diffstat (limited to 'stream/stream_dvdnav.c')
-rw-r--r-- | stream/stream_dvdnav.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index be116e65ba..c1513e9e85 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -535,6 +535,22 @@ static int control(stream_t *stream, int cmd, void *arg) *((unsigned int*)arg)= num_titles; return STREAM_OK; } + case STREAM_CTRL_GET_TITLE_LENGTH: { + int t = *(double *)arg; + int32_t num_titles = 0; + if (dvdnav_get_number_of_titles(dvdnav, &num_titles) != DVDNAV_STATUS_OK) + break; + if (t < 0 || t >= num_titles) + break; + uint64_t duration = 0; + uint64_t *parts = NULL; + dvdnav_describe_title_chapters(dvdnav, t + 1, &parts, &duration); + if (!parts) + break; + free(parts); + *(double *)arg = duration / 90000.0; + return STREAM_OK; + } case STREAM_CTRL_GET_CURRENT_TITLE: { if (dvdnav_current_title_info(dvdnav, &tit, &part) != DVDNAV_STATUS_OK) break; |