diff options
author | wm4 <wm4@nowhere> | 2012-08-19 17:58:58 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-07 16:06:36 +0200 |
commit | 83f68f725d80b23f76c9a8cd8dbb8349b33c9779 (patch) | |
tree | c970d25da1116141e1fdc9bfbf36132276240950 /timeline/tl_edl.c | |
parent | c5e2120e15d3b6e6e896a48670376de985fcc712 (diff) | |
download | mpv-83f68f725d80b23f76c9a8cd8dbb8349b33c9779.tar.bz2 mpv-83f68f725d80b23f76c9a8cd8dbb8349b33c9779.tar.xz |
core, timeline: don't keep separate stream field
The timeline code kept pairs of stream and demuxer references around.
The reference to the stream is redundant, because it can be accessed
through the demuxer.
Simplify the code by removing the redundant stream reference.
Also, set mpctx->stream to the current segment when using timeline.
Fix a small memory leak in tl_matroska.c introduced earlier.
Diffstat (limited to 'timeline/tl_edl.c')
-rw-r--r-- | timeline/tl_edl.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/timeline/tl_edl.c b/timeline/tl_edl.c index 6763c9fa63..3c8cd21781 100644 --- a/timeline/tl_edl.c +++ b/timeline/tl_edl.c @@ -346,11 +346,10 @@ void build_edl_timeline(struct MPContext *mpctx) // Open source files - struct content_source *sources = talloc_array_ptrtype(NULL, sources, - num_sources + 1); + struct demuxer **sources = talloc_array_ptrtype(NULL, sources, + num_sources + 1); mpctx->sources = sources; - sources[0].stream = mpctx->stream; - sources[0].demuxer = mpctx->demuxer; + sources[0] = mpctx->demuxer; mpctx->num_sources = 1; for (int i = 0; i < num_sources; i++) { @@ -371,8 +370,7 @@ void build_edl_timeline(struct MPContext *mpctx) "file on line %d!\n", edl_ids[i].lineno); goto out; } - sources[mpctx->num_sources].stream = s; - sources[mpctx->num_sources].demuxer = d; + sources[mpctx->num_sources] = d; mpctx->num_sources++; } @@ -385,7 +383,7 @@ void build_edl_timeline(struct MPContext *mpctx) timeline[i].start = starttime / 1e9; starttime += parts[i].duration; timeline[i].source_start = parts[i].src.start / 1e9; - timeline[i].source = sources + parts[i].id + 1; + timeline[i].source = sources[parts[i].id + 1]; } if (parts[num_parts - 1].id != -1) { timeline[num_parts].start = starttime / 1e9; |