From patchwork Wed Mar 20 02:12:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 47248 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8ba5:b0:1a3:31a3:7958 with SMTP id m37csp120996pzh; Tue, 19 Mar 2024 19:13:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXxYdr5qt2xlKRGoRoGhEaND8QCw0taeE4SR2wjG6bMZwHY+7LZx9XOzhXiFHaAfyzLZ1FlgobwdeIj4XkgQ7nAuMB1LrrNMFp9mg== X-Google-Smtp-Source: AGHT+IHTDLBcGqdFm/K2Feo09VMp6p4LMsg3CK5vARJWdc3EApZ2qu0q6+jRn9VKnQIMrRDhrKe7 X-Received: by 2002:a17:906:e15:b0:a46:a28d:2f49 with SMTP id l21-20020a1709060e1500b00a46a28d2f49mr841085eji.32.1710900825684; Tue, 19 Mar 2024 19:13:45 -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 dn21-20020a17090794d500b00a4660b6aedfsi6254454ejc.693.2024.03.19.19.13.45; Tue, 19 Mar 2024 19:13:45 -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="e2W/+Y9J"; 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 37C8A68D468; Wed, 20 Mar 2024 04:13:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2036.outbound.protection.outlook.com [40.92.90.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A41B868D387 for ; Wed, 20 Mar 2024 04:13:34 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FU88zEyXZy58mQxycjnkv4WCmi5z7gNUC4av7gOqx1LWndzNbi8zuyXmbO8xZoQabFSJ7qmhYe++lEyMyzOAp2WtB88Ka4OaUUviMkLLC6j0IQIIJRs0jJSUc2qkZojsag2+ljjyzZHtgOPGV5usQq7s+72ca4kMp6o27tOxxjCWJi5v3T1/VPjhuGS3/6J4cHDYG/YeeHJyLX5hucVMLbs6W5rLUcxUUAQiuLduKwewQc0zJlhXKB5QIn3ZzhKyOiog9YFJDSkco0RTJV/l7YgBTmeyEHguPABwgQPuvti65P1CtXC3P8Wfr6mdyrXABYP94qV91sQ7uUSZ8QrKOQ== 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=fOa5eqiX0uIyGbSmUqADh/X/9bP8w4NqtsLg+0+aN6Q=; b=fNQKDIb4BcdvXozr/UIC+iNiNxbvIYspTVpLjR2Uqf/B2lL4wTbswQtpLoH2LD+bR72CuigkLOcBaabUWRTpHJAwR//31dBD5EtzObCdirc6nJgl+nfsgePwzzhl1SMgrwRP+cwLFPE4anSyENSltwayNKyPgRRDItPeAECNFJ9tNZ/JnmUDvn4aKrbVu9Y2WnAHrT7A62/Qy4036yZW9Y3gO8PGi8CU7XOYgdCgndmXhS8YSeawlkt63arGkyyhvA3dr8FutVTlqrnjFJqlAsiudFH2V+4GHQ0FJUwiXQkmQw5TpMQM5vyDB1HSn0DsbBiUR/RZ5wJ+8gXJabHR1g== 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=fOa5eqiX0uIyGbSmUqADh/X/9bP8w4NqtsLg+0+aN6Q=; b=e2W/+Y9JeUX50f1XzyJEhyfQoPkGVNTr5ElG7qkmNYCPBdbqlNb2Bxa1hJyoKHzWVJ3CMJAi2KNI1s6A/99KahClc52MTv+gFJ/fXhax/4Wy9UQcurmIB4bOijkrA/S0oUbXMvcbU9IE2f930zT86N1YMTLQve9VgpsU0OT7oW1ZL3G7kNCZwImLNPaY2s08uDqu3ni/5VUwi9h33DkO8Licfl44O/KmcYbpZpcUMMqDb66qTFeV3x6EHc6p99i4uk07tpif9mJZ31+rlppeU/KGiqu2mQAVu1AFogIyt0vINJLeqscf1I9h21Cl3s7GKcBlvkrMXf8AcAv64ruvBg== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PAXP250MB0543.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:28c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Wed, 20 Mar 2024 02:13:33 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::228d:8c6f:ed10:82eb%7]) with mapi id 15.20.7362.035; Wed, 20 Mar 2024 02:13:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 20 Mar 2024 03:12:48 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [SJGIJQLvqBEnRnb1tVUxpK7i+oc57SBI0OTCNuwYwzg=] X-ClientProxiedBy: ZR0P278CA0062.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::13) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240320021256.107338-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PAXP250MB0543:EE_ X-MS-Office365-Filtering-Correlation-Id: 194b2520-7984-409b-a892-08dc488357d3 X-MS-Exchange-SLBlob-MailProps: Cq7lScuPrnpHlru1h1vRfamsRCbuNA5U3SLUWj9SYuQSXEAdv3H0RMP0koEQqn0lwYMxsiBDfSvMq7oXeDdrFUfcrnmMimZAWGkW4ZFXc9Oab3TKMoNmXKAeMvy/sn9eCb3fpVTQm0t8jmFZ22MleCGu2cgTv3ez8vpVlybOTTG+NkpcneNjHc6lC5/gfZk0LmbIbpEH6+oNfSzmIOWT0v0jbUaiCGiV96zNNhhHbLTdUb1vzHbkvkZy+AcsK+w24c40QYAm/oXQlb09khIDTjxwxBvj4qkMhv1OPgdSfkEYkjjS7WOfCi1HuJw+cJrfLpPjasWqPHAfeGX/x6Eg6Hka4AEFHtWF+uCQXiK/dlyB5xK3y/ZtRh1n00mcd0BH2yGri1c4W60i8CmDBXTRFhg+tr/X+0ynYcAau/+xH7UmIJZxn4icpPPit0FEbcen0qBSxJhbEgT1a5m4T42m8FstlPwMoURN8TpsuNjbAYwXwL4go0PFHIPWmGAQAo6R7tkkiT3rbheDpMCuDWYC+70Ittklmj5/sGMf+DGmZr7FXT4TY4TX0wLOvist8qVawWjO1zYp7jvHn7v+0YLRxPj00dizOOeo52BGk8TUFSF/qFV8GSyKgKYMw4stZQg8BBL7RLMIjixv8YNhK0wbp1NLuD+cX9L+rted0bOSAx2YJFsLfRyPa00R3qGnoChjCTJSAXh6MOuhmfh2ixu1SjisPKESPumoJyNbWW2DSv57uUeG0oPdDkMmzP1Bj7NJrS+YeehVea0= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Lr4TGO98P2eZH76bWQIkN8KOtO7lzxFd7UskaxuUDAymakGzMnn6P8hD0rQJCItLIVC6buhI8HNVHE2JTTKbCdza/nhntaHe/Xwnm3msUj8R3l8jOArsXYP63pBF0o7AmsMAwLQOGSxwt8Hb2PCs8ArYfpd8Ia8MXi1E3AS4PSgEHuK99zSXPnCbFYmh1dtRffu+Rs8TPFb4naN8lKg0lz4HFdiGABauQxer/QOGakjUlMi/s/dj2dKWnXTSC6ure04wsgrjXmnT1xtIhto3PKFAtRIdDBD+YZKEZitZtA0MYsQT8/TTaAcBVr3hvQSh0KQYf3A1i9kojOD0Dh9ZdoC2MPS9ETjGvG7AwObk6tlV2VmyT24P4ux3dWXzEUpHt7GmE1PjhCgpgihXfWajRW/N6ySTb5uKlqxe4tZgmk7gxT2+Fa8riqKuSbL2G80jRcUxsSY4rsxoOCbMcOKv+4MvjK4KkL2Hta1fl/IbqH5yIsVC5+dHn0adVx5VKE8SMcQCmD8mWgPbq4BiCCFd4Ho7yGcK3/KEIV0ULpagCgvsxO7xV67DBP6n+4TmVuTrFUwtqaO7ivdPw2VH/BlYVuqygB2M4/XRFVA5Uem1jemVycaNk6iNb25n43m0l85 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IQdQxOAOiYDJvyvqW73mhTD5KlO7GG3DZV5mwgGRuRU1NOYQLLzrXaR2Zy8JOnmuTr34yygRcCeKaprFQqI8naDCRIYuPjEbxWLJyEXdlWcUhwRGVRC+Us9lqwtWq6IRXrDXJwrIsVqjo2G1E5cKmRKJJLPStFyPf3UGwyq4TTXPd/jKXrkQw8ARhYlAZ+ctartiHeiEutdagR+rtI/UllEORFeaMUb5anUaoJSc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Kw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 194b2520-7984-409b-a892-08dc488357d3 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 02:13:33.2923 (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: PAXP250MB0543 Subject: [FFmpeg-devel] [PATCH 05/13] avformat/amr: Move write_header closer to muxer definition 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: KS5bQNZ/NZED Avoids one #if. Signed-off-by: Andreas Rheinhardt --- libavformat/amr.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index 85815e8675..1b80810302 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -51,23 +51,6 @@ static const uint8_t amrwb_packed_size[16] = { 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 1, 1, 1, 1, 1, 1 }; -#if CONFIG_AMR_MUXER -static int amr_write_header(AVFormatContext *s) -{ - AVIOContext *pb = s->pb; - AVCodecParameters *par = s->streams[0]->codecpar; - - if (par->codec_id == AV_CODEC_ID_AMR_NB) { - avio_write(pb, AMR_header, sizeof(AMR_header)); /* magic number */ - } else if (par->codec_id == AV_CODEC_ID_AMR_WB) { - avio_write(pb, AMRWB_header, sizeof(AMRWB_header)); /* magic number */ - } else { - return -1; - } - return 0; -} -#endif /* CONFIG_AMR_MUXER */ - #if CONFIG_AMR_DEMUXER static int amr_probe(const AVProbeData *p) { @@ -268,6 +251,21 @@ const FFInputFormat ff_amrwb_demuxer = { #endif #if CONFIG_AMR_MUXER +static int amr_write_header(AVFormatContext *s) +{ + AVIOContext *pb = s->pb; + AVCodecParameters *par = s->streams[0]->codecpar; + + if (par->codec_id == AV_CODEC_ID_AMR_NB) { + avio_write(pb, AMR_header, sizeof(AMR_header)); /* magic number */ + } else if (par->codec_id == AV_CODEC_ID_AMR_WB) { + avio_write(pb, AMRWB_header, sizeof(AMRWB_header)); /* magic number */ + } else { + return -1; + } + return 0; +} + const FFOutputFormat ff_amr_muxer = { .p.name = "amr", .p.long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"),