summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-01-05 08:43:58 +0100
committerwm4 <wm4@nowhere>2019-09-19 20:37:04 +0200
commitb230525352a8c43f00497774f81569c4ea026d6b (patch)
tree742873021da375786a53b873a835deb56fb2b490
parentb8f282fd32223057bb7db3615b0600047dd54425 (diff)
downloadmpv-b230525352a8c43f00497774f81569c4ea026d6b.tar.bz2
mpv-b230525352a8c43f00497774f81569c4ea026d6b.tar.xz
demux_edl: add a special header to disable chapter generation
A bit of a hack.
-rw-r--r--DOCS/edl-mpv.rst12
-rw-r--r--demux/demux_edl.c28
2 files changed, 29 insertions, 11 deletions
diff --git a/DOCS/edl-mpv.rst b/DOCS/edl-mpv.rst
index cfec52c1bc..cf0d7ffddb 100644
--- a/DOCS/edl-mpv.rst
+++ b/DOCS/edl-mpv.rst
@@ -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
========
diff --git a/demux/demux_edl.c b/demux/demux_edl.c
index 98e31a79f2..882af417e7 100644
--- a/demux/demux_edl.c
+++ b/demux/demux_edl.c
@@ -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);
-
- // Also copy the source file's chapters for the relevant parts
- copy_chapters(&tl->chapters, &tl->num_chapters, source, part->offset,
- part->length, starttime);
+ 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);
+ }
}
tl->parts[n] = (struct timeline_part) {