summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-24 21:26:06 +0200
committerwm4 <wm4@nowhere>2015-06-24 21:26:06 +0200
commite4c5876f574432ea852e58e8f4469cc775c7201e (patch)
tree77dc9cefa47eaf8d323ff6894eb7abe19969e2db
parentab2e3cf6f9769c53fee9638f07af52027f718016 (diff)
downloadmpv-e4c5876f574432ea852e58e8f4469cc775c7201e.tar.bz2
mpv-e4c5876f574432ea852e58e8f4469cc775c7201e.tar.xz
player, demux: replace some demux_open() uses with demux_open_url()
-rw-r--r--demux/demux_cue.c8
-rw-r--r--player/loadfile.c18
2 files changed, 8 insertions, 18 deletions
diff --git a/demux/demux_cue.c b/demux/demux_cue.c
index 2b73e36a9d..cbe06ca5cf 100644
--- a/demux/demux_cue.c
+++ b/demux/demux_cue.c
@@ -56,10 +56,7 @@ static bool try_open(struct timeline *tl, char *filename)
|| bstrcasecmp(bstr0(tl->demuxer->filename), bfilename) == 0)
return false;
- struct stream *s = stream_create(filename, STREAM_READ, tl->cancel, tl->global);
- if (!s)
- return false;
- struct demuxer *d = demux_open(s, NULL, tl->global);
+ struct demuxer *d = demux_open_url(filename, NULL, tl->cancel, tl->global);
// 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
@@ -69,14 +66,13 @@ static bool try_open(struct timeline *tl, char *filename)
if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) {
MP_WARN(tl, "CUE: Opening as BIN file!\n");
struct demuxer_params p = {.force_format = "rawaudio"};
- d = demux_open(s, &p, tl->global);
+ d = demux_open_url(filename, &p, tl->cancel, tl->global);
}
if (d) {
add_source(tl, d);
return true;
}
MP_ERR(tl, "Could not open source '%s'!\n", filename);
- free_stream(s);
return false;
}
diff --git a/player/loadfile.c b/player/loadfile.c
index 6b25706055..cef35cc485 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -875,14 +875,11 @@ static void load_chapters(struct MPContext *mpctx)
bool free_src = false;
char *chapter_file = mpctx->opts->chapter_file;
if (chapter_file && chapter_file[0]) {
- struct stream *stream = stream_create(chapter_file, STREAM_READ,
+ struct demuxer *demux = demux_open_url(chapter_file, NULL,
mpctx->playback_abort, mpctx->global);
- if (stream) {
- struct demuxer *demux = demux_open(stream, NULL, mpctx->global);
- if (demux) {
- src = demux;
- free_src = true;
- }
+ if (demux) {
+ src = demux;
+ free_src = true;
}
talloc_free(mpctx->chapters);
mpctx->chapters = NULL;
@@ -892,11 +889,8 @@ static void load_chapters(struct MPContext *mpctx)
mpctx->num_chapters = src->num_chapters;
mpctx->chapters = demux_copy_chapter_data(src->chapters, src->num_chapters);
}
- if (free_src) {
- struct stream *s = src->stream;
- free_demuxer(src);
- free_stream(s);
- }
+ if (free_src)
+ free_demuxer_and_stream(src);
}
static void load_per_file_options(m_config_t *conf,