summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/asxparser.c3
-rw-r--r--core/encode_lavc.c2
-rw-r--r--core/input/input.c2
-rw-r--r--core/mplayer.c34
-rw-r--r--core/playlist_parser.c5
-rw-r--r--core/timeline/tl_cue.c7
-rw-r--r--core/timeline/tl_edl.c7
-rw-r--r--core/timeline/tl_matroska.c17
-rw-r--r--demux/demux.c40
-rw-r--r--demux/demux.h9
-rw-r--r--demux/demux_mf.c2
-rw-r--r--stream/stream.c42
-rw-r--r--stream/stream.h7
-rw-r--r--stream/stream_avdevice.c4
-rw-r--r--stream/stream_bluray.c3
-rw-r--r--stream/stream_cdda.c4
-rw-r--r--stream/stream_dvb.c4
-rw-r--r--stream/stream_dvd.c7
-rw-r--r--stream/stream_file.c3
-rw-r--r--stream/stream_lavf.c10
-rw-r--r--stream/stream_memory.c2
-rw-r--r--stream/stream_mf.c4
-rw-r--r--stream/stream_null.c3
-rw-r--r--stream/stream_pvr.c2
-rw-r--r--stream/stream_radio.c5
-rw-r--r--stream/stream_smb.c3
-rw-r--r--stream/stream_tv.c4
-rw-r--r--stream/stream_vcd.c5
-rw-r--r--video/out/gl_lcms.c2
29 files changed, 84 insertions, 158 deletions
diff --git a/core/asxparser.c b/core/asxparser.c
index 17ce6b3e8c..0fc10eb059 100644
--- a/core/asxparser.c
+++ b/core/asxparser.c
@@ -451,7 +451,6 @@ asx_parse_ref(ASX_Parser_t* parser, char** attribs) {
static void asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) {
char *href;
stream_t* stream;
- int f=DEMUXER_TYPE_UNKNOWN;
if(parser->deep > 0)
return;
@@ -461,7 +460,7 @@ static void asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs
asx_warning_attrib_required(parser,"ENTRYREF" ,"HREF" );
return;
}
- stream=open_stream(href,0,&f);
+ stream=stream_open(href, NULL);
if(!stream) {
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",href);
free(href);
diff --git a/core/encode_lavc.c b/core/encode_lavc.c
index 9fada7de58..75e57a2443 100644
--- a/core/encode_lavc.c
+++ b/core/encode_lavc.c
@@ -397,7 +397,7 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx,
buf[sizeof(buf) - 1] = 0;
if (value_has_flag(de ? de->value : "", "pass2")) {
- if (!(*bytebuf = open_stream(buf, NULL, NULL))) {
+ if (!(*bytebuf = stream_open(buf, NULL))) {
mp_msg(MSGT_ENCODE, MSGL_WARN, "%s: could not open '%s', "
"disabling 2-pass encoding at pass 2\n", prefix, buf);
stream->codec->flags &= ~CODEC_FLAG_PASS2;
diff --git a/core/input/input.c b/core/input/input.c
index e87d9bb560..e736c6486d 100644
--- a/core/input/input.c
+++ b/core/input/input.c
@@ -1969,7 +1969,7 @@ static int parse_config_file(struct input_ctx *ictx, char *file, bool warn)
"Input config file %s not found.\n", file);
return 0;
}
- stream_t *s = open_stream(file, NULL, NULL);
+ stream_t *s = stream_open(file, NULL);
if (!s) {
mp_msg(MSGT_INPUT, MSGL_ERR, "Can't open input config file %s.\n", file);
return 0;
diff --git a/core/mplayer.c b/core/mplayer.c
index 026af6a989..73108d8d34 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -3882,11 +3882,10 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename,
struct MPOpts *opts = &mpctx->opts;
if (!filename)
return NULL;
- int format = 0;
char *disp_filename = filename;
if (strncmp(disp_filename, "memory://", 9) == 0)
disp_filename = "memory://"; // avoid noise
- struct stream *stream = open_stream(filename, &mpctx->opts, &format);
+ struct stream *stream = stream_open(filename, &mpctx->opts);
if (!stream)
goto err_out;
stream_enable_cache_percent(&stream, stream_cache,
@@ -3896,8 +3895,7 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename,
.ass_library = mpctx->ass_library, // demux_libass requires it
};
struct demuxer *demuxer =
- demux_open_withparams(&mpctx->opts, stream, format, demuxer_name,
- filename, &params);
+ demux_open(stream, demuxer_name, &params, &mpctx->opts);
if (!demuxer) {
free_stream(stream);
goto err_out;
@@ -4156,36 +4154,13 @@ static void play_current_file(struct MPContext *mpctx)
}
stream_filename = mpctx->resolve_result->url;
}
- int file_format = DEMUXER_TYPE_UNKNOWN;
- mpctx->stream = open_stream(stream_filename, opts, &file_format);
+ mpctx->stream = stream_open(stream_filename, opts);
if (!mpctx->stream) { // error...
demux_was_interrupted(mpctx);
goto terminate_playback;
}
mpctx->initialized_flags |= INITIALIZED_STREAM;
- if (file_format == DEMUXER_TYPE_PLAYLIST) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "\nThis looks like a playlist, but "
- "playlist support will not be used automatically.\n"
- "mpv's playlist code is unsafe and should only be used with "
- "trusted sources.\nPlayback will probably fail.\n\n");
-#if 0
- // Handle playlist
- mp_msg(MSGT_CPLAYER, MSGL_WARN, "Parsing playlist %s...\n",
- mpctx->filename);
- bool empty = true;
- struct playlist *pl = playlist_parse(mpctx->stream);
- if (pl) {
- empty = pl->first == NULL;
- playlist_transfer_entries(mpctx->playlist, pl);
- talloc_free(pl);
- }
- if (empty)
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "Playlist was invalid or empty!\n");
- mpctx->stop_play = PT_NEXT_ENTRY;
- goto terminate_playback;
-#endif
- }
mpctx->stream->start_pos += opts->seek_to_byte;
if (opts->stream_dump && opts->stream_dump[0]) {
@@ -4212,8 +4187,7 @@ goto_reopen_demuxer: ;
mpctx->audio_delay = opts->audio_delay;
- mpctx->demuxer = demux_open(opts, mpctx->stream, file_format,
- mpctx->filename);
+ mpctx->demuxer = demux_open(mpctx->stream, NULL, NULL, opts);
mpctx->master_demuxer = mpctx->demuxer;
if (!mpctx->demuxer) {
diff --git a/core/playlist_parser.c b/core/playlist_parser.c
index 67d58024c1..59d5123be6 100644
--- a/core/playlist_parser.c
+++ b/core/playlist_parser.c
@@ -699,10 +699,7 @@ err_out:
struct playlist *playlist_parse_file(const char *file)
{
- stream_t *stream;
- int f=DEMUXER_TYPE_PLAYLIST;
-
- stream = open_stream(file, 0, &f);
+ stream_t *stream = stream_open(file, NULL);
if(!stream) {
mp_msg(MSGT_PLAYTREE,MSGL_ERR,
"Error while opening playlist file %s: %s\n",
diff --git a/core/timeline/tl_cue.c b/core/timeline/tl_cue.c
index a965cfd877..1953f46116 100644
--- a/core/timeline/tl_cue.c
+++ b/core/timeline/tl_cue.c
@@ -188,11 +188,10 @@ static bool try_open(struct MPContext *mpctx, char *filename)
|| bstrcasecmp(bstr0(mpctx->demuxer->filename), bfilename) == 0)
return false;
- int format = 0;
- struct stream *s = open_stream(filename, &mpctx->opts, &format);
+ struct stream *s = stream_open(filename, &mpctx->opts);
if (!s)
return false;
- struct demuxer *d = demux_open(&mpctx->opts, s, format, filename);
+ struct demuxer *d = demux_open(s, NULL, NULL, &mpctx->opts);
// Since .bin files are raw PCM data with no headers, we have to explicitly
// open them. Also, try to avoid to open files that are most likely not .bin
// files, as that would only play noise. Checking the file extension is
@@ -201,7 +200,7 @@ static bool try_open(struct MPContext *mpctx, char *filename)
// CD sector size (2352 bytes)
if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) {
mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n");
- d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, filename);
+ d = demux_open(s, "rawaudio", NULL, &mpctx->opts);
}
if (d) {
add_source(mpctx, d);
diff --git a/core/timeline/tl_edl.c b/core/timeline/tl_edl.c
index 0303956513..6096d03b6a 100644
--- a/core/timeline/tl_edl.c
+++ b/core/timeline/tl_edl.c
@@ -354,13 +354,10 @@ void build_edl_timeline(struct MPContext *mpctx)
mpctx->num_sources = 1;
for (int i = 0; i < num_sources; i++) {
- int format = 0;
- struct stream *s = open_stream(edl_ids[i].filename, &mpctx->opts,
- &format);
+ struct stream *s = stream_open(edl_ids[i].filename, &mpctx->opts);
if (!s)
goto openfail;
- struct demuxer *d = demux_open(&mpctx->opts, s, format,
- edl_ids[i].filename);
+ struct demuxer *d = demux_open(s, NULL, NULL, &mpctx->opts);
if (!d) {
free_stream(s);
openfail:
diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c
index 6752b5ff4c..614ce0d6b7 100644
--- a/core/timeline/tl_matroska.c
+++ b/core/timeline/tl_matroska.c
@@ -113,13 +113,6 @@ static char **find_files(const char *original_file, const char *suffix)
return results;
}
-static struct demuxer *open_demuxer(struct stream *stream,
- struct MPContext *mpctx, char *filename, struct demuxer_params *params)
-{
- return demux_open_withparams(&mpctx->opts, stream,
- DEMUXER_TYPE_MATROSKA, NULL, filename, params);
-}
-
static int enable_cache(struct MPContext *mpctx, struct stream **stream,
struct demuxer **demuxer, struct demuxer_params *params)
{
@@ -133,8 +126,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream,
free_demuxer(*demuxer);
free_stream(*stream);
- int format = 0;
- *stream = open_stream(filename, &mpctx->opts, &format);
+ *stream = stream_open(filename, &mpctx->opts);
if (!*stream) {
talloc_free(filename);
return -1;
@@ -145,7 +137,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream,
opts->stream_cache_min_percent,
opts->stream_cache_seek_min_percent);
- *demuxer = open_demuxer(*stream, mpctx, filename, params);
+ *demuxer = demux_open(*stream, "mkv", params, &mpctx->opts);
if (!*demuxer) {
talloc_free(filename);
free_stream(*stream);
@@ -167,11 +159,10 @@ static bool check_file_seg(struct MPContext *mpctx, struct demuxer **sources,
.matroska_wanted_segment = segment,
.matroska_was_valid = &was_valid,
};
- int format = 0;
- struct stream *s = open_stream(filename, &mpctx->opts, &format);
+ struct stream *s = stream_open(filename, &mpctx->opts);
if (!s)
return false;
- struct demuxer *d = open_demuxer(s, mpctx, filename, &params);
+ struct demuxer *d = demux_open(s, "mkv", &params, &mpctx->opts);
if (!d) {
free_stream(s);
diff --git a/demux/demux.c b/demux/demux.c
index 64fee955ed..5a0e05d48f 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -242,8 +242,7 @@ static const demuxer_desc_t *get_demuxer_desc_from_type(int file_format)
}
-static demuxer_t *new_demuxer(struct MPOpts *opts, stream_t *stream, int type,
- char *filename)
+static demuxer_t *new_demuxer(struct MPOpts *opts, stream_t *stream, int type)
{
struct demuxer *d = talloc_zero(NULL, struct demuxer);
d->stream = stream;
@@ -259,8 +258,8 @@ static demuxer_t *new_demuxer(struct MPOpts *opts, stream_t *stream, int type,
mp_msg(MSGT_DEMUXER, MSGL_ERR,
"BUG! Invalid demuxer type in new_demuxer(), "
"big troubles ahead.\n");
- if (filename) // Filename hack for avs_check_file
- d->filename = strdup(filename);
+ if (stream->url)
+ d->filename = strdup(stream->url);
stream_seek(stream, stream->start_pos);
return d;
}
@@ -590,13 +589,12 @@ static int get_demuxer_type_from_name(char *demuxer_name, int *force)
static struct demuxer *open_given_type(struct MPOpts *opts,
const struct demuxer_desc *desc,
struct stream *stream, bool force,
- char *filename,
struct demuxer_params *params)
{
struct demuxer *demuxer;
int fformat = desc->type;
mp_msg(MSGT_DEMUXER, MSGL_V, "Trying demuxer: %s\n", desc->name);
- demuxer = new_demuxer(opts, stream, desc->type, filename);
+ demuxer = new_demuxer(opts, stream, desc->type);
demuxer->params = params;
if (!force) {
if (desc->check_file)
@@ -644,20 +642,20 @@ static struct demuxer *open_given_type(struct MPOpts *opts,
"BUG: recursion to nonexistent file format\n");
return NULL;
}
- return open_given_type(opts, desc, stream, false, filename, params);
+ return open_given_type(opts, desc, stream, false, params);
}
fail:
free_demuxer(demuxer);
return NULL;
}
-struct demuxer *demux_open_withparams(struct MPOpts *opts,
- struct stream *stream, int file_format,
- char *force_format, char *filename,
- struct demuxer_params *params)
+struct demuxer *demux_open(struct stream *stream, char *force_format,
+ struct demuxer_params *params, struct MPOpts *opts)
{
struct demuxer *demuxer = NULL;
const struct demuxer_desc *desc;
+ if (!force_format)
+ force_format = opts->demuxer_name;
int force = 0;
int demuxer_type;
@@ -666,6 +664,7 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
force_format);
return NULL;
}
+ int file_format = 0;
if (demuxer_type)
file_format = demuxer_type;
@@ -675,13 +674,13 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
if (!desc)
// should only happen with obsolete -demuxer 99 numeric format
return NULL;
- return open_given_type(opts, desc, stream, force, filename, params);
+ return open_given_type(opts, desc, stream, force, params);
}
// Test demuxers with safe file checks
for (int i = 0; (desc = demuxer_list[i]); i++) {
if (desc->safe_check) {
- demuxer = open_given_type(opts, desc, stream, false, filename, params);
+ demuxer = open_given_type(opts, desc, stream, false, params);
if (demuxer)
return demuxer;
}
@@ -690,10 +689,10 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
// Ok. We're over the stable detectable fileformats, the next ones are
// a bit fuzzy. So by default (extension_parsing==1) try extension-based
// detection first:
- if (filename && opts->extension_parsing == 1) {
- desc = get_demuxer_desc_from_type(demuxer_type_by_filename(filename));
+ if (stream->url && opts->extension_parsing == 1) {
+ desc = get_demuxer_desc_from_type(demuxer_type_by_filename(stream->url));
if (desc)
- demuxer = open_given_type(opts, desc, stream, false, filename, params);
+ demuxer = open_given_type(opts, desc, stream, false, params);
if (demuxer)
return demuxer;
}
@@ -701,7 +700,7 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
// Finally try detection for demuxers with unsafe checks
for (int i = 0; (desc = demuxer_list[i]); i++) {
if (!desc->safe_check && desc->check_file) {
- demuxer = open_given_type(opts, desc, stream, false, filename, params);
+ demuxer = open_given_type(opts, desc, stream, false, params);
if (demuxer)
return demuxer;
}
@@ -710,13 +709,6 @@ struct demuxer *demux_open_withparams(struct MPOpts *opts,
return NULL;
}
-struct demuxer *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
- char *filename)
-{
- return demux_open_withparams(opts, vs, file_format, opts->demuxer_name,
- filename, NULL);
-}
-
void demux_flush(demuxer_t *demuxer)
{
for (int n = 0; n < demuxer->num_streams; n++)
diff --git a/demux/demux.h b/demux/demux.h
index c43f0282fb..f64a02dce1 100644
--- a/demux/demux.h
+++ b/demux/demux.h
@@ -230,13 +230,8 @@ bool demux_stream_eof(struct sh_stream *sh);
struct sh_stream *new_sh_stream(struct demuxer *demuxer, enum stream_type type);
-struct demuxer *demux_open(struct MPOpts *opts, struct stream *stream,
- int file_format, char *filename);
-
-struct demuxer *demux_open_withparams(struct MPOpts *opts,
- struct stream *stream, int file_format,
- char *force_format, char *filename,
- struct demuxer_params *params);
+struct demuxer *demux_open(struct stream *stream, char *force_format,
+ struct demuxer_params *params, struct MPOpts *opts);
void demux_flush(struct demuxer *demuxer);
int demux_seek(struct demuxer *demuxer, float rel_seek_secs, float audio_delay,
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 3a72558208..5e3469a0f1 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -74,7 +74,7 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer)
if (!stream) {
char *filename = mf->names[mf->curr_frame];
if (filename)
- stream = open_stream(filename, demuxer->opts, NULL);
+ stream = stream_open(filename, demuxer->opts);
}
if (stream) {
diff --git a/stream/stream.c b/stream/stream.c
index 3dc25d7880..32ae0047be 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -131,10 +131,8 @@ static stream_t *new_stream(size_t min_size);
static int stream_seek_unbuffered(stream_t *s, int64_t newpos);
static stream_t *open_stream_plugin(const stream_info_t *sinfo,
- const char *filename,
- int mode, struct MPOpts *options,
- int *file_format, int *ret,
- char **redirected_url)
+ const char *filename, int mode,
+ struct MPOpts *options, int *ret)
{
void *arg = NULL;
stream_t *s;
@@ -162,7 +160,7 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
s->url = strdup(filename);
s->flags = 0;
s->mode = mode;
- *ret = sinfo->open(s, mode, arg, file_format);
+ *ret = sinfo->open(s, mode, arg);
if ((*ret) != STREAM_OK) {
free(s->url);
talloc_free(s);
@@ -201,21 +199,14 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
static stream_t *open_stream_full(const char *filename, int mode,
- struct MPOpts *options, int *file_format)
+ struct MPOpts *options)
{
int i, j, l, r;
const stream_info_t *sinfo;
stream_t *s;
- char *redirected_url = NULL;
assert(filename);
- int dummy;
- if (!file_format)
- file_format = &dummy;
-
- *file_format = DEMUXER_TYPE_UNKNOWN;
-
for (i = 0; auto_open_streams[i]; i++) {
sinfo = auto_open_streams[i];
if (!sinfo->protocols) {
@@ -230,22 +221,10 @@ static stream_t *open_stream_full(const char *filename, int mode,
if ((l == 0 && !strstr(filename, "://")) ||
((strncasecmp(sinfo->protocols[j], filename, l) == 0) &&
(strncmp("://", filename + l, 3) == 0))) {
- *file_format = DEMUXER_TYPE_UNKNOWN;
- s =
- open_stream_plugin(sinfo, filename, mode, options,
- file_format,
- &r,
- &redirected_url);
+ s = open_stream_plugin(sinfo, filename, mode, options, &r);
if (s)
return s;
- if (r == STREAM_REDIRECTED && redirected_url) {
- mp_msg(MSGT_OPEN, MSGL_V, "[%s] open %s redirected to %s\n",
- sinfo->info, filename, redirected_url);
- s = open_stream_full(redirected_url, mode, options,
- file_format);
- free(redirected_url);
- return s;
- } else if (r != STREAM_UNSUPPORTED) {
+ if (r != STREAM_UNSUPPORTED) {
mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to open %s.\n",
filename);
return NULL;
@@ -259,15 +238,14 @@ static stream_t *open_stream_full(const char *filename, int mode,
return NULL;
}
-stream_t *open_stream(const char *filename, struct MPOpts *options,
- int *file_format)
+struct stream *stream_open(const char *filename, struct MPOpts *options)
{
- return open_stream_full(filename, STREAM_READ, options, file_format);
+ return open_stream_full(filename, STREAM_READ, options);
}
stream_t *open_output_stream(const char *filename, struct MPOpts *options)
{
- return open_stream_full(filename, STREAM_WRITE, options, NULL);
+ return open_stream_full(filename, STREAM_WRITE, options);
}
static int stream_reconnect(stream_t *s)
@@ -655,7 +633,7 @@ int stream_check_interrupt(int time)
stream_t *open_memory_stream(void *data, int len)
{
assert(len >= 0);
- stream_t *s = open_stream("memory://", NULL, NULL);
+ stream_t *s = stream_open("memory://", NULL);
assert(s);
stream_control(s, STREAM_CTRL_SET_CONTENTS, &(bstr){data, len});
return s;
diff --git a/stream/stream.h b/stream/stream.h
index 149618ccd6..0d7e02ed4d 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -70,7 +70,6 @@
#define MP_STREAM_SEEK_FW 4
#define MP_STREAM_SEEK (MP_STREAM_SEEK_BW | MP_STREAM_SEEK_FW)
-#define STREAM_REDIRECTED -2
#define STREAM_UNSUPPORTED -1
#define STREAM_ERROR 0
#define STREAM_OK 1
@@ -121,7 +120,7 @@ typedef struct stream_info_st {
const char *author;
const char *comment;
// opts is set from ->opts
- int (*open)(struct stream *st, int mode, void *opts, int *file_format);
+ int (*open)(struct stream *st, int mode, void *opts);
const char *protocols[MAX_STREAM_PROTOCOLS];
const void *opts;
int opts_url; /* If this is 1 we will parse the url as an option string
@@ -158,6 +157,7 @@ typedef struct stream {
void *priv; // used for DVD, TV, RTSP etc
char *url; // strdup() of filename/url
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
struct MPOpts *opts;
@@ -278,8 +278,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);
-stream_t *open_stream(const char *filename, struct MPOpts *options,
- int *file_format);
+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);
struct demux_stream;
diff --git a/stream/stream_avdevice.c b/stream/stream_avdevice.c
index e26d5a9060..bd342e1b10 100644
--- a/stream/stream_avdevice.c
+++ b/stream/stream_avdevice.c
@@ -26,15 +26,15 @@ static int fill_buffer(stream_t *s, char *buffer, int max_len)
return -1;
}
-static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
+static int open_f(stream_t *stream, int mode, void *opts)
{
if (mode != STREAM_READ)
return STREAM_ERROR;
stream->fill_buffer = fill_buffer;
stream->type = STREAMTYPE_AVDEVICE;
+ stream->demuxer = "lavf";
- *file_format = DEMUXER_TYPE_LAVF;
return STREAM_OK;
}
diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c
index 64d1856873..131813dbb2 100644
--- a/stream/stream_bluray.c
+++ b/stream/stream_bluray.c
@@ -291,8 +291,7 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg)
return STREAM_UNSUPPORTED;
}
-static int bluray_stream_open(stream_t *s, int mode,
- void *opts, int *file_format)
+static int bluray_stream_open(stream_t *s, int mode, void *opts)
{
struct stream_priv_s *p = opts;
struct bluray_priv_s *b;
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index 4e45e51a07..f5b36a9419 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -333,7 +333,7 @@ static int control(stream_t *stream, int cmd, void *arg)
return STREAM_UNSUPPORTED;
}
-static int open_cdda(stream_t *st, int m, void *opts, int *file_format)
+static int open_cdda(stream_t *st, int m, void *opts)
{
struct cdda_params *p = (struct cdda_params *)opts;
int mode = p->paranoia_mode;
@@ -479,7 +479,7 @@ static int open_cdda(stream_t *st, int m, void *opts, int *file_format)
st->control = control;
st->close = close_cdda;
- *file_format = DEMUXER_TYPE_RAWAUDIO;
+ st->demuxer = "rawaudio";
m_struct_free(&stream_opts, opts);
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index 77c0523eb2..8fabfb4fc1 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -659,7 +659,7 @@ static int dvb_streaming_start(stream_t *stream, struct stream_priv_s *opts, int
-static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
+static int dvb_open(stream_t *stream, int mode, void *opts)
{
// I don't force the file format bacause, although it's almost always TS,
// there are some providers that stream an IP multicast with M$ Mpeg4 inside
@@ -739,7 +739,7 @@ static int dvb_open(stream_t *stream, int mode, void *opts, int *file_format)
stream->close = dvbin_close;
m_struct_free(&stream_opts, opts);
- *file_format = DEMUXER_TYPE_LAVF; // TS
+ stream->demuxer = "lavf:mpegts";
return STREAM_OK;
}
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index bf9cb9d4c7..b8161d16fa 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -745,7 +745,8 @@ static int control(stream_t *stream,int cmd,void* arg)
}
-static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
+static int open_s(stream_t *stream,int mode, void* opts)
+{
struct stream_priv_s* p = (struct stream_priv_s*)opts;
int k;
@@ -1059,7 +1060,7 @@ fail:
return STREAM_UNSUPPORTED;
}
-static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_format)
+static int ifo_stream_open (stream_t *stream, int mode, void *opts)
{
char* filename;
struct stream_priv_s *spriv;
@@ -1085,7 +1086,7 @@ static int ifo_stream_open (stream_t *stream, int mode, void *opts, int *file_fo
free(stream->url);
stream->url=strdup("dvd://");
- return open_s(stream, mode, spriv, file_format);
+ return open_s(stream, mode, spriv);
}
const stream_info_t stream_info_dvd = {
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 924eb31dad..79ebbb3eef 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -110,7 +110,8 @@ static int control(stream_t *s, int cmd, void *arg) {
return STREAM_UNSUPPORTED;
}
-static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
+static int open_f(stream_t *stream,int mode, void* opts)
+{
int f;
mode_t m = 0;
int64_t len;
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index 48d5e9d173..8a146a986d 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -33,7 +33,7 @@
#include "core/bstr.h"
#include "core/mp_talloc.h"
-static int open_f(stream_t *stream, int mode, void *opts, int *file_format);
+static int open_f(stream_t *stream, int mode, void *opts);
static char **read_icy(stream_t *stream);
static int fill_buffer(stream_t *s, char *buffer, int max_len)
@@ -115,7 +115,7 @@ static int control(stream_t *s, int cmd, void *arg)
// avio doesn't seem to support this - emulate it by reopening
close_f(s);
s->priv = NULL;
- return open_f(s, STREAM_READ, NULL, &(int) {0});
+ return open_f(s, STREAM_READ, NULL);
}
}
return STREAM_UNSUPPORTED;
@@ -132,7 +132,7 @@ static bool mp_avio_has_opts(AVIOContext *avio)
static const char * const prefix[] = { "lavf://", "ffmpeg://" };
-static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
+static int open_f(stream_t *stream, int mode, void *opts)
{
int flags = 0;
AVIOContext *avio = NULL;
@@ -163,7 +163,7 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
* stream layer. demux_lavf will do all the real work.