summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-20 21:56:55 +0100
committerwm4 <wm4@nowhere>2015-02-20 21:56:55 +0100
commit1cac7d1a659faffd1514a3269edf9fcae4d357c1 (patch)
treefeaa280fa28a416691f2fe2e0cd56f588746dcd1 /player/loadfile.c
parent6aa6778ac46672dd237acc86856353d133917f06 (diff)
downloadmpv-1cac7d1a659faffd1514a3269edf9fcae4d357c1.tar.bz2
mpv-1cac7d1a659faffd1514a3269edf9fcae4d357c1.tar.xz
demux: add a demux_open_url() function
Often stream and a demuxer are opened at the same time. Provide a function for this and replace most of its uses.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 66f114b606..b16f1026aa 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -684,11 +684,6 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
if (strncmp(disp_filename, "memory://", 9) == 0)
disp_filename = "memory://"; // avoid noise
- struct stream *stream = stream_open(filename, mpctx->global);
- if (!stream)
- goto err_out;
- stream_enable_cache(&stream, &opts->stream_cache);
-
struct demuxer_params params = {
.expect_subtitle = filter == STREAM_SUB,
};
@@ -702,11 +697,10 @@ struct track *mp_add_external_file(struct MPContext *mpctx, char *filename,
break;
}
- struct demuxer *demuxer = demux_open(stream, &params, mpctx->global);
- if (!demuxer) {
- free_stream(stream);
+ struct demuxer *demuxer =
+ demux_open_url(filename, &params, mpctx->playback_abort, mpctx->global);
+ if (!demuxer)
goto err_out;
- }
struct track *first = NULL;
for (int n = 0; n < demuxer->num_streams; n++) {