mirror of https://github.com/mpv-player/mpv
demux_edl: add a special header to disable chapter generation
A bit of a hack.
This commit is contained in:
parent
b8f282fd32
commit
b230525352
|
@ -100,6 +100,18 @@ entries affect all other file entries in the EDL file. Their format is highly
|
|||
implementation specific. They should generally follow the file header, and come
|
||||
before any file entries.
|
||||
|
||||
Disabling chapter generation and copying
|
||||
========================================
|
||||
|
||||
By default, chapters from the source ranges are copied to the virtual file's
|
||||
chapters. Also, a chapter is inserted after each range. This can be disabled
|
||||
with the ``no_chapters`` header.
|
||||
|
||||
Example::
|
||||
|
||||
!no_chapters
|
||||
|
||||
|
||||
MP4 DASH
|
||||
========
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ struct tl_part {
|
|||
};
|
||||
|
||||
struct tl_parts {
|
||||
bool disable_chapters;
|
||||
bool dash;
|
||||
char *init_fragment_url;
|
||||
struct tl_part *parts;
|
||||
|
@ -153,6 +154,8 @@ static struct tl_parts *parse_edl(bstr str)
|
|||
struct tl_parts *ntl = talloc_zero(tl, struct tl_parts);
|
||||
tl->next = ntl;
|
||||
tl = ntl;
|
||||
} else if (bstr_equals0(f_type, "no_chapters")) {
|
||||
tl->disable_chapters = true;
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
|
@ -309,17 +312,20 @@ static void build_timeline(struct timeline *tl, struct tl_parts *parts)
|
|||
}
|
||||
}
|
||||
|
||||
// Add a chapter between each file.
|
||||
struct demux_chapter ch = {
|
||||
.pts = starttime,
|
||||
.metadata = talloc_zero(tl, struct mp_tags),
|
||||
};
|
||||
mp_tags_set_str(ch.metadata, "title", part->title ? part->title : part->filename);
|
||||
MP_TARRAY_APPEND(tl, tl->chapters, tl->num_chapters, ch);
|
||||
if (!parts->disable_chapters) {
|
||||
// Add a chapter between each file.
|
||||
struct demux_chapter ch = {
|
||||
.pts = starttime,
|
||||
.metadata = talloc_zero(tl, struct mp_tags),
|
||||
};
|
||||
mp_tags_set_str(ch.metadata, "title",
|
||||
part->title ? part->title : part->filename);
|
||||
MP_TARRAY_APPEND(tl, tl->chapters, tl->num_chapters, ch);
|
||||
|
||||
// Also copy the source file's chapters for the relevant parts
|
||||
copy_chapters(&tl->chapters, &tl->num_chapters, source, part->offset,
|
||||
part->length, starttime);
|
||||
// Also copy the source file's chapters for the relevant parts
|
||||
copy_chapters(&tl->chapters, &tl->num_chapters, source,
|
||||
part->offset, part->length, starttime);
|
||||
}
|
||||
}
|
||||
|
||||
tl->parts[n] = (struct timeline_part) {
|
||||
|
|
Loading…
Reference in New Issue