summaryrefslogtreecommitdiffstats
path: root/demux/timeline.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-01-11 13:52:29 +0100
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commita09396ee609af71f49f70521320e87989577b577 (patch)
treef6daf16eb6eefb20e68b4e1458136a38fc9a6c13 /demux/timeline.c
parent6efcde06e31be4db0b2d9e3958bafffcdaa0a42e (diff)
downloadmpv-a09396ee609af71f49f70521320e87989577b577.tar.bz2
mpv-a09396ee609af71f49f70521320e87989577b577.tar.xz
demux_edl, cue, mkv: clean up timeline stuff slightly
Remove the singly linked list hack, replace it with a slightly more proper data structure. This probably gets rid of a few minor bugs along the way, caused by the awkward nonsensical sharing/duplication of some fields. Another change (because I'm touching everything related to timeline anyway) is that I'm removing the special semantics for parts[num_parts]. This is now strictly out of bounds, and instead of using the start time of the next/beyond-last part, there is an end time field now. Unfortunately, this also requires touching the code for cue and mkv ordered chapters. From some superficial testing, they still seem to mostly work. One observable change is that the "no_chapters" header is per-stream now, which is arguably more correct, and getting the old behavior would require adding code to handle it as special-case, so just adjust ytdl_hook.lua to the new behavior.
Diffstat (limited to 'demux/timeline.c')
-rw-r--r--demux/timeline.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/demux/timeline.c b/demux/timeline.c
index 86e4921280..f771155e18 100644
--- a/demux/timeline.c
+++ b/demux/timeline.c
@@ -16,12 +16,11 @@ struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
.log = log,
.cancel = demuxer->cancel,
.demuxer = demuxer,
- .track_layout = demuxer,
};
demuxer->desc->load_timeline(tl);
- if (tl->num_parts)
+ if (tl->num_pars)
return tl;
timeline_destroy(tl);
return NULL;
@@ -31,14 +30,10 @@ void timeline_destroy(struct timeline *tl)
{
if (!tl)
return;
- // (Sub timeline elements may depend on allocations in the parent one.)
- timeline_destroy(tl->next);
for (int n = 0; n < tl->num_sources; n++) {
struct demuxer *d = tl->sources[n];
- if (d != tl->demuxer && d != tl->track_layout)
+ if (d != tl->demuxer)
demux_free(d);
}
- if (tl->track_layout && tl->track_layout != tl->demuxer)
- demux_free(tl->track_layout);
talloc_free(tl);
}