From fbf76da913b2d39a7da3cc7cea3d8b61f3c2f540 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 27 Feb 2015 19:51:14 +0100 Subject: stream: remove stream filter concept Unused since the previous commit. (Apparently it was a stupid idea.) --- demux/demux.c | 2 +- stream/rar.c | 6 ++---- stream/stream.c | 44 +++++++++++--------------------------------- stream/stream.h | 3 --- stream/stream_rar.c | 4 ++-- 5 files changed, 16 insertions(+), 43 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index 21898e3156..16918e5453 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -955,7 +955,7 @@ static struct demuxer *open_given_type(struct mpv_global *global, stream_seek(stream, 0); // Peek this much data to avoid that stream_read() run by some demuxers - // or stream filters will flush previous peeked data. + // will flush previous peeked data. stream_peek(stream, STREAM_BUFFER_SIZE); in->d_thread->params = params; // temporary during open() diff --git a/stream/rar.c b/stream/rar.c index 9d8b64717a..d0dbc8d736 100644 --- a/stream/rar.c +++ b/stream/rar.c @@ -385,8 +385,7 @@ int RarParse(struct stream *s, int *count, rar_file_t ***file) if (!volume_mrl) goto done; - vol = stream_create(volume_mrl, STREAM_READ | STREAM_NO_FILTERS, - s->cancel, s->global); + vol = stream_create(volume_mrl, STREAM_READ, s->cancel, s->global); if (!vol) goto done; @@ -421,8 +420,7 @@ int RarSeek(rar_file_t *file, uint64_t position) if (strcmp(old_chunk->mrl, file->current_chunk->mrl)) { if (file->s) free_stream(file->s); - file->s = stream_create(file->current_chunk->mrl, - STREAM_READ | STREAM_NO_FILTERS, + file->s = stream_create(file->current_chunk->mrl, STREAM_READ, file->cancel, file->global); } return file->s ? stream_seek(file->s, offset) : 0; diff --git a/stream/stream.c b/stream/stream.c index 4e15f498d9..c16221add6 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -254,32 +254,25 @@ static const char *match_proto(const char *url, const char *proto) return NULL; } -static int open_internal(const stream_info_t *sinfo, struct stream *underlying, - const char *url, int flags, struct mp_cancel *c, - struct mpv_global *global, struct stream **ret) +static int open_internal(const stream_info_t *sinfo, const char *url, int flags, + struct mp_cancel *c, struct mpv_global *global, + struct stream **ret) { - if (sinfo->stream_filter != !!underlying) - return STREAM_NO_MATCH; - if (sinfo->stream_filter && (flags & STREAM_NO_FILTERS)) - return STREAM_NO_MATCH; if (!sinfo->is_safe && (flags & STREAM_SAFE_ONLY)) return STREAM_UNSAFE; if (!sinfo->is_network && (flags & STREAM_NETWORK_ONLY)) return STREAM_UNSAFE; const char *path = NULL; - // Stream filters use the original URL, with no protocol matching at all. - if (!sinfo->stream_filter) { - for (int n = 0; sinfo->protocols && sinfo->protocols[n]; n++) { - path = match_proto(url, sinfo->protocols[n]); - if (path) - break; - } - - if (!path) - return STREAM_NO_MATCH; + for (int n = 0; sinfo->protocols && sinfo->protocols[n]; n++) { + path = match_proto(url, sinfo->protocols[n]); + if (path) + break; } + if (!path) + return STREAM_NO_MATCH; + stream_t *s = new_stream(); s->log = mp_log_new(s, global->log, sinfo->name); s->info = sinfo; @@ -288,7 +281,6 @@ static int open_internal(const stream_info_t *sinfo, struct stream *underlying, s->global = global; s->url = talloc_strdup(s, url); s->path = talloc_strdup(s, path); - s->source = underlying; s->allow_caching = true; s->is_network = sinfo->is_network; s->mode = flags & (STREAM_READ | STREAM_WRITE); @@ -355,7 +347,7 @@ struct stream *stream_create(const char *url, int flags, // Open stream proper bool unsafe = false; for (int i = 0; stream_list[i]; i++) { - int r = open_internal(stream_list[i], NULL, url, flags, c, global, &s); + int r = open_internal(stream_list[i], url, flags, c, global, &s); if (r == STREAM_OK) break; if (r == STREAM_NO_MATCH || r == STREAM_UNSUPPORTED) @@ -384,19 +376,6 @@ struct stream *stream_create(const char *url, int flags, goto done; } - // Open stream filters - for (;;) { - struct stream *new = NULL; - for (int i = 0; stream_list[i]; i++) { - int r = open_internal(stream_list[i], s, s->url, flags, c, global, &new); - if (r == STREAM_OK) - break; - } - if (!new) - break; - s = new; - } - done: talloc_free(log); return s; @@ -728,7 +707,6 @@ void free_stream(stream_t *s) if (s->close) s->close(s); free_stream(s->uncached_stream); - free_stream(s->source); talloc_free(s); } diff --git a/stream/stream.h b/stream/stream.h index b824aaf356..9908951bad 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -54,7 +54,6 @@ enum streamtype { #define STREAM_WRITE 1 // flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE) -#define STREAM_NO_FILTERS 2 #define STREAM_SAFE_ONLY 4 #define STREAM_NETWORK_ONLY 8 @@ -157,7 +156,6 @@ typedef struct stream_info_st { void *(*get_defaults)(struct stream *st); const struct m_option *options; const char *const *url_options; - bool stream_filter; bool can_write; // correctly checks for READ/WRITE modes bool is_safe; // opening is no security issue, even with remote provided URLs bool is_network; // used to restrict remote playlist entries to remote URLs @@ -209,7 +207,6 @@ typedef struct stream { char *capture_filename; struct stream *uncached_stream; // underlying stream for cache wrapper - struct stream *source; // Includes additional padding in case sizes get rounded up by sector size. unsigned char buffer[]; diff --git a/stream/stream_rar.c b/stream/stream_rar.c index e795c9cd78..1051e05ab4 100644 --- a/stream/stream_rar.c +++ b/stream/stream_rar.c @@ -98,8 +98,8 @@ static int rar_entry_open(stream_t *stream) *name++ = '\0'; mp_url_unescape_inplace(base); - struct stream *rar = stream_create(base, STREAM_READ | STREAM_NO_FILTERS, - stream->cancel, stream->global); + struct stream *rar = stream_create(base, STREAM_READ, stream->cancel, + stream->global); if (!rar) return STREAM_ERROR; -- cgit v1.2.3