movenc: Adjust edit lists to trim out parts of tracks with negative pts

This makes sure that audio preroll for e.g. AAC is signaled correctly.

Previously we only wrote the edit list correctly if we had negative
dts but started with pts == 0 (e.g. for video with B-frames).

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/89/head
Michael Niedermayer 13 years ago committed by Martin Storsjö
parent 8bef433881
commit 72f801619a
  1. 7
      libavformat/movenc.c

@ -1628,6 +1628,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, -1);
}
avio_wb32(pb, 0x00010000);
} else {
/* Avoid accidentally ending up with start_ct = -1 which has got a
* special meaning. Normally start_ct should end up positive or zero
* here, but use FFMIN in case dts is a a small positive integer
* rounded to 0 when represented in MOV_TIMESCALE units. */
start_ct = -FFMIN(track->cluster[0].dts, 0);
duration += delay;
}
/* duration */

Loading…
Cancel
Save