From c4f8d5d9f9001b7ece7f89fc756cf386f92528a4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 22 Sep 2004 20:01:56 +0000 Subject: [PATCH] write shorter headers if possible Originally committed as revision 3494 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/wav.c | 4 +++- tests/ffmpeg.regression.ref | 24 ++++++++++++------------ tests/libav.regression.ref | 4 ++-- tests/rotozoom.regression.ref | 24 ++++++++++++------------ 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/libavformat/wav.c b/libavformat/wav.c index 7ac0d879b1..e0f134b47f 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -107,7 +107,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) put_le16(pb, 2); /* wav_extra_size */ hdrsize += 2; put_le16(pb, ((enc->block_align - 4 * enc->channels) / (4 * enc->channels)) * 8 + 1); /* wSamplesPerBlock */ - } else { + } else if(enc->extradata_size){ put_le16(pb, enc->extradata_size); put_buffer(pb, enc->extradata, enc->extradata_size); hdrsize += enc->extradata_size; @@ -115,6 +115,8 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) hdrsize++; put_byte(pb, 0); } + } else { + hdrsize -= 2; } return hdrsize; diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref index e6267ee0b0..056b3cacd8 100644 --- a/tests/ffmpeg.regression.ref +++ b/tests/ffmpeg.regression.ref @@ -113,19 +113,19 @@ ccc201054669e94717022bb4f2aea4ce *./data/out.yuv stddev: 10.99 PSNR:27.30 bytes:7602176 21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2 95712 ./data/a-mp2.mp2 -624d9789f3ac193bbae4af3bd8cb02b7 *./data/out.wav -1055278 ./data/out.wav +91ab1b253cd360037d3fca67b795aba8 *./data/out.wav +1055276 ./data/out.wav d056da679e6d6682812fffb28a7f0db6 *./data/a-ac3.rm 97983 ./data/a-ac3.rm -69526b38166395785eec8ccfb90a105e *./data/a-g726.wav -24332 ./data/a-g726.wav -20cb2fcffd33573a60c93d4dceacd1d1 *./data/out.wav -97190 ./data/out.wav +e1aa1d139e8e241cdf9be8ac8252dabb *./data/a-g726.wav +24330 ./data/a-g726.wav +2f1b2fdb2ebdf4250a850fdcc28b50d1 *./data/out.wav +97188 ./data/out.wav bdc512b78e2ccb1d815aec08794650eb *./data/a-adpcm_ima.wav 266288 ./data/a-adpcm_ima.wav -449ec3854e8b09982302f92ea9cd47ca *./data/out.wav -1056686 ./data/out.wav -5ac5a5ffd680d7880dfb1dd069851691 *./data/a-adpcm_ms.wav -267310 ./data/a-adpcm_ms.wav -e4276587e9ffef41a007ac4c12d3fad2 *./data/out.wav -1056574 ./data/out.wav +1316b03da3bdc8df9785c7995e3c9b2a *./data/out.wav +1056684 ./data/out.wav +d2eee867856d2bdb6d08e936d4ceec0c *./data/a-adpcm_ms.wav +267308 ./data/a-adpcm_ms.wav +91a84bb4f319a3a0bf0c0441b3d3a529 *./data/out.wav +1056572 ./data/out.wav diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index c12aac3070..9f64c15c69 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -43,8 +43,8 @@ c39dd19b88f9e0f03a318b51c37edb61 *./data/b-libav.yuv4mpeg 3801810 ./data/b-libav.yuv4mpeg ./data/b-libav%d.pgm CRC=84c09106 ./data/b-libav%d.ppm CRC=25c06ecf -4b7690747c49e4e8e910359768e4a77e *./data/b-libav.wav - 89134 ./data/b-libav.wav +b0a8c8063d81921db5d7c8f50a1cc454 *./data/b-libav.wav +89132 ./data/b-libav.wav ./data/b-libav.wav CRC=2a09519c e2a6d6fae17394dfe87cb5bb8ae11837 *./data/b-libav.al 44544 ./data/b-libav.al diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref index b080d5bec9..4ad107fe80 100644 --- a/tests/rotozoom.regression.ref +++ b/tests/rotozoom.regression.ref @@ -113,19 +113,19 @@ stddev: 0.00 PSNR:99.99 bytes:7602176 stddev: 3.43 PSNR:37.39 bytes:7602176 21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2 95712 ./data/a-mp2.mp2 -624d9789f3ac193bbae4af3bd8cb02b7 *./data/out.wav -1055278 ./data/out.wav +91ab1b253cd360037d3fca67b795aba8 *./data/out.wav +1055276 ./data/out.wav d056da679e6d6682812fffb28a7f0db6 *./data/a-ac3.rm 97983 ./data/a-ac3.rm -69526b38166395785eec8ccfb90a105e *./data/a-g726.wav -24332 ./data/a-g726.wav -20cb2fcffd33573a60c93d4dceacd1d1 *./data/out.wav -97190 ./data/out.wav +e1aa1d139e8e241cdf9be8ac8252dabb *./data/a-g726.wav +24330 ./data/a-g726.wav +2f1b2fdb2ebdf4250a850fdcc28b50d1 *./data/out.wav +97188 ./data/out.wav bdc512b78e2ccb1d815aec08794650eb *./data/a-adpcm_ima.wav 266288 ./data/a-adpcm_ima.wav -449ec3854e8b09982302f92ea9cd47ca *./data/out.wav -1056686 ./data/out.wav -5ac5a5ffd680d7880dfb1dd069851691 *./data/a-adpcm_ms.wav -267310 ./data/a-adpcm_ms.wav -e4276587e9ffef41a007ac4c12d3fad2 *./data/out.wav -1056574 ./data/out.wav +1316b03da3bdc8df9785c7995e3c9b2a *./data/out.wav +1056684 ./data/out.wav +d2eee867856d2bdb6d08e936d4ceec0c *./data/a-adpcm_ms.wav +267308 ./data/a-adpcm_ms.wav +91a84bb4f319a3a0bf0c0441b3d3a529 *./data/out.wav +1056572 ./data/out.wav