Commit 7d7b40f4 authored by Mans Rullgard's avatar Mans Rullgard
Browse files

pcmenc: set correct bitrate value



This fixes a bogus bitrate value in the header of WAV files with
alaw/ulaw audio.
Signed-off-by: default avatarMans Rullgard <mans@mansr.com>
parent d8947523
......@@ -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();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
......
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
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
......@@ -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
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment