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 7F0CC42E67 for ; Thu, 13 Jan 2022 02:33:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D902968B5F1; Thu, 13 Jan 2022 04:03:11 +0200 (EET) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C22668B5CD for ; Thu, 13 Jan 2022 04:03:08 +0200 (EET) Received: by mail-qt1-f176.google.com with SMTP id c7so1764883qtc.11 for ; Wed, 12 Jan 2022 18:03:08 -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=uuiU1Iqka94CZWV0GDrkb8jp2BgJr72KwnOVAV9NSLM=; b=lec1dNSvcxoVn3OTrhk7EBf2b83EJOkWxonagrEKoDASV1YW3GU4BY6xKaoQFzIKSQ 80pR2zykphKGjBpky4L8T+BUGc9h37lgMc5kf4+u4tgQkQUp2T8OtvgBLlriloPJv9Ks 1Ee0GjSgC7IhAq4CyyJtB63wmgULIQDvyUW6BGMwGPUoohj+wjwbq9uVhp7x5zjIIAC4 hbFMIAcrTFULtAK0EREUFTJU72Q2YhqS7+Su8AUrVMAhVV2zmZiJjSoYWkD696MDAczb 8sJkM8Vk99eYzyaSAR5E/jzNtPV5DTTRjYzjr9OMCsK/vtPN9qQFMmehZbUhCQZRntz6 e2Qg== 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=uuiU1Iqka94CZWV0GDrkb8jp2BgJr72KwnOVAV9NSLM=; b=097EK3fJbOE5pw/jBHRyy47ogDMoZejSQD101HOXsjnqCxG8YwrF+rxBJGsj0gq7Qs hCfwryADmITTmiAOvfJYDVo/sLMbajuq0ua+uLefbnMwASrXz8uCqrHPRfP78YhAxfPq DiWaHjZdrqSnqYTSjSyda9uz2jF+x1JqghwgEsXluM71DlZK37FCeVWXiPuhA6Ljxpwx 3zn5HRGh+jPPPi6IYJeW1dPWWFnuxtHUyoI0olBplaPn40u9HC5Ve1DT9hUGZBMpQ46j mUsEnSZF81PQKTqZKAmmnes/UD9Nj9Zv2+EmcyMfAG+e3/v5lushVpL6SOmtPcn5AEtf CHHg== X-Gm-Message-State: AOAM531apErU9bZC8/iMtgIQj7qsCuF04B2tZnOOlqq8fQHm1RJlP0I8 NqTzbGXf24T62SEjZBYukq2YaocnTsw= X-Google-Smtp-Source: ABdhPJxr0T4LtdaonWYEK48+t3REZynxZYSFfmwMsuQ+QAudtmBGGxvBw72HM1uLe8EXrM/Dbzsr8A== X-Received: by 2002:a05:622a:164c:: with SMTP id y12mr1973836qtj.677.1642039386979; Wed, 12 Jan 2022 18:03:06 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id v1sm1045961qtc.95.2022.01.12.18.03.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:03:06 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:02:21 -0300 Message-Id: <20220113020242.661-9-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 188/281] amr: 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/amr_parser.c | 10 +++++----- libavcodec/amrnbdec.c | 12 ++++++------ libavcodec/amrwbdec.c | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c index c0b14700e2..9484d720ee 100644 --- a/libavcodec/amr_parser.c +++ b/libavcodec/amr_parser.c @@ -63,9 +63,9 @@ static int amr_parse(AVCodecParserContext *s1, *poutbuf_size = 0; *poutbuf = NULL; - if (!avctx->channels) { - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; + if (!avctx->ch_layout.nb_channels) { + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) { @@ -73,7 +73,7 @@ static int amr_parse(AVCodecParserContext *s1, } else { int ch, offset = 0; - for (ch = s->current_channel; ch < avctx->channels; ch++) { + for (ch = s->current_channel; ch < avctx->ch_layout.nb_channels; ch++) { if (s->remaining >= 0) { next = s->remaining; } else { @@ -96,7 +96,7 @@ static int amr_parse(AVCodecParserContext *s1, } } - s->current_channel = ch % avctx->channels; + s->current_channel = ch % avctx->ch_layout.nb_channels; if (s->remaining < 0) next = offset; diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index d8e0370a3b..c6df87bffa 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -166,20 +166,20 @@ static av_cold int amrnb_decode_init(AVCodecContext *avctx) AMRChannelsContext *s = avctx->priv_data; int i; - if (avctx->channels > 2) { + if (avctx->ch_layout.nb_channels > 2) { avpriv_report_missing_feature(avctx, ">2 channel AMR"); return AVERROR_PATCHWELCOME; } - if (!avctx->channels) { - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; + if (!avctx->ch_layout.nb_channels) { + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } if (!avctx->sample_rate) avctx->sample_rate = 8000; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - for (int ch = 0; ch < avctx->channels; ch++) { + for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { AMRContext *p = &s->ch[ch]; // p->excitation always points to the same position in p->excitation_buf p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1]; @@ -969,7 +969,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (int ch = 0; ch < avctx->channels; ch++) { + for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { AMRContext *p = &s->ch[ch]; float fixed_gain_factor; AMRFixed fixed_sparse = {0}; // fixed vector up to anti-sparseness processing diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 3ff4077f7f..ad62c541c5 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -102,20 +102,20 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx) AMRWBChannelsContext *s = avctx->priv_data; int i; - if (avctx->channels > 2) { + if (avctx->ch_layout.nb_channels > 2) { avpriv_report_missing_feature(avctx, ">2 channel AMR"); return AVERROR_PATCHWELCOME; } - if (!avctx->channels) { - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; + if (!avctx->ch_layout.nb_channels) { + av_channel_layout_uninit(&avctx->ch_layout); + avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } if (!avctx->sample_rate) avctx->sample_rate = 16000; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - for (int ch = 0; ch < avctx->channels; ch++) { + for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { AMRWBContext *ctx = &s->ch[ch]; av_lfg_init(&ctx->prng, 1); @@ -1115,7 +1115,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - for (int ch = 0; ch < avctx->channels; ch++) { + for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { AMRWBContext *ctx = &s->ch[ch]; AMRWBFrame *cf = &ctx->frame; int expected_fr_size, header_size; -- 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".