]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcm_ms: support custom block size for encoding
authorZane van Iperen <zane@zanevaniperen.com>
Wed, 14 Oct 2020 12:21:30 +0000 (22:21 +1000)
committerZane van Iperen <zane@zanevaniperen.com>
Fri, 16 Oct 2020 23:36:05 +0000 (09:36 +1000)
Fixes tickets #6585 and #7109

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
libavcodec/adpcmenc.c

index 1ca74abc82173536aa470ff17cd4f16e99b6725a..df5a7333cbc8b27fd8dbde9454d4ada9ccb1d8a2 100644 (file)
@@ -127,9 +127,9 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
     case AV_CODEC_ID_ADPCM_MS:
         /* each 16 bits sample gives one nibble
            and we have 7 bytes per channel overhead */
-        avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2;
+        avctx->frame_size = (s->block_size - 7 * avctx->channels) * 2 / avctx->channels + 2;
         avctx->bits_per_coded_sample = 4;
-        avctx->block_align    = BLKSIZE;
+        avctx->block_align     = s->block_size;
         if (!(avctx->extradata = av_malloc(32 + AV_INPUT_BUFFER_PADDING_SIZE)))
             return AVERROR(ENOMEM);
         avctx->extradata_size = 32;