diff options
author | Mans Rullgard <mans@mansr.com> | 2012-05-16 00:01:34 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-12 20:36:47 +0200 |
commit | 394f4ee61e3bf94aae0749095c8a555e3cb3b719 (patch) | |
tree | 2a67bbd7b1a54c5ad23ae86b16c838ea2f5a3df4 | |
parent | 497d66126242a94c32c146434e543ee2833e6349 (diff) | |
download | ffmpeg-394f4ee61e3bf94aae0749095c8a555e3cb3b719.tar.gz |
pcmenc: set correct bitrate value
This fixes a bogus bitrate value in the header of WAV files with
alaw/ulaw audio.
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 7d7b40f48a05af4483b31cdb8b4f1808b97b1f2f)
Conflicts:
libavcodec/pcm.c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/pcm.c | 1 | ||||
-rw-r--r-- | tests/ref/acodec/pcm_alaw | 2 | ||||
-rw-r--r-- | tests/ref/acodec/pcm_mulaw | 2 | ||||
-rw-r--r-- | tests/ref/seek/pcm_alaw_wav | 36 | ||||
-rw-r--r-- | tests/ref/seek/pcm_mulaw_wav | 36 |
5 files changed, 39 insertions, 38 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 35ccc9d8f4..818a635d22 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -48,6 +48,7 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx) avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; + avctx->bit_rate = avctx->block_align * avctx->sample_rate * 8; avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; diff --git a/tests/ref/acodec/pcm_alaw b/tests/ref/acodec/pcm_alaw index 4943831d39..0eba43a0c4 100644 --- a/tests/ref/acodec/pcm_alaw +++ b/tests/ref/acodec/pcm_alaw @@ -1,4 +1,4 @@ -ede2da07839a00c255a43129922f2c7b *./tests/data/acodec/pcm_alaw.wav +a2dd6a934ec6d5ec901a211652e85227 *./tests/data/acodec/pcm_alaw.wav 529258 ./tests/data/acodec/pcm_alaw.wav f323f7551ffad91de8613f44dcb198b6 *./tests/data/pcm_alaw.acodec.out.wav stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400 diff --git a/tests/ref/acodec/pcm_mulaw b/tests/ref/acodec/pcm_mulaw index cefd76ba49..e1abcbe60c 100644 --- a/tests/ref/acodec/pcm_mulaw +++ b/tests/ref/acodec/pcm_mulaw @@ -1,4 +1,4 @@ -0c2a55850fb46ad5385a69b15b271f10 *./tests/data/acodec/pcm_mulaw.wav +fd10ee54bd298fc29fd6fc70baa71414 *./tests/data/acodec/pcm_mulaw.wav 529258 ./tests/data/acodec/pcm_mulaw.wav 7ae8c3fc804bd574006fd547fe28980c *./tests/data/pcm_mulaw.acodec.out.wav stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400 diff --git a/tests/ref/seek/pcm_alaw_wav b/tests/ref/seek/pcm_alaw_wav index 22d95bf27f..e5466bd2d3 100644 --- a/tests/ref/seek/pcm_alaw_wav +++ b/tests/ref/seek/pcm_alaw_wav @@ -2,52 +2,52 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos: 30364 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 167124 size: 4096 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos: 12672 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69590 size: 4096 ret: 0 st: 0 flags:1 ts:-0.317506 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos: 41286 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 227320 size: 4096 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos: 23590 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 129786 size: 4096 ret: 0 st: 0 flags:0 ts: 0.365011 -ret: 0 st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos: 5900 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32252 size: 4096 ret: 0 st: 0 flags:1 ts:-0.740839 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos: 34512 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 189982 size: 4096 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 16818 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 92448 size: 4096 ret: 0 st: 0 flags:0 ts:-0.058322 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos: 45430 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 250178 size: 4096 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 27738 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 152644 size: 4096 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos: 10044 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55110 size: 4096 ret: 0 st: 0 flags:0 ts:-0.481655 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 2.412494 -ret: 0 st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos: 38656 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 212840 size: 4096 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos: 20966 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 115306 size: 4096 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos: 3270 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17772 size: 4096 ret: 0 st: 0 flags:0 ts:-0.904989 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 1.989184 -ret: 0 st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos: 31884 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 175504 size: 4096 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos: 14192 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77968 size: 4096 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:0 ts: 2.671678 -ret: 0 st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos: 42806 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 235700 size: 4096 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos: 25110 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 138166 size: 4096 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 7418 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40630 size: 4096 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 diff --git a/tests/ref/seek/pcm_mulaw_wav b/tests/ref/seek/pcm_mulaw_wav index 22d95bf27f..e5466bd2d3 100644 --- a/tests/ref/seek/pcm_mulaw_wav +++ b/tests/ref/seek/pcm_mulaw_wav @@ -2,52 +2,52 @@ ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts:-1.000000 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos: 30364 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 167124 size: 4096 ret: 0 st: 0 flags:0 ts: 0.788345 -ret: 0 st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos: 12672 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 69590 size: 4096 ret: 0 st: 0 flags:1 ts:-0.317506 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos: 41286 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 227320 size: 4096 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos: 23590 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 129786 size: 4096 ret: 0 st: 0 flags:0 ts: 0.365011 -ret: 0 st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos: 5900 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 32252 size: 4096 ret: 0 st: 0 flags:1 ts:-0.740839 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos: 34512 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 189982 size: 4096 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 16818 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 92448 size: 4096 ret: 0 st: 0 flags:0 ts:-0.058322 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos: 45430 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 250178 size: 4096 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 27738 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 152644 size: 4096 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos: 10044 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 55110 size: 4096 ret: 0 st: 0 flags:0 ts:-0.481655 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 2.412494 -ret: 0 st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos: 38656 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 212840 size: 4096 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos: 20966 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 115306 size: 4096 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos: 3270 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 17772 size: 4096 ret: 0 st: 0 flags:0 ts:-0.904989 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:1 ts: 1.989184 -ret: 0 st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos: 31884 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 175504 size: 4096 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos: 14192 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 77968 size: 4096 ret: 0 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 ret: 0 st: 0 flags:0 ts: 2.671678 -ret: 0 st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos: 42806 size: 4096 +ret: 0 st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 235700 size: 4096 ret: 0 st: 0 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos: 25110 size: 4096 +ret: 0 st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 138166 size: 4096 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 7418 size: 4096 +ret: 0 st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 40630 size: 4096 ret: 0 st:-1 flags:1 ts:-0.645825 ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 58 size: 4096 |