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 7A93342F92 for ; Thu, 13 Jan 2022 02:49:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9261068BA13; Thu, 13 Jan 2022 04:07:58 +0200 (EET) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2753D68B9FD for ; Thu, 13 Jan 2022 04:07:54 +0200 (EET) Received: by mail-qv1-f54.google.com with SMTP id a8so5178940qvx.2 for ; Wed, 12 Jan 2022 18:07:54 -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=cYrU+lFDOz180Ezvt4isXp0WgY9theav2IgUb+hBMNk=; b=na07pKHnExuEj2ORITFkOmkWx1ZP2/C+miBatw2ULzUFM5kxKGG60wYMyALv2O8WoR KUI8YFIu66ZQrzd8TtcDt9iTo8U97slyViNERzBWEPtM2J6iiM/oAS4491eIRcyXEQZw UxmTSv3glU0c99nv3RAlOfJlLF1J+0euwGlb6EnElI4/s4dRX7BaTNEsPBSYzvZxbLlm 7DQMxn75AF1kGmUFIJXSO13sb3sM+i00fSoGXROpYOKlCzYDPhj3cvK1QM9djJvEpDDq PX9CFbKSRZDoJ4mcz1mepSg3ZjDkHzkiGsTw0WqbMvlrOcydsjHSpK+QSIDxT1JVMi9I XgWg== 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=cYrU+lFDOz180Ezvt4isXp0WgY9theav2IgUb+hBMNk=; b=whgnaWOrR2aY0oHD3p/IFgKr+HFmxDV9r98v95dXNfoyQ/LduDXRusqodbLNpiDM62 5axD8J6kTaI5a3G2p8kAeKnDqqI7w4PlBHizGzJq/ZHmTG3LyjeDz2MY2HkoDgU811Sg T+BqGTCD3LO7AOfQX4+plP/vQKGaMrC/TpHgJDTUoUR88cYlXW3Y87mITc/ojlnqLNnT DewvFA5IKzZdAdgW2zCS+3QulogOVB/txRLcu3KNTWxhOJnXymy0yXDqdDwLRvQd4g/e 8VkEwTtM8f8kScqQrnpOaHKCe/OiFMI1mVOkYloUh6ttrcYndSNmRTG6TdQUMEROfTbQ jCVQ== X-Gm-Message-State: AOAM530E9bDO+sDzdLs613GqtvBhnAFUxES2oFyx7dnOJSQSRCCTD87F t5Ljz3c6WwQRQ6hoa0NDpE7ePtwKDOo= X-Google-Smtp-Source: ABdhPJyVyzh3iulzAg45UyCqhn+hxuBcP3ZZOgSp9T2XHWlLLehkics8sbrhiMoxOqU/f+fxarzoPg== X-Received: by 2002:a05:6214:3019:: with SMTP id ke25mr616903qvb.90.1642039673534; Wed, 12 Jan 2022 18:07:53 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id a16sm1085946qta.13.2022.01.12.18.07.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:07:53 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:07:04 -0300 Message-Id: <20220113020713.801-21-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 260/281] sonic: 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: James Almer --- libavcodec/sonic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index cf1cfb1460..34f1605b29 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -598,13 +598,13 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx) s->version = 2; - if (avctx->channels > MAX_CHANNELS) + if (avctx->ch_layout.nb_channels > MAX_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n"); return AVERROR(EINVAL); /* only stereo or mono for now */ } - if (avctx->channels == 2) + if (avctx->ch_layout.nb_channels == 2) s->decorrelation = MID_SIDE; else s->decorrelation = 3; @@ -637,7 +637,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx) for (i = 0; i < s->num_taps; i++) s->tap_quant[i] = ff_sqrt(i+1); - s->channels = avctx->channels; + s->channels = avctx->ch_layout.nb_channels; s->samplerate = avctx->sample_rate; s->block_align = 2048LL*s->samplerate/(44100*s->downsampling); @@ -853,7 +853,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) int i; int ret; - s->channels = avctx->channels; + s->channels = avctx->ch_layout.nb_channels; s->samplerate = avctx->sample_rate; if (!avctx->extradata) @@ -896,7 +896,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n"); return AVERROR_INVALIDDATA; } - avctx->channels = s->channels; + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + avctx->ch_layout.nb_channels = s->channels; s->lossless = get_bits1(&gb); if (!s->lossless) @@ -989,7 +991,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, if (buf_size == 0) return 0; - frame->nb_samples = s->frame_size / avctx->channels; + frame->nb_samples = s->frame_size / avctx->ch_layout.nb_channels; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; samples = (int16_t *)frame->data[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".