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 D6F9340B1C for ; Mon, 7 Mar 2022 10:42:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D530D68B0CD; Mon, 7 Mar 2022 12:42:44 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DEB4368A987 for ; Mon, 7 Mar 2022 12:42:38 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 3BEBD240179 for ; Mon, 7 Mar 2022 11:42:38 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id zYOd9txTzaiM for ; Mon, 7 Mar 2022 11:42:37 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B66A92400F5 for ; Mon, 7 Mar 2022 11:42:37 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id EA0E31601AD; Mon, 7 Mar 2022 11:42:37 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20220113020713.801-30-jamrial@gmail.com> References: <20220113015101.4-1-jamrial@gmail.com> <20220113020713.801-30-jamrial@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Mon, 07 Mar 2022 11:42:37 +0100 Message-ID: <164664975793.19727.9757957460492717837@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 269/281] wavpack: 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: Quoting James Almer (2022-01-13 03:07:13) > From: Anton Khirnov > > Signed-off-by: Vittorio Giovara > Signed-off-by: James Almer > --- > libavcodec/wavpack.c | 51 ++++++++++++++++++----------------------- > libavcodec/wavpackenc.c | 29 ++++++++++++----------- > 2 files changed, 37 insertions(+), 43 deletions(-) > > diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c > index 6b2ec19bf1..e0350ce732 100644 > --- a/libavcodec/wavpack.c > +++ b/libavcodec/wavpack.c > @@ -1512,36 +1509,32 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no, > new_samplerate *= rate_x; > > if (multiblock) { > - if (chan) > - new_channels = chan; > - if (chmask) > - new_chmask = chmask; > + if (chmask) { > + av_channel_layout_from_mask(&new_ch_layout, chmask); > + if (chan && new_ch_layout.nb_channels != chan) { > + av_log(avctx, AV_LOG_ERROR, "Channel mask does not match the channel count\n"); > + return AVERROR_INVALIDDATA; > + } > + } else > + av_channel_layout_copy(&new_ch_layout, &avctx->ch_layout); user-supplied layout can be custom, so you should probably check this and the second copy below -- Anton Khirnov _______________________________________________ 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".