avcodec/adpcm_ima_wav: support custom block size for encoding

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
This commit is contained in:
Zane van Iperen 2020-10-14 22:43:34 +10:00
parent ed1cfb8e31
commit e368be5230
No known key found for this signature in database
GPG Key ID: 68616B2D8AC4DCC5
1 changed files with 2 additions and 2 deletions

View File

@ -113,11 +113,11 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
case AV_CODEC_ID_ADPCM_IMA_WAV: case AV_CODEC_ID_ADPCM_IMA_WAV:
/* each 16 bits sample gives one nibble /* each 16 bits sample gives one nibble
and we have 4 bytes per channel overhead */ and we have 4 bytes per channel overhead */
avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / avctx->frame_size = (s->block_size - 4 * avctx->channels) * 8 /
(4 * avctx->channels) + 1; (4 * avctx->channels) + 1;
/* seems frame_size isn't taken into account... /* seems frame_size isn't taken into account...
have to buffer the samples :-( */ have to buffer the samples :-( */
avctx->block_align = BLKSIZE; avctx->block_align = s->block_size;
avctx->bits_per_coded_sample = 4; avctx->bits_per_coded_sample = 4;
break; break;
case AV_CODEC_ID_ADPCM_IMA_QT: case AV_CODEC_ID_ADPCM_IMA_QT: