[FFmpeg-devel] [PATCH] more mov edl fixes
Reimar Döffinger
Reimar.Doeffinger
Mon Mar 16 20:58:41 CET 2009
On Mon, Mar 16, 2009 at 11:55:28AM -0700, Baptiste Coudurier wrote:
> Are you sure the rescaling is right for "time" ? "time" should be in
> track timescale, while duration is in movie timescale IIRC.
Right, so what is the least ugly solution? A extra field for this?
Or like this patch:
Index: libavformat/mov.c
===================================================================
--- libavformat/mov.c (revision 18017)
+++ libavformat/mov.c (working copy)
@@ -1278,8 +1278,9 @@
/* 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 @@
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));
}
}
More information about the ffmpeg-devel
mailing list