From patchwork Thu Jan 13 02:00:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33449 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp36004iog; Wed, 12 Jan 2022 18:31:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJysmw1QidJWfeT/W8KHkIWrGd/67ZuJvsR1Du7+kUYuEG3dwQadQUhcIMiZIIS1IaM61U/+ X-Received: by 2002:a17:906:9b91:: with SMTP id dd17mr1902328ejc.371.1642041063416; Wed, 12 Jan 2022 18:31:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642041063; cv=none; d=google.com; s=arc-20160816; b=zd24FvwEaB99tIWdlnzPGRxx+h6FqJGU29YxESqUaqwBihTmq075vxrnbtiwyGDTDe Nj2YyVH2Bd+Es16XSfn9zurMIQnpodVw/olCq0p4oTlteTgbW7Ynkz35wGMa/QgClmPE +sTfWsfupnKwM5/TJF+LDMFUiMqeekmin6yS/T8XNNMlC4POOccjkwiHeuEg4+fAa4xO K+K3XVjTZXOuIi+9XObFb2VM9UWregTXx8wX1QlGPLdsxzQ27X0mQN2Wl8RynvOHBOwB QRLOzoeOTvQ+rUFSvWjySRpN0hoO63OgusxnP9Eh8NJuGy1PqpmVKrCyZk6FT9l/4bB3 JKUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=cUOstQm8rHwFu5EWlbXyFkHOdWl4yNtR6SSYtExWTQc=; b=yc3OkcqiEqigtVQHKfbhOH3XhdSs1KbcTWC8oz6QhnxTiCGAp25gm1fUem7679/w2i 1YWqAGuxB8E+lJF5Prevw3jo4jcyF9jGE6tLlIli7A2hYZKf3AVjjN3kUf3aHuscBt4U HRLySnRKY48oWpg1IMqhka8EWRg/SpB3ehpq662GuphwVarDoylvkZXLEFNwmu68OLJK F2FlmGuod9NwA/1hN+rhd2obhcSYEstSnucqdoBAQrFDnbOsAQD/nwjV81uThgosTBnj dskIQgXavgzcXGrCocTS7fWu16PB4hJq8nRhWn4F0ZTyW+9ae52FZKcbGM693LzIrjbq +XWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="V7Pw0H/0"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ji14si926546ejc.898.2022.01.12.18.31.03; Wed, 12 Jan 2022 18:31:03 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="V7Pw0H/0"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EA69B68B55D; Thu, 13 Jan 2022 04:01:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B7B568B51B for ; Thu, 13 Jan 2022 04:01:38 +0200 (EET) Received: by mail-qt1-f180.google.com with SMTP id g21so5214448qtk.4 for ; Wed, 12 Jan 2022 18:01:38 -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=DvmUjYi029Qx+vyxtgxr4EAuorQY5oX99rt1QTGjHCM=; b=V7Pw0H/0Wv2M3E+cE26P3D0ETrEuwlOHrckX1Xt1DM4y+BDDi9ndfIT0Zbo/zuw23X ICwdbPIPzOywSmN8ELpPffbkQ6Bh9UdHkCr5nGAaUzwOrio1qAVQNuzbA/Dv7YSI8DM4 D8qwuNVEyLAzgAqcmsxQE25fEdxQ8HMDaBG9y5sjCdZUecN0XCZfzpAieBHTyMCgI8TC qASa+YJhq8pCFlBoqINEzjiHHN1blpu15q1VzFk1Vs+ndfOG1QGOzIbfufVOwKhexMNC rUID/0lyieFBpmZDYHka8nwbXZKfQiM4DE1iqtyh0uFkqir7wgxTUpE357+ERnzrUDHV 91IA== 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=DvmUjYi029Qx+vyxtgxr4EAuorQY5oX99rt1QTGjHCM=; b=gL4lY/ivRZ7nZqJaV5H+rYIQUfNFQQV0F0siI4GHwjOc2jydCCYSXQFAQ+oaHqr0Pl WAhdeeWm6uQH1MDa5cfBVodCi7QeY/4F+0pnzUt3Z2PlgUKzJUK/zuqZ6HVJge6llqSx heNIe6uwOrJr6+jo7bznb0snHtPAOkepzOqf/74sGLmfjjiSmN3qrYPEjxqnQWPqvikr 3s8YVZ4o3SRxknVS5oarDpbeQEjwPfrugiJQtJcFyuOKgBEeBPI8A7vo6NHDANffUgiS o7c+tKI4GDM6p3fqUcwg7SJVHyTUyZYrR3nDQzpD+FEj5fLdHQvcQ/XVPsMgR85cLG5H y6kQ== X-Gm-Message-State: AOAM532C1xM4loCkTnUMTnYG1ezEiFyq2/jhGkzDEXRYOzvvS7+HvQ0a aGuGpjyhC1O7f30x2wzAWatujBtuW0I= X-Received: by 2002:a05:622a:1741:: with SMTP id l1mr2076675qtk.458.1642039296985; Wed, 12 Jan 2022 18:01:36 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id y17sm1182232qtj.75.2022.01.12.18.01.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:01:36 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:00:21 -0300 Message-Id: <20220113020026.590-26-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 174/281] xwma: 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: T0dGp+EhtowD From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/xwma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/xwma.c b/libavformat/xwma.c index 37ab3a1ec0..c16ff1be63 100644 --- a/libavformat/xwma.c +++ b/libavformat/xwma.c @@ -85,7 +85,7 @@ static int xwma_read_header(AVFormatContext *s) * 20/48/192kbps are all 20kbps, with the exact same codec data). * Decoder needs correct bitrate to work, so it's normalized here. */ if (st->codecpar->codec_id == AV_CODEC_ID_WMAV2) { - int ch = st->codecpar->channels; + int ch = st->codecpar->ch_layout.nb_channels; int sr = st->codecpar->sample_rate; int br = st->codecpar->bit_rate; @@ -146,9 +146,9 @@ static int xwma_read_header(AVFormatContext *s) } } - if (!st->codecpar->channels) { + if (!av_channel_layout_check(&st->codecpar->ch_layout)) { av_log(s, AV_LOG_WARNING, "Invalid channel count: %d\n", - st->codecpar->channels); + st->codecpar->ch_layout.nb_channels); return AVERROR_INVALIDDATA; } if (!st->codecpar->bits_per_coded_sample) { @@ -236,7 +236,7 @@ static int xwma_read_header(AVFormatContext *s) if (dpds_table && dpds_table_size) { int64_t cur_pos; const uint32_t bytes_per_sample - = (st->codecpar->channels * st->codecpar->bits_per_coded_sample) >> 3; + = (st->codecpar->ch_layout.nb_channels * st->codecpar->bits_per_coded_sample) >> 3; /* Estimate the duration from the total number of output bytes. */ const uint64_t total_decoded_bytes = dpds_table[dpds_table_size - 1]; @@ -244,7 +244,7 @@ static int xwma_read_header(AVFormatContext *s) if (!bytes_per_sample) { av_log(s, AV_LOG_ERROR, "Invalid bits_per_coded_sample %d for %d channels\n", - st->codecpar->bits_per_coded_sample, st->codecpar->channels); + st->codecpar->bits_per_coded_sample, st->codecpar->ch_layout.nb_channels); ret = AVERROR_INVALIDDATA; goto fail; }