Browse Source

avcodec/adpcm_swf: set block_align when encoding

Allows it to be muxed to WAVs.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
tags/n4.4
Zane van Iperen 4 years ago
parent
commit
0547fa572b
No known key found for this signature in database GPG Key ID: 68616B2D8AC4DCC5
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      libavcodec/adpcmenc.c

+ 3
- 4
libavcodec/adpcmenc.c View File

@@ -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;


Loading…
Cancel
Save