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 1AF7842E67 for ; Thu, 13 Jan 2022 02:32:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 220D468B5B0; Thu, 13 Jan 2022 04:03:01 +0200 (EET) Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A091468B586 for ; Thu, 13 Jan 2022 04:02:59 +0200 (EET) Received: by mail-qt1-f172.google.com with SMTP id f17so5347123qtf.8 for ; Wed, 12 Jan 2022 18:02:59 -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=2f5ZezIXZiTo3YVZLHysET0XIgDsctgDpAHf2Y4U/w8=; b=Kj/tY4IKYmmeGoblKkevlsFi8qv3E894WpD+4d62S0jKaFP18RgCC6D1v1SEWwQxbB ruogpN/94cXZmHpqBveJaQCiuztVQminCwcDtLFQYSr0JEpuKeUROkXMRerdqqdf7ITT lm185nCTzKdkwmD16HiYqsbA5LJN/xe0X3X0pdZva5qLQDaoUd6IJiN/H0yCUBLKLYZj vlZYic9uDTV/HFKnhulxWWJY3LTSLdrRlGiygbjAJlQ05wn48LUrFjFzaTr8mKQs4TLi Or+iXiuwWTcR1R3P7aqyAx81gue+XjPOgsHj/hkzgqS6Xt53KxxpTe914cA+LkzZvK0C Yq9A== 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=2f5ZezIXZiTo3YVZLHysET0XIgDsctgDpAHf2Y4U/w8=; b=LQdivU+u7wTTIMe7JajUPSHRCmg2WJr3Xz7ZUvTrtJ5N89DDt+WRnuwcjEkEwrvm8i JVvRYEhuNmNjSCuKw6PmQ3f6Rk30WJS8GRE455Jri2FVlHg84iHxDnVNno6xNXPKlH5V vXqp4L0TEaSlFBGgXewuxU8qzfI1d1uOZ/km47wYGwvvnv2MneF2lLdlv84KCosV8RBn KWiA+o1tCkFlkaz2AK+cVm5LHQq7cvQCujMimCiodgqunD4X1zpjzie7m5oTLuzLROZ/ gV0D0oseuPML5PZ6BTAaC+y8tN5IAPp5MVVr8vSARiXLIovVixEaLQ6yT5Itk+Yemevb fTeg== X-Gm-Message-State: AOAM5303RM5MQx1c8EvHq1+AYEZqPesWU6OaIlQlgLFN2pOyP+qcyjDD ICFKAH6nQh4nw3b4HjPcucdq0Vk99x4= X-Google-Smtp-Source: ABdhPJywbIc3isWgm/W/8IVeJcU7mKe2JIext4q7quyiEEU2PvKW2IfAtO4eblNwelorkdnBVgBfsg== X-Received: by 2002:a05:622a:203:: with SMTP id b3mr2031840qtx.640.1642039378211; Wed, 12 Jan 2022 18:02:58 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id v1sm1045961qtc.95.2022.01.12.18.02.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:02:57 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:02:14 -0300 Message-Id: <20220113020242.661-2-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 181/281] 8svx: 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: Anton Khirnov Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/8svx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 6ef8cd73fe..6ef7921274 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -88,38 +88,39 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, { EightSvxContext *esc = avctx->priv_data; AVFrame *frame = data; + int channels = avctx->ch_layout.nb_channels; int buf_size; int ch, ret; int hdr_size = 2; /* decode and interleave the first packet */ if (!esc->data[0] && avpkt) { - int chan_size = avpkt->size / avctx->channels - hdr_size; + int chan_size = avpkt->size / channels - hdr_size; - if (avpkt->size % avctx->channels) { + if (avpkt->size % channels) { av_log(avctx, AV_LOG_WARNING, "Packet with odd size, ignoring last byte\n"); } - if (avpkt->size < (hdr_size + 1) * avctx->channels) { + if (avpkt->size < (hdr_size + 1) * channels) { av_log(avctx, AV_LOG_ERROR, "packet size is too small\n"); return AVERROR_INVALIDDATA; } esc->fib_acc[0] = avpkt->data[1] + 128; - if (avctx->channels == 2) + if (channels == 2) esc->fib_acc[1] = avpkt->data[2+chan_size+1] + 128; esc->data_idx = 0; esc->data_size = chan_size; if (!(esc->data[0] = av_malloc(chan_size))) return AVERROR(ENOMEM); - if (avctx->channels == 2) { + if (channels == 2) { if (!(esc->data[1] = av_malloc(chan_size))) { av_freep(&esc->data[0]); return AVERROR(ENOMEM); } } memcpy(esc->data[0], &avpkt->data[hdr_size], chan_size); - if (avctx->channels == 2) + if (channels == 2) memcpy(esc->data[1], &avpkt->data[2*hdr_size+chan_size], chan_size); } if (!esc->data[0]) { @@ -139,7 +140,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (ch = 0; ch < avctx->channels; ch++) { + for (ch = 0; ch < channels; ch++) { delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx], buf_size, &esc->fib_acc[ch], esc->table); } @@ -148,14 +149,14 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, *got_frame_ptr = 1; - return ((avctx->frame_number == 0)*hdr_size + buf_size)*avctx->channels; + return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels; } static av_cold int eightsvx_decode_init(AVCodecContext *avctx) { EightSvxContext *esc = avctx->priv_data; - 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, "8SVX does not support more than 2 channels\n"); return AVERROR_INVALIDDATA; } -- 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".