0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00
mpv/demux/timeline.c
wm4 87db2f24e8 demux_edl, cue, mkv: slightly nicer file format indication
Instead of just using "edl/" for the file format, report mkv_oc if it's
generated from ordered chapters, "cue/" if from .cue, "multi/" if it's
from EDL but only for adding separate streams, "dash/" if it's from EDL
but only using the DASH hack, and "edl/" for everything else.

The EDL variants are mostly special-cased to the variants the ytdl
wrapper usually generates.

This has no effect other than what the command.c file-format property
returns.
2019-09-19 20:37:04 +02:00

41 lines
899 B
C

#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",
};
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);
}