summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-19 16:48:46 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commite40885d963f8b60d83aa5ea8104985dd20af262f (patch)
tree82c2fd8284e9a81a211dc7755f5e40e97926cd6e /demux
parentde3ecc60cb5ac39e727d8bd1fe4f9e3499f8e672 (diff)
downloadmpv-e40885d963f8b60d83aa5ea8104985dd20af262f.tar.bz2
mpv-e40885d963f8b60d83aa5ea8104985dd20af262f.tar.xz
stream: create memory streams in more straightforward way
Instead of having to rely on the protocol matching, make a function that creates a stream from a stream_info_t directly. Instead of going through a weird indirection with STREAM_CTRL, add a direct argument for non-text arguments to the open callback. Instead of creating a weird dummy mpv_global, just pass an existing one from all callers. (The latter one is just an artifact from the past, where mpv_global wasn't available everywhere.) Actually I just wanted a function that creates a stream without any of that bullshit. This goal was slightly missed, since you still need this heavy "constructor" just to setup a shitty struct with some shitty callbacks.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c2
-rw-r--r--demux/demux_lavf.c2
-rw-r--r--demux/demux_libarchive.c3
-rw-r--r--demux/demux_playlist.c2
4 files changed, 5 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 2ce9010a86..075db9bd26 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -2968,7 +2968,7 @@ void demux_close_stream(struct demuxer *demuxer)
MP_VERBOSE(demuxer, "demuxer read all data; closing stream\n");
free_stream(demuxer->stream);
- demuxer->stream = open_memory_stream(NULL, 0); // dummy
+ demuxer->stream = stream_memory_open(demuxer->global, NULL, 0); // dummy
demuxer->stream->cancel = demuxer->cancel;
in->d_user->stream = demuxer->stream;
}
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 881d38b4df..bacbfa24de 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -396,7 +396,7 @@ static void convert_charset(struct demuxer *demuxer)
data = conv;
}
if (data.start) {
- priv->stream = open_memory_stream(data.start, data.len);
+ priv->stream = stream_memory_open(demuxer->global, data.start, data.len);
priv->own_stream = true;
}
talloc_free(alloc);
diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c
index c20990ae64..51c4e46f03 100644
--- a/demux/demux_libarchive.c
+++ b/demux/demux_libarchive.c
@@ -45,7 +45,8 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
bstr probe = stream_peek(demuxer->stream, probe_size);
if (probe.len == 0)
return -1;
- struct stream *probe_stream = open_memory_stream(probe.start, probe.len);
+ struct stream *probe_stream =
+ stream_memory_open(demuxer->global, probe.start, probe.len);
struct mp_archive *mpa = mp_archive_new(mp_null_log, probe_stream, flags);
bool ok = !!mpa;
free_stream(probe_stream);
diff --git a/demux/demux_playlist.c b/demux/demux_playlist.c
index b36e9cdfe1..897b83465f 100644
--- a/demux/demux_playlist.c
+++ b/demux/demux_playlist.c
@@ -366,7 +366,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
p->add_base = true;
bstr probe_buf = stream_peek(demuxer->stream, PROBE_SIZE);
- p->s = open_memory_stream(probe_buf.start, probe_buf.len);
+ p->s = stream_memory_open(demuxer->global, probe_buf.start, probe_buf.len);
p->s->mime_type = demuxer->stream->mime_type;
p->utf16 = stream_skip_bom(p->s);
p->force = force;