summaryrefslogtreecommitdiffstats
path: root/stream/cache.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-05 01:59:04 +0200
committerwm4 <wm4@nowhere>2013-06-09 22:06:02 +0200
commit005375bb7d095d06c46a1d47223e0381439dc3ea (patch)
tree67ab3869e46afe1e3752392e7650e3a6e07cbe9f /stream/cache.c
parent97887895308d8912ffa78400fcccd1ddb2c58680 (diff)
downloadmpv-005375bb7d095d06c46a1d47223e0381439dc3ea.tar.bz2
mpv-005375bb7d095d06c46a1d47223e0381439dc3ea.tar.xz
core: use STREAM_CTRL instead of accessing stream_dvd internals
Some code in mplayer.c did stuff like accessing (dvd_priv_t *)st->priv. Do this indirectly by introducing STREAM_CTRL_GET_DVD_INFO. This is extremely specific to DVD, so it's not worth abstracting this further. This is a preparation for turning the cache into an actual stream, which simply wraps the cached stream. There are other streams which are accessed in the way DVD was, at least TV/radio/DVB. We assume these can't be used with the cache. The code doesn't look thread-safe or fork aware.
Diffstat (limited to 'stream/cache.c')
-rw-r--r--stream/cache.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/stream/cache.c b/stream/cache.c
index a0ad2559ae..9038fc6cf6 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -90,6 +90,7 @@ typedef struct {
volatile uint64_t control_uint_arg;
volatile double control_double_arg;
volatile struct stream_lang_req control_lang_arg;
+ volatile struct stream_dvd_info_req control_dvd_info_arg;
volatile int control_res;
volatile double stream_time_length;
volatile double stream_time_pos;
@@ -352,6 +353,10 @@ static int cache_execute_control(cache_vars_t *s)
s->control_res = s->stream->control(s->stream, s->control,
(void *)&s->control_lang_arg);
break;
+ case STREAM_CTRL_GET_DVD_INFO:
+ s->control_res = s->stream->control(s->stream, s->control,
+ (void *)&s->control_dvd_info_arg);
+ break;
case STREAM_CTRL_MANAGES_TIMELINE:
s->control_res = s->stream->control(s->stream, s->control, NULL);
break;
@@ -737,6 +742,8 @@ int cache_do_control(stream_t *stream, int cmd, void *arg)
break;
case STREAM_CTRL_GET_LANG:
s->control_lang_arg = *(struct stream_lang_req *)arg;
+ case STREAM_CTRL_GET_DVD_INFO:
+ s->control_dvd_info_arg = *(struct stream_dvd_info_req *)arg;
case STREAM_CTRL_GET_NUM_TITLES:
case STREAM_CTRL_GET_NUM_CHAPTERS:
case STREAM_CTRL_GET_CURRENT_TITLE:
@@ -797,6 +804,9 @@ int cache_do_control(stream_t *stream, int cmd, void *arg)
case STREAM_CTRL_GET_LANG:
*(struct stream_lang_req *)arg = s->control_lang_arg;
break;
+ case STREAM_CTRL_GET_DVD_INFO:
+ *(struct stream_dvd_info_req *)arg = s->control_dvd_info_arg;
+ break;
case STREAM_CTRL_MANAGES_TIMELINE:
break;
}