summaryrefslogtreecommitdiffstats
path: root/demux/demux_edl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-06 23:31:16 +0200
committerwm4 <wm4@nowhere>2019-10-06 23:35:02 +0200
commit1f77102ee81ee9235cdfd9a90ded4f6d6ddd10da (patch)
tree6b0cfa83c52ca5cb1928f20862dfd3e94da3eaca /demux/demux_edl.c
parent4ad68d94523c3d101a5fd1d488a3d383a0a81587 (diff)
downloadmpv-1f77102ee81ee9235cdfd9a90ded4f6d6ddd10da.tar.bz2
mpv-1f77102ee81ee9235cdfd9a90ded4f6d6ddd10da.tar.xz
demux_edl: better selection of part which defines the track layout
Someone crazy is trying to mix images with videos in EDL files. Putting an image as first thing into the EDL disabled audio, because the first EDL entry was used to define the layout. Change this. Make it user-configurable, and use a "better" heuristic to select the default otherwise. In theory, EDL could be easily extended to specify track layout and mapping of parts to virtual EDL tracks manually and in great detail. But I don't think it's worth it - who would bother using it? Fixes: #6764
Diffstat (limited to 'demux/demux_edl.c')
-rw-r--r--demux/demux_edl.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c
index 205d607427..7016df3558 100644
--- a/demux/demux_edl.c
+++ b/demux/demux_edl.c
@@ -40,6 +40,7 @@ struct tl_part {
double offset; // offset into the source file
bool offset_set;
bool chapter_ts;
+ bool is_layout;
double length; // length of the part (-1 if rest of the file)
char *title;
};
@@ -151,6 +152,9 @@ static struct tl_root *parse_edl(bstr str)
p.chapter_ts = true;
} else if (bstr_equals0(name, "title")) {
p.title = bstrto0(tl, val);
+ } else if (bstr_equals0(name, "layout")) {
+ if (bstr_equals0(val, "this"))
+ p.is_layout = true;
}
}
nparam++;
@@ -357,10 +361,22 @@ static struct timeline_par *build_timeline(struct timeline *root,
starttime = tl->parts[n].end;
- if (source && !tl->track_layout)
+ if (source && !tl->track_layout && part->is_layout)
tl->track_layout = source;
}
+ if (!tl->track_layout) {
+ // Use a heuristic to select the "broadest" part as layout.
+ for (int n = 0; n < parts->num_parts; n++) {
+ struct demuxer *s = tl->parts[n].source;
+ if (!s)
+ continue;
+ if (!tl->track_layout ||
+ demux_get_num_stream(s) > demux_get_num_stream(tl->track_layout))
+ tl->track_layout = s;
+ }
+ }
+
if (!tl->track_layout)
goto error;
if (!root->meta)