diff options
author | wm4 <wm4@nowhere> | 2015-02-17 23:49:38 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-02-17 23:49:38 +0100 |
commit | 082371a1603eaaa6c5c9f4bd57f9e77ff027ee15 (patch) | |
tree | 73ca8568f3f50c73cf7d7145ed402d52c3593d7e /demux/demux_cue.c | |
parent | d7a4cb14ff8dc61d87cec54abcd7f7623e8cc666 (diff) | |
download | mpv-082371a1603eaaa6c5c9f4bd57f9e77ff027ee15.tar.bz2 mpv-082371a1603eaaa6c5c9f4bd57f9e77ff027ee15.tar.xz |
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.
Diffstat (limited to 'demux/demux_cue.c')
-rw-r--r-- | demux/demux_cue.c | 14 |
1 files changed, 11 insertions, 3 deletions
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; } |