mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
stream: get rid of streamtype enum
Because it's kind of dumb. (But not sure if it was worth the trouble.) For stream_file.c, we add new explicit fields. The rest are rather special uses and can be killed by comparing the stream impl. name. The changes to DVD/BD/CD/TV are entirely untested.
This commit is contained in:
@@ -258,8 +258,6 @@ static int open_internal(const stream_info_t *sinfo, const char *url, int flags,
|
||||
|
||||
assert(s->seekable == !!s->seek);
|
||||
|
||||
s->uncached_type = s->type;
|
||||
|
||||
if (s->mime_type)
|
||||
MP_VERBOSE(s, "Mime-type: '%s'\n", s->mime_type);
|
||||
|
||||
@@ -635,7 +633,6 @@ stream_t *open_memory_stream(void *data, int len)
|
||||
static stream_t *open_cache(stream_t *orig, const char *name)
|
||||
{
|
||||
stream_t *cache = new_stream();
|
||||
cache->uncached_type = orig->uncached_type;
|
||||
cache->underlying = orig;
|
||||
cache->caching = true;
|
||||
cache->seekable = true;
|
||||
@@ -648,6 +645,8 @@ static stream_t *open_cache(stream_t *orig, const char *name)
|
||||
cache->lavf_type = talloc_strdup(cache, orig->lavf_type);
|
||||
cache->streaming = orig->streaming,
|
||||
cache->is_network = orig->is_network;
|
||||
cache->is_local_file = orig->is_local_file;
|
||||
cache->is_directory = orig->is_directory;
|
||||
cache->cancel = orig->cancel;
|
||||
cache->global = orig->global;
|
||||
|
||||
|
||||
@@ -28,20 +28,6 @@
|
||||
|
||||
#include "misc/bstr.h"
|
||||
|
||||
enum streamtype {
|
||||
STREAMTYPE_GENERIC = 0,
|
||||
STREAMTYPE_FILE,
|
||||
STREAMTYPE_DIR,
|
||||
STREAMTYPE_DVB,
|
||||
STREAMTYPE_DVD,
|
||||
STREAMTYPE_BLURAY,
|
||||
STREAMTYPE_TV,
|
||||
STREAMTYPE_MF,
|
||||
STREAMTYPE_EDL,
|
||||
STREAMTYPE_AVDEVICE,
|
||||
STREAMTYPE_CDDA,
|
||||
};
|
||||
|
||||
#define STREAM_BUFFER_SIZE 2048
|
||||
#define STREAM_MAX_SECTOR_SIZE (8 * 1024)
|
||||
|
||||
@@ -178,8 +164,6 @@ typedef struct stream {
|
||||
// Close
|
||||
void (*close)(struct stream *s);
|
||||
|
||||
enum streamtype type; // see STREAMTYPE_*
|
||||
enum streamtype uncached_type; // if stream is cache, type of wrapped str.
|
||||
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;
|
||||
@@ -198,6 +182,8 @@ typedef struct stream {
|
||||
bool is_network : 1; // original stream_info_t.is_network flag
|
||||
bool allow_caching : 1; // stream cache makes sense
|
||||
bool caching : 1; // is a cache, or accesses a cache
|
||||
bool is_local_file : 1; // from the filesystem
|
||||
bool is_directory : 1; // directory on the filesystem
|
||||
bool access_references : 1; // open other streams
|
||||
struct mp_log *log;
|
||||
struct mpv_global *global;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
static int open_f(stream_t *stream)
|
||||
{
|
||||
stream->type = STREAMTYPE_AVDEVICE;
|
||||
stream->demuxer = "lavf";
|
||||
stream->allow_caching = false;
|
||||
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,6 @@ static int bluray_stream_open_internal(stream_t *s)
|
||||
s->fill_buffer = bluray_stream_fill_buffer;
|
||||
s->close = bluray_stream_close;
|
||||
s->control = bluray_stream_control;
|
||||
s->type = STREAMTYPE_BLURAY;
|
||||
s->sector_size = BLURAY_SECTOR_SIZE;
|
||||
s->priv = b;
|
||||
s->demuxer = "+disc";
|
||||
|
||||
@@ -383,7 +383,6 @@ static int open_cdda(stream_t *st)
|
||||
|
||||
st->streaming = true;
|
||||
|
||||
st->type = STREAMTYPE_CDDA;
|
||||
st->demuxer = "+disc";
|
||||
|
||||
print_cdtext(st, 0);
|
||||
|
||||
@@ -990,7 +990,6 @@ static int dvb_open(stream_t *stream)
|
||||
return STREAM_ERROR;
|
||||
}
|
||||
|
||||
stream->type = STREAMTYPE_DVB;
|
||||
stream->fill_buffer = dvb_streaming_read;
|
||||
stream->close = dvbin_close;
|
||||
stream->control = dvbin_stream_control;
|
||||
|
||||
@@ -904,7 +904,6 @@ static int open_s_internal(stream_t *stream)
|
||||
|
||||
// ... (unimplemented)
|
||||
// return NULL;
|
||||
stream->type = STREAMTYPE_DVD;
|
||||
stream->demuxer = "+disc";
|
||||
stream->lavf_type = "mpeg";
|
||||
stream->sector_size = 2048;
|
||||
|
||||
@@ -507,7 +507,6 @@ static int open_s_internal(stream_t *stream)
|
||||
stream->fill_buffer = fill_buffer;
|
||||
stream->control = control;
|
||||
stream->close = stream_dvdnav_close;
|
||||
stream->type = STREAMTYPE_DVD;
|
||||
stream->demuxer = "+disc";
|
||||
stream->lavf_type = "mpeg";
|
||||
stream->allow_caching = false;
|
||||
@@ -596,7 +595,7 @@ unsupported:
|
||||
}
|
||||
|
||||
const stream_info_t stream_info_ifo_dvdnav = {
|
||||
.name = "ifo/dvdnav",
|
||||
.name = "ifo_dvdnav",
|
||||
.open = ifo_dvdnav_stream_open,
|
||||
.protocols = (const char*const[]){ "file", "", NULL },
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
static int s_open (struct stream *stream)
|
||||
{
|
||||
stream->type = STREAMTYPE_EDL;
|
||||
stream->demuxer = "edl";
|
||||
stream->allow_caching = false;
|
||||
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ static int open_f(stream_t *stream)
|
||||
.fd = -1
|
||||
};
|
||||
stream->priv = p;
|
||||
stream->type = STREAMTYPE_FILE;
|
||||
stream->is_local_file = true;
|
||||
|
||||
bool write = stream->mode == STREAM_WRITE;
|
||||
int m = O_CLOEXEC | (write ? O_RDWR | O_CREAT | O_TRUNC : O_RDONLY);
|
||||
@@ -281,7 +281,7 @@ static int open_f(stream_t *stream)
|
||||
if (fstat(p->fd, &st) == 0) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
p->use_poll = false;
|
||||
stream->type = STREAMTYPE_DIR;
|
||||
stream->is_directory = true;
|
||||
stream->allow_caching = false;
|
||||
MP_INFO(stream, "This is a directory - adding to playlist.\n");
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
static int
|
||||
mf_stream_open (stream_t *stream)
|
||||
{
|
||||
stream->type = STREAMTYPE_MF;
|
||||
stream->demuxer = "mf";
|
||||
stream->allow_caching = false;
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ static int
|
||||
tv_stream_open (stream_t *stream)
|
||||
{
|
||||
|
||||
stream->type = STREAMTYPE_TV;
|
||||
stream->close=tv_stream_close;
|
||||
stream->demuxer = "tv";
|
||||
stream->allow_caching = false;
|
||||
|
||||
Reference in New Issue
Block a user