summaryrefslogtreecommitdiffstats
path: root/demux/demux_edl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-23 15:23:27 +0200
committerwm4 <wm4@nowhere>2016-05-23 15:23:27 +0200
commitc06a92e09e011d354235d9ad19aa7265da322691 (patch)
tree95a0e98df3a81b3a518c2822e685dbe56e94256f /demux/demux_edl.c
parent4ff2a606322494f060b90a982cbe2342738db665 (diff)
downloadmpv-c06a92e09e011d354235d9ad19aa7265da322691.tar.bz2
mpv-c06a92e09e011d354235d9ad19aa7265da322691.tar.xz
demux_edl: adjust warnings and variable names
Don't warn against unknown sourve length if the segment length is explicitly provided. Rename "len" to "end_time", because that's what it actually is.
Diffstat (limited to 'demux/demux_edl.c')
-rw-r--r--demux/demux_edl.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c
index aeccab406f..f4968905bd 100644
--- a/demux/demux_edl.c
+++ b/demux/demux_edl.c
@@ -213,25 +213,25 @@ static void build_timeline(struct timeline *tl, struct tl_parts *parts)
resolve_timestamps(part, source);
- double len = source_get_length(source);
- if (len > 0) {
- len += source->start_time;
- } else {
- MP_WARN(tl, "EDL: source file '%s' has unknown duration.\n",
- part->filename);
- }
+ double end_time = source_get_length(source);
+ if (end_time >= 0)
+ end_time += source->start_time;
// Unknown length => use rest of the file. If duration is unknown, make
// something up.
- if (part->length < 0)
- part->length = (len < 0 ? 1 : len) - part->offset;
-
- if (len > 0) {
- double partlen = part->offset + part->length;
- if (partlen > len) {
+ if (part->length < 0) {
+ if (end_time < 0) {
+ MP_WARN(tl, "EDL: source file '%s' has unknown duration.\n",
+ part->filename);
+ end_time = 1;
+ }
+ part->length = end_time - part->offset;
+ } else if (end_time >= 0) {
+ double end_part = part->offset + part->length;
+ if (end_part > end_time) {
MP_WARN(tl, "EDL: entry %d uses %f "
"seconds, but file has only %f seconds.\n",
- n, partlen, len);
+ n, end_part, end_time);
}
}