[FFmpeg-devel] [PATCH] more mov edl fixes
Reimar Döffinger
Reimar.Doeffinger
Mon Mar 16 14:49:49 CET 2009
Hello,
attached patch fixes sync of
http://samples.mplayerhq.hu/mov/weirdedl.mp4 (subtitles are supposed to
be exactly in sync, the audio is supposed to be delayed by exactly 3
seconds compared to how it plays now).
Two issues:
1) it uses an "fillup" edl entry with time == -1 (implemented by the
second chunk of the patch).
2) edl time values are relative to container, not track rate,
implemented in an ugly way by the first chunk.
Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavformat/mov.c
===================================================================
--- libavformat/mov.c (revision 18004)
+++ libavformat/mov.c (working copy)
@@ -1246,7 +1246,7 @@
/* adjust first dts according to edit list */
if (sc->time_offset) {
assert(sc->time_offset % sc->time_rate == 0);
- current_dts = - (sc->time_offset / sc->time_rate);
+ current_dts = - ((int64_t)sc->time_offset * sc->time_scale / mov->time_scale / sc->time_rate);
}
/* only use old uncompressed audio chunk demuxing when stts specifies it */
@@ -1741,12 +1741,12 @@
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) {
+ sc->time_offset = time != -1 ? time : -duration;
+ sc->time_rate = av_gcd(sc->time_rate, FFABS(sc->time_offset));
}
}
More information about the ffmpeg-devel
mailing list