From 4fa6eac5f1c911a28f7b89dcdab0b4217ec8ecff Mon Sep 17 00:00:00 2001 From: Henrik Gulbrandsen Date: Mon, 21 Apr 2008 08:19:16 +0000 Subject: [PATCH] Correct ASF duration. Patch by Henrik Gulbrandsen: henrik gulbra net Originally committed as revision 12916 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/asf-enc.c | 3 +-- tests/ffmpeg.regression.ref | 4 ++-- tests/libav.regression.ref | 2 +- tests/rotozoom.regression.ref | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c index a12cda1..6bd89f4 100644 --- a/libavformat/asf-enc.c +++ b/libavformat/asf-enc.c @@ -733,11 +733,10 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) if(codec->codec_type == CODEC_TYPE_AUDIO) flags &= ~PKT_FLAG_KEY; - //XXX /FIXME use duration from AVPacket (quick hack by) pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts; assert(pts != AV_NOPTS_VALUE); duration = pts * 10000; - asf->duration= FFMAX(asf->duration, duration); + asf->duration= FFMAX(asf->duration, duration + pkt->duration * 10000); packet_st = asf->nb_packets; put_frame(s, stream, s->streams[pkt->stream_index], pkt->dts, pkt->data, pkt->size, flags); diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index 790d445..8e413fe 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -197,11 +197,11 @@ c3382f03ce2efb5d475240d288a33898 *./tests/data/a-flac.flac 353368 ./tests/data/a-flac.flac c4228df189aad9567a037727d0e763e4 *./tests/data/flac.vsynth.out.wav stddev: 33.31 PSNR:65.87 bytes:1040384 -a1e56bb034c2773438ba1c830c4cea07 *./tests/data/a-wmav1.asf +4435d87463cd6c5407bd88cca241ca56 *./tests/data/a-wmav1.asf 106004 ./tests/data/a-wmav1.asf stddev:12251.50 PSNR:14.56 bytes:1056768 stddev:2106.00 PSNR:29.85 bytes:1048576 -5e25c447c80fa937f74ed8752b0e26fb *./tests/data/a-wmav2.asf +24ae726aef89e5d17e315c64182f4c61 *./tests/data/a-wmav2.asf 106044 ./tests/data/a-wmav2.asf stddev:12255.92 PSNR:14.55 bytes:1056768 stddev:2099.31 PSNR:29.88 bytes:1048576 diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index 20fad3f..c751a73 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -1,7 +1,7 @@ 8a0536ccfe36f4fff408b3327d33e1dd *./tests/data/b-libav.avi 340344 ./tests/data/b-libav.avi ./tests/data/b-libav.avi CRC=0x400c29e9 -7b859661e93df32e51942a4e0531d58e *./tests/data/b-libav.asf +bd9e0012aa39e956605387dd499365fb *./tests/data/b-libav.asf 339775 ./tests/data/b-libav.asf ./tests/data/b-libav.asf CRC=0x74113749 c351132527ccb1e8cab06cc0822fde23 *./tests/data/b-libav.rm diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index bb0895b..342a9e3 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -197,11 +197,11 @@ c3382f03ce2efb5d475240d288a33898 *./tests/data/a-flac.flac 353368 ./tests/data/a-flac.flac c4228df189aad9567a037727d0e763e4 *./tests/data/flac.rotozoom.out.wav stddev: 33.31 PSNR:65.87 bytes:1040384 -a1e56bb034c2773438ba1c830c4cea07 *./tests/data/a-wmav1.asf +4435d87463cd6c5407bd88cca241ca56 *./tests/data/a-wmav1.asf 106004 ./tests/data/a-wmav1.asf stddev:12251.50 PSNR:14.56 bytes:1056768 stddev:2106.00 PSNR:29.85 bytes:1048576 -5e25c447c80fa937f74ed8752b0e26fb *./tests/data/a-wmav2.asf +24ae726aef89e5d17e315c64182f4c61 *./tests/data/a-wmav2.asf 106044 ./tests/data/a-wmav2.asf stddev:12255.92 PSNR:14.55 bytes:1056768 stddev:2099.31 PSNR:29.88 bytes:1048576 -- 2.7.4