From 082371a1603eaaa6c5c9f4bd57f9e77ff027ee15 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 17 Feb 2015 23:49:38 +0100 Subject: demux: remove file_contents field Only demux_cue and demux_edl used it. It's a weird field and doesn't help with anything anymore - by now, it only saves a priv context in the mentioned demuxers. Reducing the number of confusing things the demuxer struct has is more important than minimizing the code. --- demux/demux_edl.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'demux/demux_edl.c') diff --git a/demux/demux_edl.c b/demux/demux_edl.c index ef557225e9..c9f8f344be 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -50,6 +50,10 @@ struct tl_parts { int num_parts; }; +struct priv { + bstr data; +}; + // Parse a time (absolute file time or duration). Currently equivalent to a // number. Return false on failure. static bool parse_time(bstr str, double *out_time) @@ -288,7 +292,9 @@ static void fix_filenames(struct tl_parts *parts, char *source_path) static void build_mpv_edl_timeline(struct timeline *tl) { - struct tl_parts *parts = parse_edl(tl->demuxer->file_contents); + struct priv *p = tl->demuxer->priv; + + struct tl_parts *parts = parse_edl(p->data); if (!parts) { MP_ERR(tl, "Error in EDL.\n"); return; @@ -303,19 +309,22 @@ static void build_mpv_edl_timeline(struct timeline *tl) static int try_open_file(struct demuxer *demuxer, enum demux_check check) { + struct priv *p = talloc_zero(demuxer, struct priv); + demuxer->priv = p; + struct stream *s = demuxer->stream; if (s->uncached_type == STREAMTYPE_EDL) { - demuxer->file_contents = bstr0(s->path); + p->data = bstr0(s->path); return 0; } if (check >= DEMUX_CHECK_UNSAFE) { if (!bstr_equals0(stream_peek(s, strlen(HEADER)), HEADER)) return -1; } - demuxer->file_contents = stream_read_complete(s, demuxer, 1000000); - if (demuxer->file_contents.start == NULL) + p->data = stream_read_complete(s, demuxer, 1000000); + if (p->data.start == NULL) return -1; - bstr_eatstart0(&demuxer->file_contents, HEADER); + bstr_eatstart0(&p->data, HEADER); return 0; } -- cgit v1.2.3