diff options
author | wm4 <wm4@nowhere> | 2014-02-23 18:14:19 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-23 18:16:33 +0100 |
commit | f30149e80ed97490b1c96a16496ba16508fde4c9 (patch) | |
tree | 2175890cc673fc28cd92799a76461e1f89c0defc /stream | |
parent | 42e70868ab24b16189924a26efd5bfdc0b960e8a (diff) | |
download | mpv-f30149e80ed97490b1c96a16496ba16508fde4c9.tar.bz2 mpv-f30149e80ed97490b1c96a16496ba16508fde4c9.tar.xz |
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().
Diffstat (limited to 'stream')
-rw-r--r-- | stream/cache.c | 13 |
1 files changed, 13 insertions, 0 deletions
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); |