[SCM] libav/experimental: Extend mov edit list support to work for a first padding entry with time == -1 and duration. Complicated since time is relative to stream, duration relative to container time base.
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Jun 30 16:41:33 UTC 2013
The following commit has been merged in the experimental branch:
commit 2ac736a6dadd174d1056beb75de6f85022b4fd1e
Author: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Date: Mon Mar 16 20:49:52 2009 +0000
Extend mov edit list support to work for a first padding entry with
time == -1 and duration. Complicated since time is relative to stream,
duration relative to container time base.
Originally committed as revision 18019 to svn://svn.ffmpeg.org/ffmpeg/trunk
diff --git a/libavformat/mov.c b/libavformat/mov.c
index eec6ce5..bb0c035 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1278,8 +1278,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
/* adjust first dts according to edit list */
if (sc->time_offset) {
+ int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;
assert(sc->time_offset % sc->time_rate == 0);
- current_dts = - (sc->time_offset / sc->time_rate);
+ current_dts = - (rescaled / sc->time_rate);
}
/* only use old uncompressed audio chunk demuxing when stts specifies it */
@@ -1774,12 +1775,12 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
for(i=0; i<edit_count; i++){
int time;
- get_be32(pb); /* Track duration */
+ int duration = get_be32(pb); /* Track duration */
time = get_be32(pb); /* Media time */
get_be32(pb); /* Media rate */
- if (i == 0 && time != -1) {
- sc->time_offset = time;
- sc->time_rate = av_gcd(sc->time_rate, time);
+ if (i == 0 && time >= -1) {
+ sc->time_offset = time != -1 ? time : -duration;
+ sc->time_rate = av_gcd(sc->time_rate, FFABS(sc->time_offset));
}
}
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list