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 EACFC42F79 for ; Thu, 13 Jan 2022 02:47:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 031DD68B9C9; Thu, 13 Jan 2022 04:07:47 +0200 (EET) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4EFA68B9B2 for ; Thu, 13 Jan 2022 04:07:44 +0200 (EET) Received: by mail-qt1-f170.google.com with SMTP id g21so5228996qtk.4 for ; Wed, 12 Jan 2022 18:07:44 -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=n49MhkcegvPKmSLKjceN2gblSOxmhZ1GxcBHPf9RTSE=; b=LxXC2d2AFUceu8eh04LblivAkYDAdAo0e9XMrujDKjpKLMGQiBIxfpU9M1O1mxTknf iEOZswMdzqaU5WM4N2jgD++ercFIC+g6CICbvHPRDhrrvuf88mQPG/IrQBM8Tvp82ZVR jZBftQ2xWup2UheOF1n4d3xsmrz3mZZlgbFSyq8E79bEY/5tfQTCb5aCHmCcvYxrs0cc y+k6J39EgwtPfqWxtqrrmwAcWDrFPOo+yAdQ6R0jGPX39I/p/hfo7EeszFoEiVxzGble 3DDubXX80Q1+pOvoZmpmC40UdWOfb41cm9gTZ1tOAqDW0wyo6UNf5zWugiR6istPu380 RHOQ== 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=n49MhkcegvPKmSLKjceN2gblSOxmhZ1GxcBHPf9RTSE=; b=4eMQMUG1dAYxWSr9awz0vV1Es+St9cm+RBcRm8l3wURSvkBKR51Jo7XJlVIVQeotiQ YwKcobRSTA6LJ11N8tXmzi+6hL+V5dCWjRwPz2gYaRQEBC0lom4/TUno0V1OarL6JJyH rHyHuHtYz7T6TiI3+pJMAnmoojj9BQljupDWspd4RNjxxbR9Th6s1HFfsF6HvHcN4GLH /sD4pO8qQgYrMHDlu9dyRwfgXLnEr0GxUkYJ42U+2yC/K6jYTJ4ZtbMivaSSzcoyMFmS o877cw/YMboVHB9rRaF7glWAJlrYOyWwAEKC/1yz+676Ql2AGpGo/SHE0GNL0fELSSyf sy1A== X-Gm-Message-State: AOAM533Qoyy9IEnM7AXr2L1BoOSzcSowYVwVsoa574g6Q1kmv9Baku9C zCxfldyQOccPs3f1OM11h99sRdYI12o= X-Google-Smtp-Source: ABdhPJyEqoJ5T8EXEuwN1SQLw1RHQF8912N8qlUWMWhCbZZ2Vr7bKOFzOs9vSofwEsoN8NxxQe33eQ== X-Received: by 2002:a05:622a:11ca:: with SMTP id n10mr2048648qtk.113.1642039663344; Wed, 12 Jan 2022 18:07:43 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id a16sm1085946qta.13.2022.01.12.18.07.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:07:43 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:06:56 -0300 Message-Id: <20220113020713.801-13-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 252/281] ralf: 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/ralf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index bb80119b0c..eac3e60371 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -128,7 +128,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { RALFContext *ctx = avctx->priv_data; int i, j, k; - int ret; + int ret, channels; if (avctx->extradata_size < 24 || memcmp(avctx->extradata, "LSD:", 4)) { av_log(avctx, AV_LOG_ERROR, "Extradata is not groovy, dude\n"); @@ -141,17 +141,17 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } - avctx->channels = AV_RB16(avctx->extradata + 8); + channels = AV_RB16(avctx->extradata + 8); avctx->sample_rate = AV_RB32(avctx->extradata + 12); - if (avctx->channels < 1 || avctx->channels > 2 + if (channels < 1 || channels > 2 || avctx->sample_rate < 8000 || avctx->sample_rate > 96000) { av_log(avctx, AV_LOG_ERROR, "Invalid coding parameters %d Hz %d ch\n", - avctx->sample_rate, avctx->channels); + avctx->sample_rate, channels); return AVERROR_INVALIDDATA; } avctx->sample_fmt = AV_SAMPLE_FMT_S16P; - avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO - : AV_CH_LAYOUT_MONO; + av_channel_layout_uninit(&avctx->ch_layout); + av_channel_layout_default(&avctx->ch_layout, channels); ctx->max_frame_size = AV_RB32(avctx->extradata + 16); if (ctx->max_frame_size > (1 << 20) || !ctx->max_frame_size) { @@ -358,7 +358,7 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, return AVERROR_INVALIDDATA; } - if (avctx->channels > 1) + if (avctx->ch_layout.nb_channels > 1) dmode = get_bits(gb, 2) + 1; else dmode = 0; @@ -368,7 +368,7 @@ static int decode_block(AVCodecContext *avctx, GetBitContext *gb, bits[0] = 16; bits[1] = (mode[1] == 2) ? 17 : 16; - for (ch = 0; ch < avctx->channels; ch++) { + for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) { if ((ret = decode_channel(ctx, gb, ch, len, mode[ch], bits[ch])) < 0) return ret; if (ctx->filter_params > 1 && ctx->filter_params != FILTER_RAW) { @@ -484,7 +484,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, while (get_bits_left(&gb) > 0) { if (ctx->num_blocks >= FF_ARRAY_ELEMS(ctx->block_size)) return AVERROR_INVALIDDATA; - ctx->block_size[ctx->num_blocks] = get_bits(&gb, 13 + avctx->channels); + ctx->block_size[ctx->num_blocks] = get_bits(&gb, 13 + avctx->ch_layout.nb_channels); if (get_bits1(&gb)) { ctx->block_pts[ctx->num_blocks] = get_bits(&gb, 9); } else { -- 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".