diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 20:36:56 +0000 |
commit | 51de1d8436100f725f3576aefa24a2bd2057bc28 (patch) | |
tree | c6d1d5264b6d40a8d7ca34129f36b7d61e188af3 /demux/timeline.c | |
parent | Initial commit. (diff) | |
download | mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.tar.xz mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.zip |
Adding upstream version 0.37.0.upstream/0.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'demux/timeline.c')
-rw-r--r-- | demux/timeline.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/demux/timeline.c b/demux/timeline.c new file mode 100644 index 0000000..0e5ff75 --- /dev/null +++ b/demux/timeline.c @@ -0,0 +1,41 @@ +#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, + .cancel = demuxer->cancel, + .demuxer = demuxer, + .format = "unknown", + .stream_origin = demuxer->stream_origin, + }; + + demuxer->desc->load_timeline(tl); + + if (tl->num_pars) + 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]; + if (d != tl->demuxer) + demux_free(d); + } + talloc_free(tl); +} |