From patchwork Sun Apr 7 20:39:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47893 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:24a8:b0:1a3:b6bb:3029 with SMTP id m40csp2139451pzd; Sun, 7 Apr 2024 13:40:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCiOWM7a3k3/RhB19ZveWce/IFEFg4t7N+9d7xlr5OjMC8N8AxAZXi+0KOvhXqVRcsxqboZirt/wVRE/sKH4JBqIzVfXnKTiCFpg== X-Google-Smtp-Source: AGHT+IHz3KYQAE4ssaufyJ43eF+/wTbucyInj0puiCP9UCgEZabZ+gokI5o0clkWAoc+XXCeXayO X-Received: by 2002:ac2:514c:0:b0:515:d4bc:c643 with SMTP id q12-20020ac2514c000000b00515d4bcc643mr4618281lfd.3.1712522404311; Sun, 07 Apr 2024 13:40:04 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y7-20020a170906470700b00a51b8e92117si1926489ejq.588.2024.04.07.13.40.03; Sun, 07 Apr 2024 13:40:04 -0700 (PDT) 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=@outlook.com header.s=selector1 header.b=nXhMDyAX; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F56068D15F; Sun, 7 Apr 2024 23:39:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2049.outbound.protection.outlook.com [40.92.58.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6F51C68CEEB for ; Sun, 7 Apr 2024 23:39:52 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWt/EZqunnMvedFm0QyU/gmvX0nw8kxdlAstt+miYvhzXs/cTsJ0JSmNfJUkwJWJOxcjHD8qC9TmyLWOmRFTB/HrFZ3o0tOfJGcnc/rKLGeE89JrldfeWiK0iZgTmFuAU/YYcLCx7mBFoRSOuQP4dU72zZDs5ICEdBMiuc+jEFGZiGZNC9K65ZUcqvtKI9MFE/UfLZxGAWKaYB1gdSN+ks+Z0xm8jQ/TDQmlJV62nD/vYUcKSR5ECIvhXNeB/QFw3NhqpdjQJkAL1xoyzZb7W8qAnfwfDJ/CykVcBZdh6tR2dR8r8kpwNZ0TwveYfksT0cp7MGnCRGtBJ20RO/ujug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PybpXk88tFMgBa/A8qfSy67iAGTJOD5fUibouKFzLfk=; b=XeP/3HHjVRe9wnaz5sfmfDom+hfURBCBPn0dEPbgkKfIbqdAi6Swo31fru8QgpT/nwvwKzUR5z0iYaBmsfTsqpoNx+YvpmOC+3SDu89/OijJoqSUsATOEer5yBLdQT+I4OmenT1Ha3526cKjMpbAst1ugeGU03uuOx6aU47ySPusPpKb29l3Nf0hLNd4TJlXCS51QnNVQatRWQEfoAFifCGRvJccbzQh9ua1tUC1IN90BWA/18mcigCzk60RWJ0dKECQcqeyYztnZDFWP+k5CMXd9wgxeEiXSdf7ht3y2s807TzZm3Oie1tfvnMrmxrRqimM18CNnSBtp4GiN7Ta1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PybpXk88tFMgBa/A8qfSy67iAGTJOD5fUibouKFzLfk=; b=nXhMDyAX85W4SBdGug+sLv3/pLQNun/dXLW0riaiAZg3LiymuBVLWMLkDYDS9aSFNlrJ46Lpez92Y+wdaFZzhoftHK8SJfS+wfivknbAe+dLqBPWJu37Ljdoj9NNMnh7W4+6yG2wggdsil5nZ2de/TZGTibvFoaFx+llX/OOH3m9qPx4DrsJvE5KbKGBLuxCNPZcpsfEp2DnBlGNkytx/rnaGYt3XNTkWQ5kFTD46LFMfJGik32SH+3zXAasxd3UfT2HtDzE6HaOc3Rx38CWTgstfoSGikjtVrNjoZUSbXRkOYUV8SQSgyS4f12Fn2EHa8KZd1Nsa9Z2XKWB3OCVnw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0356.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.53; Sun, 7 Apr 2024 20:39:50 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::4a3b:cf76:cddc:c68d%4]) with mapi id 15.20.7409.042; Sun, 7 Apr 2024 20:39:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Apr 2024 22:39:26 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [M1XELcjueu6lpABn6ilz8bCXIAhI4cUkPQ8KJB9xJzU=] X-ClientProxiedBy: ZR0P278CA0189.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240407203942.785799-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0356:EE_ X-MS-Office365-Filtering-Correlation-Id: 607b8016-44c2-45bd-7f65-08dc5742def0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nvKyXubSWmboyaxwxywD06WgBVgI2EFNKTYvFMOtJq3m28iFmUQuzdycqF1i9LCA8dPvQgbIaD+gYaPMvjtEn5FtA76J4mToGQx+Edif1Q59imWsuazGtJ4AR41aBocF8XpzhWp5QctCGRGFmUsh7CRSI2OqaYALKWEzm0V+I7LHFzbZNdmZLEVlhutJVwO9udNB1SXvfnJ+kCQsrOK8jHdzQIA+0PtdQmSs2UXnxz36PbS7tfiR7h6lp1Dra6eGeWwlPi/Mhg1c8bEDK6Sy2TZjOxWBV7WQ5XLMRHiQnTui4/4mebaAEAr1QqoCdICQqol0btn4+XyVXggZhqTRtuB/NhHzvOWQDMYXhKATRYOF4X4X1WkbhvBL4k7SsZLMMJeZzTzbW3rRPVx40yXZFVcJZefZo/wR+sMfH0PNI9n6kucGxiJtni8Irg+h4J1jG+4LGSTiYFpNhWQ0cIOL8uFqQcOm+oWuUjG0m72hx9Huc4EkbtysqkoKasQpRkxlSyxmkmqlkiOtUBy2mLMPE/H22GSeqnofvKglcva6BhkXhf6Ofnx6bQqxEIYGPiaf5REzYqjv6Qo2KOhPieP1OdRnhJYj2283tazU0ejrONVWsMHAX+WhFCIcLw61B2pR X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-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5BqCqtdya27vFqtMJyNn5j+z26sA3mtWKgtQ5nnROwb0m+LDq8EeFPwIfUwnTlVT5osYqLS/gAH1oqqDF+xE0UOkKUCyihTBQuuBTB+A1EoD2wgrwSU6yveaIRSWcCYkxv8yrlGJldix0o+pOqv4rB7AzU5/v8ACxPjlF+IONaIzeTF1kosk14yXgGY6+eIce+K/jCeUGaGP3F8e16O3gA8EFnk+oUWoU0DA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 607b8016-44c2-45bd-7f65-08dc5742def0 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2024 20:39:50.2577 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P250MB0356 Subject: [FFmpeg-devel] [PATCH 01/17] avcodec/ac3enc: Don't presume ch_layout to be AV_CHANNEL_ORDER_NATIVE 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wUzdP/89siA4 It is perfectly legal for users to use a custom layout that is equivalent to a supported native one. In this case the union in AVChannelLayout is not an uint64_t mask, but a pointer to a custom map. Signed-off-by: Andreas Rheinhardt --- libavcodec/ac3enc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 7a6bcf7900..dc197c1517 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -2192,18 +2192,14 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx) static av_cold int set_channel_info(AVCodecContext *avctx) { AC3EncodeContext *s = avctx->priv_data; + uint64_t mask = av_channel_layout_subset(&avctx->ch_layout, ~(uint64_t)0); int channels = avctx->ch_layout.nb_channels; - uint64_t mask = avctx->ch_layout.u.mask; if (channels < 1 || channels > AC3_MAX_CHANNELS) return AVERROR(EINVAL); if (mask > 0x7FF) return AVERROR(EINVAL); - if (!mask) - av_channel_layout_default(&avctx->ch_layout, channels); - mask = avctx->ch_layout.u.mask; - s->lfe_on = !!(mask & AV_CH_LOW_FREQUENCY); s->channels = channels; s->fbw_channels = channels - s->lfe_on;