summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/command.c20
-rw-r--r--stream/cache.c14
-rw-r--r--stream/stream.h2
-rw-r--r--stream/stream_bluray.c10
-rw-r--r--stream/stream_dvd.c2
-rw-r--r--stream/stream_dvdnav.c2
6 files changed, 34 insertions, 16 deletions
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;
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 <assert.h>
#include <libbluray/bluray.h>
+#include <libbluray/meta_data.h>
#include <libavutil/common.h>
#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;