summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-14 01:21:06 +0100
committerwm4 <wm4@nowhere>2013-12-14 01:21:06 +0100
commit653980ac3a6f312f7f1343b0c8f8bcdd550fea89 (patch)
tree7c10c1adb3f5970305857421bf57738e664754eb
parent8510ddba4c51a2fd27f2a96508b963e4cf5c9857 (diff)
downloadmpv-653980ac3a6f312f7f1343b0c8f8bcdd550fea89.tar.bz2
mpv-653980ac3a6f312f7f1343b0c8f8bcdd550fea89.tar.xz
dvdnav, tv: force-disable caching
On dvdnav, caching kind of works but not really. (Not our fault, at least not fully. It's due to libdvdnav being slightly misdesigned; see previous commit for some explanations.) The TV code is implemented in the demuxer, and the stream implementation is just a wrapper, so caching makes no sense here.
-rw-r--r--stream/stream.c3
-rw-r--r--stream/stream.h1
-rw-r--r--stream/stream_dvdnav.c4
-rw-r--r--stream/stream_tv.c1
4 files changed, 5 insertions, 4 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 8a31b45254..dd1fc34435 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -290,6 +290,7 @@ static int open_internal(const stream_info_t *sinfo, struct stream *underlying,
s->url = talloc_strdup(s, url);
s->path = talloc_strdup(s, path);
s->source = underlying;
+ s->allow_caching = true;
// Parse options
if (sinfo->priv_size) {
@@ -805,7 +806,7 @@ static int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
{
stream_t *orig = *stream;
- if (orig->mode != STREAM_READ)
+ if (orig->mode != STREAM_READ || !orig->allow_caching)
return 1;
stream_t *cache = new_stream();
diff --git a/stream/stream.h b/stream/stream.h
index a444601a58..cea45c5285 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -164,6 +164,7 @@ typedef struct stream {
char *demuxer; // request demuxer to be used
char *lavf_type; // name of expected demuxer type for lavf
bool safe_origin; // used for playlists that can be opened safely
+ bool allow_caching; // stream cache makes sense
struct MPOpts *opts;
FILE *capture_file;
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 3213665051..f66eeec605 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -696,14 +696,12 @@ static int open_s(stream_t *stream, int mode)
stream->type = STREAMTYPE_DVD;
stream->demuxer = "lavf";
stream->lavf_type = "mpeg";
+ stream->allow_caching = false;
if (!stream->pos && p->track > 0)
mp_msg(MSGT_OPEN, MSGL_ERR, "INIT ERROR: couldn't get init pos %s\r\n",
dvdnav_err_to_string(priv->dvdnav));
- mp_msg(MSGT_OPEN, MSGL_INFO, "Remember to disable mpv's cache when "
- "playing dvdnav:// streams (adding -no-cache to your command line)\n");
-
return STREAM_OK;
}
diff --git a/stream/stream_tv.c b/stream/stream_tv.c
index b1c2e63167..89d22e9a3d 100644
--- a/stream/stream_tv.c
+++ b/stream/stream_tv.c
@@ -92,6 +92,7 @@ tv_stream_open (stream_t *stream, int mode)
stream->type = STREAMTYPE_TV;
stream->close=tv_stream_close;
stream->demuxer = "tv";
+ stream->allow_caching = false;
return STREAM_OK;
}