diff options
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux.c | 1 | ||||
-rw-r--r-- | demux/demux.h | 2 | ||||
-rw-r--r-- | demux/demux_cue.c | 14 | ||||
-rw-r--r-- | demux/demux_edl.c | 19 |
4 files changed, 25 insertions, 11 deletions
diff --git a/demux/demux.c b/demux/demux.c index 4039617be9..e29956af12 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -813,7 +813,6 @@ static void demux_copy(struct demuxer *dst, struct demuxer *src) dst->attachments = src->attachments; dst->num_attachments = src->num_attachments; dst->matroska_data = src->matroska_data; - dst->file_contents = src->file_contents; dst->playlist = src->playlist; dst->seekable = src->seekable; dst->partially_seekable = src->partially_seekable; diff --git a/demux/demux.h b/demux/demux.h index 03a89f2a1a..14154cef0c 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -218,8 +218,6 @@ typedef struct demuxer { int num_attachments; struct matroska_data matroska_data; - // for trivial demuxers which just read the whole file for codec to use - struct bstr file_contents; // If the file is a playlist file struct playlist *playlist; diff --git a/demux/demux_cue.c b/demux/demux_cue.c index 494ca6a78b..969c3ebb84 100644 --- a/demux/demux_cue.c +++ b/demux/demux_cue.c @@ -76,6 +76,10 @@ struct cue_track { struct bstr title; }; +struct priv { + bstr data; +}; + static enum cue_command read_cmd(struct bstr *data, struct bstr *out_params) { struct bstr line = bstr_strip_linebreaks(bstr_getline(*data, data)); @@ -279,11 +283,13 @@ static double source_get_length(struct demuxer *demuxer) static void build_timeline(struct timeline *tl) { + struct priv *p = tl->demuxer->priv; + void *ctx = talloc_new(NULL); add_source(tl, tl->demuxer); - struct bstr data = tl->demuxer->file_contents; + struct bstr data = p->data; data = skip_utf8_bom(data); struct cue_track *tracks = NULL; @@ -425,8 +431,10 @@ static int try_open_file(struct demuxer *demuxer, enum demux_check check) if (d.len < 1 || !mp_probe_cue(d)) return -1; } - demuxer->file_contents = stream_read_complete(s, demuxer, 1000000); - if (demuxer->file_contents.start == NULL) + struct priv *p = talloc_zero(demuxer, struct priv); + demuxer->priv = p; + p->data = stream_read_complete(s, demuxer, 1000000); + if (p->data.start == NULL) return -1; return 0; } 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; } |