From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5885042E67 for ; Thu, 13 Jan 2022 02:37:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F0E268B77A; Thu, 13 Jan 2022 04:03:28 +0200 (EET) Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ADC968B755 for ; Thu, 13 Jan 2022 04:03:25 +0200 (EET) Received: by mail-qv1-f42.google.com with SMTP id jr5so5075295qvb.11 for ; Wed, 12 Jan 2022 18:03:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Gx9C5lkZ/lPr1w8+5YRmueEFLTUc5d0SE5FRWaXArX8=; b=q4KkqX3PpqDYx4JvNa9HeI/b5j72tAU1s0yn5QelqdkN2mdWkSV4yYrxQp8zLZsuNn FK+RqDiuIk4bp486GLeZcKRg0ip9WHSvWnJOb1yMysO+G6TNblrOZLyDB2+cSX57227x h3vFKSLhPUx3jt+87kMpM0Sbi8OofxhPRKsQH/oD80Di32sNocHA3zZtaGhl/l0peE0F zqbrr0kryNKJ/bun7OolznXmg8jR0Ulrj6GTEcCTOfs3rXAxDKIXTlzwfUyyzsgtkgsH 99xxKS7atZTqxF/bAUGo69WLkU+xoVlpSSjBGRn3zu2cMR4zr56ybK8cWZQmquLOVyGn Wa1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gx9C5lkZ/lPr1w8+5YRmueEFLTUc5d0SE5FRWaXArX8=; b=5VfvX2K/dPHCRifmAlY+pqdwIeHJX9Ilc7f3+tNGxQZpkPV+qTPIZYF1igpnBNWNPw CidXLlMfoOv2aspP1u3T3lQgwA3WnH1fuCBSDQM66xUQcdAAzz8otTYopZqJlL1i3CVD c/kavmO1gXAkJ1yjEThtp/a4GVgNqg3F08vSB2hgDl7IPG30alFyN81M9YbeKEAXCDbH UKs1aH0u7xK/Vs9ID6XIV9gS06m71Lzn1nX7eZ1CUdxku8/OsaRiLTUaBGCCzIC+8M8G zXVEEzMk4Cz1LT0iIumWuuam0isTQxWKXy9BsXoYrsEarpXljpHI1iOEMDlM6SESGJxK uDXQ== X-Gm-Message-State: AOAM533X0+9OrNcoVYMfXN7y2hRmPVuIiSenYWfbAVNSyZvc9r26c2N3 fzZy97iXGitPigXHEN6VWoaosZOF2tU= X-Google-Smtp-Source: ABdhPJym5vsEQQ0oYoF8jbKrKBnod4OPhl3e+mEvSMG1ouYSZh1sWRVOCyvc1SZTzVah+J1Dq2DFKQ== X-Received: by 2002:a05:6214:300b:: with SMTP id ke11mr2368382qvb.8.1642039404050; Wed, 12 Jan 2022 18:03:24 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id v1sm1045961qtc.95.2022.01.12.18.03.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:03:23 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:02:35 -0300 Message-Id: <20220113020242.661-23-jamrial@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113015101.4-1-jamrial@gmail.com> References: <20220113015101.4-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 202/281] dpcm: convert to new channel layout API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/dpcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index d9ea23adb3..95052282ae 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -132,7 +132,7 @@ static av_cold int dpcm_decode_init(AVCodecContext *avctx) DPCMContext *s = avctx->priv_data; int i; - if (avctx->channels < 1 || avctx->channels > 2) { + if (avctx->ch_layout.nb_channels < 1 || avctx->ch_layout.nb_channels > 2) { av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); return AVERROR(EINVAL); } @@ -215,7 +215,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, int out = 0, ret; int predictor[2]; int ch = 0; - int stereo = avctx->channels - 1; + int stereo = avctx->ch_layout.nb_channels - 1; int16_t *output_samples, *samples_end; GetByteContext gb; @@ -229,10 +229,10 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, out = buf_size - 8; break; case AV_CODEC_ID_INTERPLAY_DPCM: - out = buf_size - 6 - avctx->channels; + out = buf_size - 6 - avctx->ch_layout.nb_channels; break; case AV_CODEC_ID_XAN_DPCM: - out = buf_size - 2 * avctx->channels; + out = buf_size - 2 * avctx->ch_layout.nb_channels; break; case AV_CODEC_ID_SOL_DPCM: if (avctx->codec_tag != 3) @@ -250,12 +250,12 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } - if (out % avctx->channels) { + if (out % avctx->ch_layout.nb_channels) { av_log(avctx, AV_LOG_WARNING, "channels have differing number of samples\n"); } /* get output buffer */ - frame->nb_samples = (out + avctx->channels - 1) / avctx->channels; + frame->nb_samples = (out + avctx->ch_layout.nb_channels - 1) / avctx->ch_layout.nb_channels; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; output_samples = (int16_t *)frame->data[0]; @@ -287,7 +287,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, case AV_CODEC_ID_INTERPLAY_DPCM: bytestream2_skipu(&gb, 6); /* skip over the stream mask and stream length */ - for (ch = 0; ch < avctx->channels; ch++) { + for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16); *output_samples++ = predictor[ch]; } @@ -307,7 +307,7 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, { int shift[2] = { 4, 4 }; - for (ch = 0; ch < avctx->channels; ch++) + for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) predictor[ch] = sign_extend(bytestream2_get_le16u(&gb), 16); ch = 0; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".