summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-22 13:04:36 +0200
committerwm4 <wm4@nowhere>2014-05-22 13:04:36 +0200
commitd62dad55ef30974b60ad24a6fccacbbd30bb8fd0 (patch)
tree278c733e0e5355e9ba66ab36c20d81c2166c9e4e /player
parent3d065a53fccfabf569860db7177e2fb979e2a2df (diff)
downloadmpv-d62dad55ef30974b60ad24a6fccacbbd30bb8fd0.tar.bz2
mpv-d62dad55ef30974b60ad24a6fccacbbd30bb8fd0.tar.xz
edl: use start PTS of the source files as default start time
Diffstat (limited to 'player')
-rw-r--r--player/timeline/tl_mpv_edl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/player/timeline/tl_mpv_edl.c b/player/timeline/tl_mpv_edl.c
index 7892d5294d..05b16d2f6b 100644
--- a/player/timeline/tl_mpv_edl.c
+++ b/player/timeline/tl_mpv_edl.c
@@ -35,8 +35,9 @@
struct tl_part {
char *filename; // what is stream_open()ed
double offset; // offset into the source file
- double length; // length of the part (-1 if rest of the file)
+ bool offset_set;
bool chapter_ts;
+ double length; // length of the part (-1 if rest of the file)
};
struct tl_parts {
@@ -100,6 +101,7 @@ static struct tl_parts *parse_edl(bstr str)
} else if (bstr_equals0(name, "start")) {
if (!parse_time(val, &p.offset))
goto error;
+ p.offset_set = true;
} else if (bstr_equals0(name, "length")) {
if (!parse_time(val, &p.length))
goto error;
@@ -201,6 +203,8 @@ static void resolve_timestamps(struct tl_part *part, struct demuxer *demuxer)
part->offset = start;
part->length = length;
}
+ if (!part->offset_set)
+ part->offset = demuxer_get_start_time(demuxer);
}
static void build_timeline(struct MPContext *mpctx, struct tl_parts *parts)
@@ -219,7 +223,9 @@ static void build_timeline(struct MPContext *mpctx, struct tl_parts *parts)
resolve_timestamps(part, source);
double len = source_get_length(source);
- if (len <= 0) {
+ if (len > 0) {
+ len += demuxer_get_start_time(source);
+ } else {
MP_WARN(mpctx, "EDL: source file '%s' has unknown duration.\n",
part->filename);
}