From f30149e80ed97490b1c96a16496ba16508fde4c9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Feb 2014 18:14:19 +0100 Subject: cache: cache DVD volume ID Since this might be queried every frame or so, it's important not to stall the cache by doing a synchronous stream_control(). --- stream/cache.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stream/cache.c b/stream/cache.c index 040e30a558..ca0e24f833 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -113,6 +113,7 @@ struct priv { int stream_cache_idle; int stream_cache_fill; char **stream_metadata; + char *dvd_volume_id; }; // Store additional per-byte metadata. Since per-byte would be way too @@ -301,6 +302,7 @@ static void update_cached_controls(struct priv *s) unsigned int ui; double d; char **m; + char *t; s->stream_time_length = 0; if (stream_control(s->stream, STREAM_CTRL_GET_TIME_LENGTH, &d) == STREAM_OK) s->stream_time_length = d; @@ -317,6 +319,11 @@ 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) + { + talloc_free(s->dvd_volume_id); + s->dvd_volume_id = talloc_steal(s, t); + } stream_update_size(s->stream); s->stream_size = s->stream->end_pos; } @@ -382,6 +389,12 @@ 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) + return STREAM_UNSUPPORTED; + *(char **)arg = talloc_strdup(NULL, s->dvd_volume_id); + return STREAM_OK; + } case STREAM_CTRL_RESUME_CACHE: s->idle = s->eof = false; pthread_cond_signal(&s->wakeup); -- cgit v1.2.3