summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-25 22:50:16 +0200
committerwm4 <wm4@nowhere>2013-08-26 10:09:45 +0200
commit74b846e2f7d95e4dea2fdae4b1301a2c83f2acd3 (patch)
treee507489f4ec492740cc59dd0796dc1ec68348027 /stream/stream.h
parentf3a7849ba67d1e6b7a59f538feb586bfe19b4863 (diff)
downloadmpv-74b846e2f7d95e4dea2fdae4b1301a2c83f2acd3.tar.bz2
mpv-74b846e2f7d95e4dea2fdae4b1301a2c83f2acd3.tar.xz
stream: change open code, add stream filter concept
Add a stream filter concept, in which streams can be opened on top of an underlying "source" stream. Change the open code to make this easier, and also to account for some mechanisms that will be needed for this. The following commit will add stream_rar, which contains such a stream filter.
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/stream/stream.h b/stream/stream.h
index 1009a2a7b0..6f389ceb04 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -57,12 +57,16 @@ enum streamtype {
#define STREAM_READ 0
#define STREAM_WRITE 1
+// flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE)
+#define STREAM_NO_FILTERS 2
+
// stream->flags
#define MP_STREAM_FAST_SKIPPING 1 // allow forward seeks by skipping
#define MP_STREAM_SEEK_BW 2
#define MP_STREAM_SEEK_FW 4
#define MP_STREAM_SEEK (MP_STREAM_SEEK_BW | MP_STREAM_SEEK_FW)
+#define STREAM_NO_MATCH -2
#define STREAM_UNSUPPORTED -1
#define STREAM_ERROR 0
#define STREAM_OK 1
@@ -116,6 +120,7 @@ typedef struct stream_info_st {
const void *priv_defaults;
const struct m_option *options;
const char **url_options;
+ bool stream_filter;
} stream_info_t;
typedef struct stream {
@@ -156,7 +161,8 @@ typedef struct stream {
FILE *capture_file;
char *capture_filename;
- struct stream *uncached_stream;
+ 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[];
@@ -234,6 +240,7 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
int stream_control(stream_t *s, int cmd, void *arg);
void stream_update_size(stream_t *s);
void free_stream(stream_t *s);
+struct stream *stream_create(const char *url, int flags, struct MPOpts *options);
struct stream *stream_open(const char *filename, struct MPOpts *options);
stream_t *open_output_stream(const char *filename, struct MPOpts *options);
stream_t *open_memory_stream(void *data, int len);