From patchwork Thu Jan 13 01:57:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 33400 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp28827iog; Wed, 12 Jan 2022 18:18:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBHFtFPhltc1lDEhWo5wGpZ4MgTcp1t90VjOoo+4Y6VIXt1UqT02cTZpxA3HkbMOyaCjmY X-Received: by 2002:a17:907:7f01:: with SMTP id qf1mr1901500ejc.240.1642040291659; Wed, 12 Jan 2022 18:18:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642040291; cv=none; d=google.com; s=arc-20160816; b=jVA6Elef2Po7QbnL6Jaok5ttbkuOpdmIaLF1+N0BtTobW02FUUMwuvYzYjnt1nGWjS NTiUCqBLASl/OvYuI27hgWzpKHkta65hCJp4HNEStDVHnMiosxuGy1NMDDpSLPTT3Eh1 rjHBZWB2vmTSTzlc2ZynXXVszPCsg1kzYdqhzvACBpVPgz1cTpyR+33ceoXngxa8BEu1 wnqXcoMOleshIz1QR2ngJh623tI6jC3B7qGs0IWT7HF8fzv7EUqEwopRthsf9a8OUa3r DqvHKa4z3bEA1eqW2rCTANBuUZNNUpC/dMQV1ME/LTmxp3g1cG4CutRXR/Og8SYoxx5V ZzcQ== 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=SFP2DKiZc4LubN/QOjcjXDqv6haGrEjoOGNopPY3KyA=; b=DEItsThTz9fQuocXUMYJ4+lJGybgsV59RmLEaMTgL3YmR+rEOXRD+FamkEEttFYBNj CjIdnh5Vb7nnOH87/R+/zh2JgXF8aX2DGbsdxnaNz9YNkwW8nN+vAJDhPXjM7NJwXSud Hkxj2Cluh17gdgxxGFjPtzI+algNIWM5RnyRYJUu93OpaElsyvyZgaXSn9XqBlHgOHET XOEWc/3oOnj9bZDqGz0L0X+8u48iHKUNPgUZptNeGNdntniMbhYGNBYvj/dfsT56Fpfd zkEn9dim1wtOnh8lCbFVEVq5U7YT2igHmRr9yYti6v0qODNtpE1UeasdOcx8E8pe5CFi fiJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=c5sNUG36; 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 o17si822114edf.383.2022.01.12.18.18.11; Wed, 12 Jan 2022 18:18:11 -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=c5sNUG36; 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 B116C68B32E; Thu, 13 Jan 2022 03:58:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D81EF68B328 for ; Thu, 13 Jan 2022 03:58:28 +0200 (EET) Received: by mail-qv1-f52.google.com with SMTP id jr5so5063893qvb.11 for ; Wed, 12 Jan 2022 17:58:28 -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=LbwCsCwAxmRaV2Z3bAhaLT15ptg9TOy7Xpo1rNcGbUw=; b=c5sNUG36hfS/BcJZXEDCykU+qK8/7XRds0sBG+k/wJ9hukuVRrI9e/F56Rc5MhSgy8 eo7DyV8w2wE4WF+pFsXcpHfYDoR4l9HnNW4spg0EN7RhKMsKI6h8Iz4PWfGRZpb1NGK7 ouJarMOA7fakdJlBZm4sYmk6Ogf2G9uB0rmwoxvA1kt2agO/uQRzP/riKDhbq4nR2bjO Pcl+6TvYxEx/g/6uWi3fg+oPq1N06rZFtas4xJBKpmQ/bkZ26+AmkW9XJH6r0Ql6PtmV mMqaJwf5hFMD3SDE4JIOxrjICNC60kiw8ShlyJBNKWEsSkUjRn5Z7hrj+kjL7B8H5O36 vqFg== 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=LbwCsCwAxmRaV2Z3bAhaLT15ptg9TOy7Xpo1rNcGbUw=; b=vYQn33zEGkELxDhhhNTjYI1UBwhIssGZ5501mzHuWR7GWP4o+qtPLf8pJDgZ5O+aBp K7HZMQCQHacMYT6U7fjyadAA2hxUMS22spOB185N0Rk6s8V/FxvkBbFEUlsorVCT3Dti 8xZdE/cdItDU7gtr6t4zwVnThqHyB7wgC+aMy0Mh2USvA29NwtdJ7pIobPt0r8LBOy0v rU74J4k+IncaJzjym5Cr7Oi1w3hCZxNxlMsiSDx55FW4cZsM7iuWAY67Uh/aphV63Wct EyQ6tlsu5Vq8T48RPJoqqQ4AWOfYj7SayNg2hAmqr8WmFwhyJoiFEIYk+/O5Pmf26J63 KhHQ== X-Gm-Message-State: AOAM531OTEReTTBqoZ3Q+hJUnxgM23en+q9YJ5c2WpJzlBp4DbMUr5x3 n6VO0Alx8zaWPRUarB5kstkB4R8rziE= X-Received: by 2002:a05:6214:2aa3:: with SMTP id js3mr2175791qvb.36.1642039107271; Wed, 12 Jan 2022 17:58:27 -0800 (PST) Received: from localhost.localdomain ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id u19sm893081qke.1.2022.01.12.17.58.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 17:58:26 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 22:57:37 -0300 Message-Id: <20220113015806.519-2-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 120/281] pcm: 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: N0kIKPZS7ROK From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/pcm.c | 2 +- libavformat/pcmdec.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/pcm.c b/libavformat/pcm.c index e91117ce5a..9741f73667 100644 --- a/libavformat/pcm.c +++ b/libavformat/pcm.c @@ -63,7 +63,7 @@ int ff_pcm_read_seek(AVFormatContext *s, st = s->streams[0]; block_align = st->codecpar->block_align ? st->codecpar->block_align : - (av_get_bits_per_sample(st->codecpar->codec_id) * st->codecpar->channels) >> 3; + (av_get_bits_per_sample(st->codecpar->codec_id) * st->codecpar->ch_layout.nb_channels) >> 3; byte_rate = st->codecpar->bit_rate ? st->codecpar->bit_rate >> 3 : block_align * st->codecpar->sample_rate; diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index 63539a47c0..34e60da1df 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -48,7 +48,8 @@ static int pcm_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; par->sample_rate = s1->sample_rate; - par->channels = s1->channels; + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + par->ch_layout.nb_channels = s1->channels; av_opt_get(s->pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type); if (mime_type && s->iformat->mime_type) { @@ -77,7 +78,7 @@ static int pcm_read_header(AVFormatContext *s) } par->sample_rate = rate; if (channels > 0) - par->channels = channels; + par->ch_layout.nb_channels = channels; if (little_endian) par->codec_id = AV_CODEC_ID_PCM_S16LE; } @@ -88,7 +89,7 @@ static int pcm_read_header(AVFormatContext *s) av_assert0(par->bits_per_coded_sample > 0); - par->block_align = par->bits_per_coded_sample * par->channels / 8; + par->block_align = par->bits_per_coded_sample * par->ch_layout.nb_channels / 8; avpriv_set_pts_info(st, 64, 1, par->sample_rate); return 0;