diff options
author | wm4 <wm4@nowhere> | 2015-08-04 01:01:09 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-04 01:01:09 +0200 |
commit | 75b1d5043fdfe672417ef8d58f8fa87672aadde9 (patch) | |
tree | 46589c1085f8504e71c4f2650dc87afda3f2dbc9 /demux/demux.c | |
parent | 525ada8c7ac69da5bb0c1977f519ff40c4390b4a (diff) | |
download | mpv-75b1d5043fdfe672417ef8d58f8fa87672aadde9.tar.bz2 mpv-75b1d5043fdfe672417ef8d58f8fa87672aadde9.tar.xz |
player: use demux_open_url() to open main files
Instead of opening a stream and then a demuxer, do both at once with
demux_open_url().
This requires some awkward additions to demuxer_params, because there
are some weird features associated with opening the main file. E.g. the
relatively useless --stream-capture features requires enabling capturing
on the stream before the demuxer is opened, but on the other hand
shouldn't be done on secondary files like external subtitles.
Also relatively bad: since demux_open_url() returns just a demuxer
pointer or NULL, additional error reporting is done via demuxer_params.
Still, at least conceptually, it's ok, and simpler than before.
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/demux/demux.c b/demux/demux.c index 2d40643a71..ba2678466f 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1077,14 +1077,22 @@ struct demuxer *demux_open_url(const char *url, struct mpv_global *global) { struct MPOpts *opts = global->opts; - struct stream *s = stream_create(url, STREAM_READ, cancel, global); + struct demuxer_params dummy = {0}; + if (!params) + params = &dummy; + struct stream *s = stream_create(url, STREAM_READ | params->stream_flags, + cancel, global); if (!s) return NULL; - if (!(params && params->disable_cache)) + if (params->allow_capture) + stream_set_capture_file(s, opts->stream_capture); + if (!params->disable_cache) stream_enable_cache(&s, &opts->stream_cache); struct demuxer *d = demux_open(s, params, global); - if (!d) + if (!d) { + params->demuxer_failed = true; free_stream(s); + } return d; } |