summaryrefslogtreecommitdiff
path: root/libavcodec/adpcmenc.c
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-10-16 13:51:58 +1000
committerZane van Iperen <zane@zanevaniperen.com>2020-10-21 11:26:38 +1000
commit0547fa572bd88a20637508bd7dcf36e2953dc64d (patch)
tree4a46d9ae5929c2c93bbd4050b6b510de43a57716 /libavcodec/adpcmenc.c
parente9dd73d30d09043446ac6dd7b8ad31e557873852 (diff)
avcodec/adpcm_swf: set block_align when encoding
Allows it to be muxed to WAVs. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavcodec/adpcmenc.c')
-rw-r--r--libavcodec/adpcmenc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index b2be83b84e..9e0bb831e8 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -154,6 +154,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
avctx->frame_size = 512 * (avctx->sample_rate / 11025);
+ avctx->block_align = (2 + avctx->channels * (22 + 4 * (avctx->frame_size - 1)) + 7) / 8;
break;
case AV_CODEC_ID_ADPCM_IMA_SSI:
avctx->frame_size = s->block_size * 2 / avctx->channels;
@@ -550,10 +551,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
samples_p = (int16_t **)frame->extended_data;
st = avctx->channels == 2;
- if (avctx->codec_id == AV_CODEC_ID_ADPCM_SWF)
- pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8;
- else if (avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_SSI ||
- avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM)
+ if (avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_SSI ||
+ avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_APM)
pkt_size = (frame->nb_samples * avctx->channels) / 2;
else
pkt_size = avctx->block_align;