summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-24 14:04:09 +0200
committerwm4 <wm4@nowhere>2014-05-24 16:17:51 +0200
commita4d487f5b2930611bf908243510d6f0351ebcf58 (patch)
tree000fc31412c31ea60ef0b7c59af087e6402b4541 /stream/stream.h
parente3c20bf3505679641f247471603ad298d04036bd (diff)
downloadmpv-a4d487f5b2930611bf908243510d6f0351ebcf58.tar.bz2
mpv-a4d487f5b2930611bf908243510d6f0351ebcf58.tar.xz
stream: don't use end_pos
Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The advantage is that always the correct size will be used. There can be no doubt anymore whether the end_pos value is outdated (as it happens often with files that are being downloaded). Some streams still use end_pos. They don't change size, and it's easier to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a STREAM_CTRL_GET_SIZE implementation to these streams. Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was uint64_t before). Remove the seek flags mess, and replace them with a seekable flag. Every stream must set it consistently now, and an assertion in stream.c checks this. Don't distinguish between streams that can only be forward or backwards seeked, since we have no such stream types.
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/stream/stream.h b/stream/stream.h
index 2182de2526..5fc4c58579 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -57,12 +57,6 @@ enum streamtype {
// 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
@@ -143,11 +137,11 @@ typedef struct stream {
enum streamtype type; // see STREAMTYPE_*
enum streamtype uncached_type; // if stream is cache, type of wrapped str.
- int flags; // MP_STREAM_SEEK_* or'ed flags
int sector_size; // sector size (seek will be aligned on this size if non 0)
int read_chunk; // maximum amount of data to read at once to limit latency
unsigned int buf_pos, buf_len;
- int64_t pos, end_pos;
+ int64_t pos;
+ uint64_t end_pos; // static size; use STREAM_CTRL_GET_SIZE instead
int eof;
int mode; //STREAM_READ or STREAM_WRITE
bool streaming; // known to be a network stream if true
@@ -157,8 +151,10 @@ typedef struct stream {
char *mime_type; // when HTTP streaming is used
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
+ bool seekable : 1; // presence of general byte seeking support
+ bool fast_skip : 1; // consider stream fast enough to fw-seek by skipping
+ bool safe_origin : 1; // used for playlists that can be opened safely
+ bool allow_caching : 1; // stream cache makes sense
struct mp_log *log;
struct MPOpts *opts;
struct mpv_global *global;
@@ -219,7 +215,6 @@ struct mpv_global;
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
int max_size);
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 mpv_global *global);
struct stream *stream_open(const char *filename, struct mpv_global *global);