summaryrefslogtreecommitdiffstats
path: root/common
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 /common
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 'common')
-rw-r--r--common/playlist.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/common/playlist.c b/common/playlist.c
index 70206b1cfe..0f6767a3ce 100644
--- a/common/playlist.c
+++ b/common/playlist.c
@@ -270,22 +270,19 @@ struct playlist *playlist_parse_file(const char *file, struct mpv_global *global
struct mp_log *log = mp_log_new(NULL, global->log, "!playlist_parser");
mp_verbose(log, "Parsing playlist file %s...\n", file);
- struct playlist *ret = NULL;
- stream_t *stream = stream_open(file, global);
- if(!stream) {
- mp_err(log, "Error while opening playlist file %s\n", file);
+ struct demuxer_params p = {.force_format = "playlist"};
+ struct demuxer *d = demux_open_url(file, &p, NULL, global);
+ if (!d) {
talloc_free(log);
return NULL;
}
- struct demuxer_params p = {.force_format = "playlist"};
- struct demuxer *pl_demux = demux_open(stream, &p, global);
- if (pl_demux && pl_demux->playlist) {
+ struct playlist *ret = NULL;
+ if (d && d->playlist) {
ret = talloc_zero(NULL, struct playlist);
- playlist_transfer_entries(ret, pl_demux->playlist);
+ playlist_transfer_entries(ret, d->playlist);
}
- free_demuxer(pl_demux);
- free_stream(stream);
+ free_demuxer_and_stream(d);
if (ret) {
mp_verbose(log, "Playlist successfully parsed\n");