[FFmpeg-devel] [PATCH 1/3] Round the mov track duration to 3 decimals.
Benjamin Larsson
banan
Wed Mar 2 23:31:15 CET 2011
On 03/02/2011 08:34 PM, Baptiste Coudurier wrote:
> On 3/2/11 9:27 AM, Benjamin Larsson wrote:
>> ---
>> libavformat/movenc.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index 8feb06e..f816273 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> @@ -1256,6 +1256,8 @@ static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track, int est_nb_frame
>>
>> static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
>> {
>> + uint64_t tmptrackDuration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
>> + track->timescale, AV_ROUND_UP) * track->timescale/MOV_TIMESCALE;
>> int version = track->trackDuration < INT32_MAX ? 0 : 1;
>>
>> (version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */
>> @@ -1270,7 +1272,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
>> avio_wb32(pb, track->time); /* modification time */
>> }
>> avio_wb32(pb, track->timescale); /* time scale (sample rate for audio) */
>> - (version == 1) ? avio_wb64(pb, track->trackDuration) : avio_wb32(pb, track->trackDuration); /* duration */
>> + (version == 1) ? avio_wb64(pb, tmptrackDuration) : avio_wb32(pb, tmptrackDuration); /* duration */
>> avio_wb16(pb, track->language); /* language */
>> avio_wb16(pb, 0); /* reserved (quality) */
>>
> Hummm, trackDuration is exact in track timescale. Why do you want to
> round it ?
Emulating quicktime.
MvH
Benjamin Larsson
More information about the ffmpeg-devel
mailing list