From patchwork Thu Jan 13 02:00:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33447 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp35762iog; Wed, 12 Jan 2022 18:30:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxs8qwBfgtpc5ytAXI6IGL3FOVIErEr47sCUJD6UwNgvkIhqQUoOLTsPjUWmX/ECJRuPCUF X-Received: by 2002:a17:907:6d1e:: with SMTP id sa30mr1960047ejc.1.1642041035879; Wed, 12 Jan 2022 18:30:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642041035; cv=none; d=google.com; s=arc-20160816; b=Vs/0vYJHijFvru2Wpb0ihHPeGsiW+9MQRnPmR2sQrI+h+rkGnYWcNRNM5lawbF6+bq rscm+ZpD+s+kw6NQJRZy52ByjXGNFyzxRm2eKCTQMJF0z7wB+3lkb5CYRfForb7JbkXV gjm1g6zk3Vtz06D8DiJsC4qX4fETQ6KYyqR7yVqHP4rdnm6QIsg8DgcrJagn8++2ttTC /wlSor3oezl91FrbgYlrSRCb+LwPlbjlUCaVZWHHK/lB40Oi3907P3hGTzqEDCmK7NZw YRKG7QXCFDijbnCWSL+B0xDhVAU2i0LQZWK3dtSV+VSHZaqP3bEvw7P0MwS3fFQA9a1/ GVbg== 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=L+srbXbSLGxdcLL3K2ioUWpCdmiwXFYiFe4FfJQ7hTo=; b=qbGkh4rizQTFT41Pwixuz0PnfLGkNIfRGZnuOFmhHY60o5it1KjdXoNdN02IvrVk1I 2HEI396/6g+XnvnVIDOFDv2SkqVIFxeW9S+aXQxekrLEvsyYcjpDuEC6Ptn1D2UZNcIa zU/H9MiMwg6bQhq3uYO4PGTCKPZTOR1wFk7uCNefWwTDXgHszhOeXibpyHW3ZTOeDhYl xz9fVgRhBzJUtuEQYSmfdgkGWlHch3066gUvg4PrOegneGytxCQDT8DZFdEKiwlFdRB1 zxuaxyPy+/AGnVLluird3uI/P+9ivtRKiFDeUlYzZZBo/vXli/19WMFnx4SoTymwA3bN KAJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=IcKm6HnK; 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 zh8si708085ejb.751.2022.01.12.18.30.35; Wed, 12 Jan 2022 18:30:35 -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=IcKm6HnK; 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 04B1568B548; Thu, 13 Jan 2022 04:01:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86CBF68B50E for ; Thu, 13 Jan 2022 04:01:36 +0200 (EET) Received: by mail-qt1-f175.google.com with SMTP id f17so5343781qtf.8 for ; Wed, 12 Jan 2022 18:01:36 -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=l7IpLEt3KbNRNJDoJpf8dFPqYCfOK7O+EYqNlEoiarU=; b=IcKm6HnK1z/cpXhuATcZbhRoP43+EiG2QTLYns7dSKvYt0LYxyPh4zhTrYpofU6sLb uwfOJmxWzw98G2vNAtA67B26Owb0RjKuXmElyjWAISYxQoweU4OsDLXKWxkJWb5c2KZJ 0VIhEcVLQOLKwK/nJ/SQrza1vJEeTwUnb0ULjKJQtrIEb/CJzQvEy89Va018QyvhLntT XK1gDLg6Vj3CibWZdW+VQWBcXob7BYKJ8qgbI5Qxf/384Tz3gDHBOAJO12ILETE5MTj4 SIkD8pHO5WsEPBVpM8YCJucKA1Y50+ZyfCoHgpKyNmg/uRdcexQ2A4usLDKv2J8p57Mj 9QvQ== 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=l7IpLEt3KbNRNJDoJpf8dFPqYCfOK7O+EYqNlEoiarU=; b=O/s0SWuIH/4KZ+dDoDz/55Pb1HCF6pjo5Sdo345QxOyn0M7AZ1Iojent34wnJuQFUe 8bP7FKlfz/HQwi3v+Euiiyvqa3kpclx7u02Fo0rQASIp3i568CptXHgNtVa7/L/2GBtq n4ceeHlqGeYPyUnLeWZPJwkSbQ2i8AvkyEIbLIwSJBT2DhwGHqnVOUr8+4GZimbnHYb1 thcvOVpBvcc5jS0/ivZvAqzLFTWD8+Bih89fzzBCPSWiCxGUaX9RGyHSwbBaIAI5GZzQ kMOf53aAv/3jj044TN4VQHek9Jp8sPQeFCIlnaUWTlDYYUeeE/MexkAkJCxywDTRunRP LmKg== X-Gm-Message-State: AOAM5331jUa6iz2lL6czatClnYsGjPDohWusZ3hnHaMkZbc/7vOP7RRq AoUMtCO5Si5d4C2D15zYKpWs+lGyZsw= X-Received: by 2002:a05:622a:342:: with SMTP id r2mr2063479qtw.240.1642039294541; Wed, 12 Jan 2022 18:01:34 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id y17sm1182232qtj.75.2022.01.12.18.01.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 18:01:34 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 23:00:19 -0300 Message-Id: <20220113020026.590-24-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 172/281] xa: 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: wx2qYYUYGyEM From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/xa.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/xa.c b/libavformat/xa.c index 762e90246a..af99c1f327 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -78,16 +78,17 @@ static int xa_read_header(AVFormatContext *s) avio_skip(pb, 4); /* Skip the XA ID */ xa->out_size = avio_rl32(pb); avio_skip(pb, 2); /* Skip the tag */ - st->codecpar->channels = avio_rl16(pb); + st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + st->codecpar->ch_layout.nb_channels = avio_rl16(pb); st->codecpar->sample_rate = avio_rl32(pb); avio_skip(pb, 4); /* Skip average byte rate */ avio_skip(pb, 2); /* Skip block align */ avio_skip(pb, 2); /* Skip bits-per-sample */ - if (!st->codecpar->channels || !st->codecpar->sample_rate) + if (!st->codecpar->ch_layout.nb_channels || !st->codecpar->sample_rate) return AVERROR_INVALIDDATA; - st->codecpar->bit_rate = av_clip(15LL * st->codecpar->channels * 8 * + st->codecpar->bit_rate = av_clip(15LL * st->codecpar->ch_layout.nb_channels * 8 * st->codecpar->sample_rate / 28, 0, INT_MAX); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); @@ -108,7 +109,7 @@ static int xa_read_packet(AVFormatContext *s, if (xa->sent_bytes >= xa->out_size) return AVERROR_EOF; /* 1 byte header and 14 bytes worth of samples * number channels per block */ - packet_size = 15*st->codecpar->channels; + packet_size = 15*st->codecpar->ch_layout.nb_channels; ret = av_get_packet(pb, pkt, packet_size); if(ret < 0)