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 --- stream/cache.c | 14 +++++++------- stream/stream.h | 2 +- stream/stream_bluray.c | 10 +++++++++- stream/stream_dvd.c | 2 +- stream/stream_dvdnav.c | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'stream') diff --git a/stream/cache.c b/stream/cache.c index ca0e24f833..399013124f 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -113,7 +113,7 @@ struct priv { int stream_cache_idle; int stream_cache_fill; char **stream_metadata; - char *dvd_volume_id; + char *disc_name; }; // Store additional per-byte metadata. Since per-byte would be way too @@ -319,10 +319,10 @@ static void update_cached_controls(struct priv *s) talloc_free(s->stream_metadata); s->stream_metadata = talloc_steal(s, m); } - if (stream_control(s->stream, STREAM_CTRL_GET_DVD_VOLUME_ID, &t) == STREAM_OK) + if (stream_control(s->stream, STREAM_CTRL_GET_DISC_NAME, &t) == STREAM_OK) { - talloc_free(s->dvd_volume_id); - s->dvd_volume_id = talloc_steal(s, t); + talloc_free(s->disc_name); + s->disc_name = talloc_steal(s, t); } stream_update_size(s->stream); s->stream_size = s->stream->end_pos; @@ -389,10 +389,10 @@ static int cache_get_cached_control(stream_t *cache, int cmd, void *arg) } return STREAM_UNSUPPORTED; } - case STREAM_CTRL_GET_DVD_VOLUME_ID: { - if (!s->dvd_volume_id) + case STREAM_CTRL_GET_DISC_NAME: { + if (!s->disc_name) return STREAM_UNSUPPORTED; - *(char **)arg = talloc_strdup(NULL, s->dvd_volume_id); + *(char **)arg = talloc_strdup(NULL, s->disc_name); return STREAM_OK; } case STREAM_CTRL_RESUME_CACHE: diff --git a/stream/stream.h b/stream/stream.h index 0ccf9557e2..1c7b277db8 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -99,7 +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, + STREAM_CTRL_GET_DISC_NAME }; struct stream_lang_req { diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index d7a8d0b0cf..83d26c05fb 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -33,6 +33,7 @@ #include #include +#include #include #include "config.h" @@ -277,7 +278,14 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg) } case STREAM_CTRL_MANAGES_TIMELINE: return STREAM_OK; - + case STREAM_CTRL_GET_DISC_NAME: + { + const struct meta_dl *meta = bd_get_meta(b->bd); + if (!meta || !meta->di_name || !meta->di_name[0]) + break; + *(char**)arg = talloc_strdup(NULL, meta->di_name); + return STREAM_OK; + } default: break; } diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 43cab53b30..a61cff1211 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -727,7 +727,7 @@ 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: + case STREAM_CTRL_GET_DISC_NAME: { char buffer[128]; if (DVDUDFVolumeInfo(d->dvd, buffer, sizeof(buffer), NULL, 0) < 0 && diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 508acd4d04..2fa1fc53ae 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -602,7 +602,7 @@ 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: { + case STREAM_CTRL_GET_DISC_NAME: { const char *volume = NULL; if (dvdnav_get_title_string(dvdnav, &volume) != DVDNAV_STATUS_OK) break; -- cgit v1.2.3