1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00

stream: remove stream filter concept

Unused since the previous commit. (Apparently it was a stupid idea.)
This commit is contained in:
wm4 2015-02-27 19:51:14 +01:00
parent 5824eb7107
commit fbf76da913
5 changed files with 16 additions and 43 deletions

View File

@ -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()

View File

@ -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;

View File

@ -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);
}

View File

@ -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[];

View File

@ -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;