From patchwork Fri Oct 16 06:22:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 22997 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id E803544898C for ; Fri, 16 Oct 2020 09:22:53 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D07FC68BA96; Fri, 16 Oct 2020 09:22:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 52BB368B916 for ; Fri, 16 Oct 2020 09:22:47 +0300 (EEST) Date: Fri, 16 Oct 2020 06:22:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail2; t=1602829366; bh=FWBLSd5vp9Tfa4qsQ7/GULBK5Ha6bg3B9iE0SVR0DO4=; h=Date:To:From:Cc:Reply-To:Subject:From; b=CSF3zgfgTE6aV7m9lVo/HtUpmf3TxJApO8mdpgKWAlhrzcBaTTNxoRsOeQy2x5kqw MWYBzQxpRigBm7PpXP/7flFSUNtLTr4zyK8S0xFaTNB3foTKmJcayJel4Hmyy4zBGs btVVih3R1suLHZ3b5GFnIfkVPu8WeFJi7DgKeNPC9U9JEZIsz2FU9XUUrUpSL6Do1T 5hroDL9BcM+4TICC+YaO4hfm7+YXAhAsxaaRPt7+HLicoG0vK+7+RKq3rmOI9XOoNL sEyszuz5aWneUFp02ox1StWtJIp0i6uTULnB9b4D08f52Oh9HvK3d9s8e+F4ohWU1W p3LRP8/oH/QkQ== To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20201016062049.2746-4-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/adpcm_swf: set block_align when encoding X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Allows it to be muxed to WAVs. Signed-off-by: Zane van Iperen --- libavcodec/adpcmenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index 24bd31c4a9..00c7df3cd1 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -144,6 +144,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 = BLKSIZE * 2 / avctx->channels; @@ -540,9 +541,7 @@ 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 || + 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