2015-02-17 22:46:12 +00:00
|
|
|
#include "common/common.h"
|
|
|
|
#include "stream/stream.h"
|
|
|
|
#include "demux.h"
|
|
|
|
|
|
|
|
#include "timeline.h"
|
|
|
|
|
|
|
|
struct timeline *timeline_load(struct mpv_global *global, struct mp_log *log,
|
|
|
|
struct demuxer *demuxer)
|
|
|
|
{
|
|
|
|
if (!demuxer->desc->load_timeline)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
struct timeline *tl = talloc_ptrtype(NULL, tl);
|
|
|
|
*tl = (struct timeline){
|
|
|
|
.global = global,
|
|
|
|
.log = log,
|
2018-05-18 13:48:14 +00:00
|
|
|
.cancel = demuxer->cancel,
|
2015-02-17 22:46:12 +00:00
|
|
|
.demuxer = demuxer,
|
2019-01-11 13:10:41 +00:00
|
|
|
.format = "unknown",
|
2015-02-17 22:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
demuxer->desc->load_timeline(tl);
|
|
|
|
|
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.
2019-01-11 12:52:29 +00:00
|
|
|
if (tl->num_pars)
|
2015-02-17 22:46:12 +00:00
|
|
|
return tl;
|
|
|
|
timeline_destroy(tl);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void timeline_destroy(struct timeline *tl)
|
|
|
|
{
|
|
|
|
if (!tl)
|
|
|
|
return;
|
|
|
|
for (int n = 0; n < tl->num_sources; n++) {
|
|
|
|
struct demuxer *d = tl->sources[n];
|
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.
2019-01-11 12:52:29 +00:00
|
|
|
if (d != tl->demuxer)
|
2018-05-19 12:41:06 +00:00
|
|
|
demux_free(d);
|
2015-02-17 22:46:12 +00:00
|
|
|
}
|
|
|
|
talloc_free(tl);
|
|
|
|
}
|