From patchwork Wed Dec 15 12:29:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32521 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8170346iog; Wed, 15 Dec 2021 04:30:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmsswv58D4flDgqN+EbNCXIvZaMfBXp4CvxbMX2cseHFQM8cz98byAgMr1ML7//NGsJO29 X-Received: by 2002:a17:907:3e14:: with SMTP id hp20mr10022410ejc.576.1639571423917; Wed, 15 Dec 2021 04:30:23 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o21si1116911edw.402.2021.12.15.04.30.22; Wed, 15 Dec 2021 04:30:23 -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=@outlook.com header.s=selector1 header.b=BLzw4BwF; 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 DB11868AF82; Wed, 15 Dec 2021 14:30:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065026.outbound.protection.outlook.com [40.92.65.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 751FF68AF2C for ; Wed, 15 Dec 2021 14:30:11 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vcg8rXjNKO2Kct6lq7Sor/+MTUMxjhoAj723wrjrDUhbzwikO944YJ8o5olI+AXKABKa9O3UB2tcYFQ0+WmEvx/Xtb8bPuSmrUrculIRLmOjK1wplHe8JmlHq6/YYQUko86zRX2fZVnWBDA9bRc9q8U2jiQhZHVFh3YFsJmRV9ZibfEYipke8WzGa+lIytxgECn9E6isRWXr1x+7Wg0NxEhObC/lI+J9rln9ytsEu+9wy1bggSP09cDfOsGzCFhJvOelJNYoE3Op9dVQYMWQK9NLg6Wgy8gVTBiTKg8dulT9OvolKO2nv7n+t+Hxa5A4hM7shNwNA4tBDYDXWzksug== 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=gqlqF89jJQsdq5MrmCPrUZ5Ris3diixY97I6JcoCx9A=; b=oGjbEGxtKnqReVWmIbmd3SLPqMhL7ibQidlNThgMTQXYMPehHzeRBe+cG3vEIB8WnlZi1r8sKggjsOHKbs2gfSTXS7ucFSwv/kyzs0bPOlX8D/8bTBIq4XE7xEmFgpHPWPmqncfbvO/P5rY5p7/jhsBtjdGm+OV7UhgMOOxcFZrbIyHx322BmB4VVOZC2CD8psqLcOBzkY7Yx6Ex10Vl9329RxCCe5+KiPlIdDID3xHIbcXez8O0gNtmoIz5YRJwSdYefPYNEA/vZNCtq85+pqRdfR4hWCHW8WpJx48WNLnmAtP6E/qJr4kcmlYXI+p6Pmy2qgxMx6s3OCxIJgivWg== 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=gqlqF89jJQsdq5MrmCPrUZ5Ris3diixY97I6JcoCx9A=; b=BLzw4BwFzexbbZyk/3BJ1/cVMdwai5I1aB02RiDtkK3cP458M8nT5vcoUpdT0PLWDoHQA+EWmvA0LpqIocEqpuw3EiM0PFmesMljch+7ujGAZq/6OLSWNPH0Mm9xfj/9SzADu8e917LXz/8x3GVvdjooH05EGWqjPPSnX9X5r/87xS6GcvUI1mvv5iqVb/5tNoybtl7Bv7Lu86+31/r/5t7mtDsdEsq8aiBGVfIOgp2yn8E2dEf3W45Pye+CYbbNyg+eO1qTW8iuspUjrLUZyRrnSDlnsMEUpYehgXxmzE2vR3N4xI1aZfszhb+xxvjREmSTrJGUhzQRnEJEkl96Wg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AS8PR03MB6824.eurprd03.prod.outlook.com (2603:10a6:20b:29c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Wed, 15 Dec 2021 12:30:09 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:30:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:29:51 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 X-TMN: [vfyMhmC2nvZI2dhGPKxUMVGEHLjm1FYj] X-ClientProxiedBy: AM6PR10CA0079.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::20) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123002.3708-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ddcb24f6-92af-491d-be59-08d9bfc6a208 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEuBoyQUf2rHPVuupI3Je4ybJWPBU13K7+5XGxgqGzmpkzRMR18VRUUB47Wi/67D51uyIyXGFWB7xjUn040is2QTvFxj+x5VjiGr/r/r9A9hvWQLBEq1UEMQBd/K0jr1OescSLhwXpWAmOf7pJivgehETsWEoIjlxVb42tvPaJkCH3ColG8YWu1HbSTUCoMHxfiHFsGiqxmmGA/5kfrmvbsvUGfH0WzU9VHtDstnEEZnV0I9G5C8F8JZRbLYEvgBEqmWQ2tcI8QQ2FLVpgmN31EbmlvHoyQAB1Wha6K36esyES/M3/nIZcDbUAGbN1GkReHtr4njkuUOBzHFI+q2T3TgFxzsFCg2EFheeCh9qDU+GFVQ9/8qPWVp8cssIOFuw1d9kMy/m78sqCI4OJdGOBtP3ZPtFxo/HikyuG2Uv1ZMgxt29ZRpL1te6m4faEJWqJUHS177G7Iuqz/zX6O/Faa1wp5dKlIpTxzf1iUPIUKqtsJlJXvErlWkWCVIHJZuJmo1aVEXzVSp152zqZtOb5azF/eD0KGEAwlN6E8a6nIL3LhPZ80dZ/TtmtZVx/U11xA8JcENrP4i+mHyehBiYhmcPfN82plLnt3d2T2u+Qa1glgJRideyEnQ01MlWV8+fn82yxUSCQVjrsllVo8+lgMSqWyad2zjvSNO4T6P3IkR4+WlWePY04OHDqGeK9GITxjd3KvEqVmyx00mW/aI3cBkfettqP5D/I7UV/HLA2bPwm2AQT7yW1sCOiS/fpcK4+CwQJ0hf8R3lPtvAZEPpJrW X-MS-TrafficTypeDiagnostic: AS8PR03MB6824:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ozFeGbqZrWrFtOt2FTRw/IQmBTPRK2szWNRksonsTMeecU4rQQqaWbSnTThYO0DUCOQqVXwuZSGzf5EaXFrAWV6+ikElA208CjzvSzO5c93wDIjNmiIHYNl5+Bw7HO3GSCoZaK2WqWjh/fhi+o+5bS0zsH0Z+EC8+Ou6d4XGcc5chDGeLWLZmptHXPwoR287Ni3Yrs+t+zC2HgsnY0OCvqYb3fzPJzZkh2DzqCDvGCj2DnjXBneD2emMl/2z3iS+OROGH+qdSxFkk80dBqKPeBCIIT57qkCZGTFHiWGPaY+IjGrkC2DpI+Q9rRAHKQClTNVLS73NcUVUPd6kOo84xAKgwwYOr3KNqAhXfq8wXB9HUhhiQMg+K1H/WzAVpACOzdMH+EL2QpaUYkZn1dazZ9G8K0YNWCHgfhSN5oE30st9vktZ+fqpUUs7EqXGuLikNmCuMXE9AVXZ6GyPYR/QHJLmn5GphBRRTYk0BzyhRQvqjcY7IaP6tw8qtjrto9WjNbNb3cfICF8J7fN1kVPCWtEOJY501tkyaY8NWGIjZxB2XT+JRpS9D8JBaF/J+4CJUbSU6VmRemBer6DCW0a4vw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RXW8mO9zqNFgMQ4bBHPWt6oBPPIywDq9kJSa8O2NmUvOFdrNtk4LhuowbybFT0t2u/1wzEhS5KeWA96oL/0SP0aBLhRbGAUe2kW/22n2u4qrKX1XuVubiZBR7pJlx7l/2h/B8pTg+dK43ZsEMiZ2Zp2XXOaTmfxF3/HM+IWagoVMgJwvp063iJ2l+99rDE9VVN4RvjG3oMQfRqslYERP9zcMU/AdHGCoaseK6DQspj2pxmhNjPerJd4r7BryXKxUWoD3HKeZPA7I24lpUgwpYC3bmK8ZjZ2KQg5CnETxQIXInZMIxELM7/wTk1xOluKL9X4p6ntzonEM4r6dTmrAhZa172Eb+UxjlEQHxPL82UtQK/B9PEnEYK7oTUyn+CFP0zQ47MxGU14GCdWFs2jQ5WSsuMi56a7WEz9yoAE+VlUjP6E5QYaDyS8VP6QB3zQVAaAWRQGav0UT0UHAjxgYJclEIgfJBGAt7Hm4rj6l9H/ZiPd+3w63V8yAzaAHfdwbr6F89IXf/Ny6/uZLf70bHBpNhmY1ekTEmyNCViUK/cXEhKLj3+yD3mbjKqdQVqhcLNPWoXs1QaqHhLraNkf4GcAi7DqShvwwv+ZhHA1U60FbBaIplboabcLVW+8OvwGOhStYm10F3TUnq1LuwwXJ/31NPIFnqHBN8I/fE3iXieuMefooZtI0vQAWMODynTztZMHnbk9AigZhyGeRb79XBwrdHkJ44VEt+oa40R36yXaznu2aII/rHxi7xAuvm1NnWV8AQeQVW43CFSTmxP9NdcdnYfYLa4Q0VfAP6RArwjFUwPcoCb4XmVj5S+qUb9WuJx7t66XE/SHJl/JCqh4TavA4qQFKiJQQpFf85DfiEBVrXnncbSOacbiOJiP4asfobxyRPYD3/6PGaIeIqcJJ4QP5NZW3bhz3JqzZnEulJO53mzr5YkFbmnLi/D1s9mtZrnTTS2Uw4rloIM6wC6Uqrw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddcb24f6-92af-491d-be59-08d9bfc6a208 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:30:09.7546 (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: AS8PR03MB6824 Subject: [FFmpeg-devel] [PATCH 01/11] avcodec/Makefile: Remove superfluous avformat->DNXHD dependencies 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: d7JTq6aFLzbe There is no mxfenc dependency any more since commit b9a26b9d55f77ebbff3596e46be54bb5fed469d3. Also remove a dnxhddata.h inclusion in mxfenc that was forgotten in the very same commit. Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 2 -- libavformat/mxfenc.c | 1 - 2 files changed, 3 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 4122a9b144..fb90ecea84 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -983,14 +983,12 @@ OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddata.o OBJS-$(CONFIG_FITS_DEMUXER) += fits.o OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o -OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o OBJS-$(CONFIG_SPDIF_MUXER) += dca.o diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index fcd9afda2a..00bbe58149 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -48,7 +48,6 @@ #include "libavutil/pixdesc.h" #include "libavutil/time_internal.h" #include "libavcodec/bytestream.h" -#include "libavcodec/dnxhddata.h" #include "libavcodec/dv_profile.h" #include "libavcodec/h264_ps.h" #include "libavcodec/golomb.h" From patchwork Wed Dec 15 12:35:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32522 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8175506iog; Wed, 15 Dec 2021 04:36:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZINqxhMCjE56Sv3uhQU+SMfExFSgs3jBmmcfzVmcXtBXLBzr/R4wt9KkaCx3hqCdJe3rX X-Received: by 2002:aa7:d6d6:: with SMTP id x22mr1767264edr.132.1639571761242; Wed, 15 Dec 2021 04:36:01 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id he43si1247144ejc.410.2021.12.15.04.36.00; Wed, 15 Dec 2021 04:36:01 -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=@outlook.com header.s=selector1 header.b=VPggQeBz; 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 D657668B0C8; Wed, 15 Dec 2021 14:35:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31CE568AD8B for ; Wed, 15 Dec 2021 14:35:51 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AuHgQ/FvjOOjFem64jVx1VlgSgqwpxEDgtji9aoNE9Oe5mj4a9DV5uQaaT/Rmcca1p/TjsJbnlT7L39GYbMHQ1kU9rI3Eoh9jQszxhmJE1GNmnkZONfQ+ApREpmKuSWKDCWGWpoZJasUWl+bqyazMunCLY9WLF7Ub0UVteOcCneLx3l54PobdmRXm7/t5ESOxrA7GXAmmSnvt7w1psip1ZgAzYtv7EThPRYYM8p/Q4XPXYBuwIKtQh05e+SVVwiXXlfw5Sp8i7VYg4ewSMBU4nICtlkgsR5FMSoJJZyyEjv/GGBexVnKnFV/NHoHkxWyEPLvt82m810kYSW7QEyZPQ== 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=ntn4tpvoPd0Ein5ax2uG/0k9+H3Tcnj3ZyCWpHx6yJU=; b=Mpau0VzqEqPwaVKb2+6dzNr7oABr39veKo//n1EGCZVjiEpPNNbE3Lu4V/YC2pDkarpkEvsJeZ5+y49GawShTnSZFgMwKaazZItzXCMgvKdGK6OgjFRWqb7ncntSenYjS/bJmo6S4ZH/ROEptxkQKyVzdS8dyAJKVuLD2FyzQxvaZi8hZjfWef91GOZrpl4TDRkKMgJFQ9GkO3aaLrpR3lkcnEFAfJCCeb5lM87jRIvVd3/SQuyMo+ZVI9n59dv44Yn3HmscfmLot5HgFovlWiPSJI9erotVVvwvpsvQxTQmsZtsmFLpYmMFz45wZBu/fseIcoo8/gJiuNkw/7fYkQ== 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=ntn4tpvoPd0Ein5ax2uG/0k9+H3Tcnj3ZyCWpHx6yJU=; b=VPggQeBzWGo6Fy0H0GcXVoNowo/zvW50smLEmM7ZDK+k5NNDoOTwH1PORHSsd1AjK5OXZtGnHEf61aLXSVXluiaPC0Ewd3/NeQxEFY2kZr904UETyjXCOeVpGYo7S4cUzlpTkh2otZa4FyzdNeY5FgadTAy2tzMoWEjRsyl6YmCpi2O7eUH+MXUuw/q7RhSBCCRv+WTNwvUfeq0XGctrtS+8lDOmv/GyQVdtucCrF+WzXXNMC9IWxL4kZ6HAfn19A96h37DwGyV6zIrsPoluHbKghZld80rxOM8kOT2HU7NXO3EspOchnNGzEy6LnLfohVixcIS5S/ONWY4vTmaTYQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:49 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:49 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:32 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [F1Pz3irbBJhulPUtcwFsEZtR3+c9nX1d] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b968702-63f9-48d6-ccb2-08d9bfc76cd8 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlVpCLGNRSkIMVmqyDrsLszT+nibWhup8zrMZbRk6nZOcGGAnW08M4EM5OmEulSvJT+CwSUgv3RHbM9Rguw0zBqJsJMvmjGSCGeUKHFcMrLnYmO/S8pFne2BIbO0ze7rXlsHH7RTwTiX4urdQaszJQARzvflH9PB8DMZSRmB/HWB6uacrg4us3l2Q5y2o4eS/SF9MaHsNZmw+58NSY9+dNdfAYt6R8nAhcSmlp/kcJEHf6EJM4meZ9vXR6rRE8Gqo7t6gGi/SuxAcGrrhemqeUnJt5r+eAgdfdCVr6hAEbqadOInFtAZEBtLKRnxEA/JHIiYEPGOiB7FInLjQamBOubEdS/9ZRdfbW19mgQ56NHjcCL/AG0pfLVEkRI36gO9Z6bPPyFpTgxWMgua4sjlu0SOvTIuYvbSuTvMaCWElxUTwLMiDmY7ddyZpYZJSuH0poKQ4FAfDfahpSHYyHAsbZhxFOWAswa98JALhToylGmJg3lo/pgYEHrs8/A/eDMOGkSvVkLcxDH1y/GaOhSz1LqbBUhNqxHhWNtK6aW/UPjMKQewXwdiZdG+aNaYn/PnA0cjiffSYliuJLHLYMVXvG+fthxc9qDx+vZlVTRsDGUrO7m6iLc9AJjZoSFCBIghUrtFZfMcI3bOJszqImlXpAI7tLyv1Pz2jvLw1yLRmDq6EAQ5f8jYSjaVhpVSycAO6AA9+KOloyjfI= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VY8aJWeQDq2SdzevdVCzNhuUvOw0S/iFmhydDYPVnZTWB4eh5dfxoOpR8HKo5t4jr9veAyz1q3Y7NKe0Lk4QjkgJ1R6X9Vxm5JH+erVWOmqaswU8MJGhIBGdy3sM0KMCRMZ6Xch/syEvznvPSyyC4W4iquZZeTT/+HOpONN7i96+hhT9DkLkpd/sJB0RV3xjAB72OtTPHl8II5VKUFAa1l+CcGtawR4VgJ3NnPkXk5Z0NDH2ZOttb5CtCWpHZV0Qm+Lus1ULApmugjst+chQLOeMtLDB0mlbD1Q9E5+5SE2Ns4Y7w1tWwam8Xz5OkRYHzUFevQM1ET8E5NJtmjnQUcS0iS3shzIN2HHnisRwE2Obr0gfMVhKoOrsh+h0nKHDuR9W6s/1p3bbHCMLUBLs7a5xR8lMTlvVMfZKBw2vlrZaVp0zCnaDz5uXMLR6AR5SK52HBEN+ULfHNhxyv1XtYEq3p7eGu/Pxa+t2FN+SiRS45XXt5ZSwP5JSx1fZH0cWT+hD7egNIyqOHZJhV7fdOnJTluCOUbKTgS/SLmF/Z59a604EqCSjgsw671Jguzh+ILRntry57Ve8zCkiA0rikA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Dnz8IZ65FuXfg334fUw4asSO1gk/xZvAEjX39DbwtIr2MVfJ2AP/vHsiSVDso3o5XcYdO5FxyS1EJ669w3gJCMNGIgarojSw5/SP8C1dVuEeaxGYwKtHoAOYW/tP6+vPlk5iGsZ9tHOMuGdMuYLFcmcmTW/M6UQRDXp0egSia5EOesAfJL2fJdAo+DdY+YTPyiPUZLuuIGQKtNDpup3/93+5k7de/aIOVvzoWTubwlQwq2cW3gMkSEF5k5FVvlhHrFWSgsacsrZJhR3Kl03+iCcy2dMIMSuCKXhbFZw702hZok8kBRWFmCDhgGsmFv0Z1t8qey50JKcg8y1prxwGkvGSq/xX8qY1eAb8xNueX0SrBLDvG6V5+ZHykvMQzhcp04rVNlDrsGoEWRaVpfWArXC8p/YdPxPJaoxFVPs0DJDY6+P3vw440X53g13BQH3d79gQhhx4W+C2UkqtPml0uf8reo5osyVTngstGmfMGQsOEMdKZmhuEBEgHyfmXanRr+Fumo1/GZ5jIZoiqMSxyHrHUmsriKGY7Ul6GJRJSAxzsan8MzpsWpOAjpppg7cryM+Jl0lvQjplax/GdIGx2COnacK1sN7wXpnPytWQ5tKsEjQrAi0DG2v3mVYlN0lMHF6pILaR7EH4oVW4QjiLOGVdyRIXqzvXGOkOz5WfLLSqQEjENU796Mz3KXrcWcCqbbjMOVBxog48tcg0PsaOakhDSyH2uAWKpyKoWXryMraNhQrRQFC4cEvJNJTBM9Vjf9Ngs3GbDe/TzMeGOeGXBamVf9ekWtdnQZuXELpae0CQz3t5Tj3WU/CAxY4mCtdz5sd6lHHU76kJZH8MPDO2lTCMM8iZuzuNukVCFaqXJ7DiMF62RtydGSKigLML1v4jn1crzfQmAbUFgXXdSp6vAJxD6NeN3OYVg4/F3HlbI42I8QbNkgaDaVS36PlspKv9xj4FX4SSAfRr67agLSqsgQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b968702-63f9-48d6-ccb2-08d9bfc76cd8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:49.7836 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 02/11] avcodec/raw: Reduce number of avpriv symbols 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: SLcmGoUd4kUl libavcodec currently exports four avpriv symbols that deal with PixelFormatTags: avpriv_get_raw_pix_fmt_tags, avpriv_find_pix_fmt, avpriv_pix_fmt_bps_avi and avpriv_pix_fmt_bps_mov. The latter two are lists of PixelFormatTags, the former returns such a list and the second searches a list for a pixel format that matches a given fourcc; only one of the aforementioned three lists is ever searched. Yet for avpriv_pix_fmt_bps_avi, avpriv_pix_fmt_bps_mov and avpriv_find_pix_fmt the overhead of exporting these functions actually exceeds the size of said objects (at least for ELF; the following numbers are for x64 Ubuntu 20.10): The code size of avpriv_find_pix_fmt is small (GCC 10.2 37B, Clang 11 41B), yet exporting it adds a 20B string for the name alone to the exporting as well as to each importing library; there is more: Four bytes in the exporting libraries .gnu.hash; two bytes each for the exporting as well as each importing libraries .gnu.version; 24B in the exporting as well as each importing libraries .dynsym; 16B+24B for an entry in .plt as well as the accompanying relocation entry in .rela.plt for each importing library. The overhead for the lists is similar: The strings are 23B and the .plt+.rela.plt pair is replaced by 8B+24B for an entry in .got and a relocation entry in .rela.dyn. These lists have a size of 80 resp. 72 bytes. Yet for ff_raw_pix_fmt_tags, exporting it is advantageous compared to duplicating it into libavformat and potentially libavdevice. Therefore this commit replaces all library uses of the four symbols with a single function that is exported for shared builds. It has an enum parameter to choose the desired list besides the parameter for the fourcc. New lists can be supported with new enum values. Unfortunately, avpriv_get_raw_pix_fmt_tags could not be removed, as the fourcc2pixfmt tool uses the table of raw pix fmts. No other user of this function remains. Signed-off-by: Andreas Rheinhardt --- 1. It would make sense to deduplicate avpriv_pix_fmt_bps_(mov|avi) size-wise if it is preferred to keep the lists accessible to users. 2. One could handle the fourcc2pixfmt case in avpriv_pix_fmt_find(), too, if one added another parameter (say count). In this case avpriv_pix_fmt_find() will return the first pixfmt with the desired fourcc if count is zero, the second one is count is 1 etc. (and AV_PIX_FMT_NONE in case there is none any more). This would also make this function more future-proof. libavcodec/raw.c | 40 +++++++++++++++++++++++++++++++++++----- libavcodec/raw.h | 13 +++++++------ libavcodec/rawdec.c | 8 ++++---- libavcodec/utils.c | 11 ----------- libavdevice/dshow.c | 2 +- libavformat/avienc.c | 2 +- libavformat/demux.c | 2 +- libavformat/movenc.c | 2 +- 8 files changed, 50 insertions(+), 30 deletions(-) diff --git a/libavcodec/raw.c b/libavcodec/raw.c index 079d5c5d10..5efc1eb465 100644 --- a/libavcodec/raw.c +++ b/libavcodec/raw.c @@ -28,7 +28,7 @@ #include "raw.h" #include "libavutil/common.h" -const PixelFormatTag ff_raw_pix_fmt_tags[] = { +static const PixelFormatTag raw_pix_fmt_tags[] = { { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, { AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') }, @@ -299,12 +299,12 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = { const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void) { - return ff_raw_pix_fmt_tags; + return raw_pix_fmt_tags; } unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt) { - const PixelFormatTag *tags = ff_raw_pix_fmt_tags; + const PixelFormatTag *tags = raw_pix_fmt_tags; while (tags->pix_fmt >= 0) { if (tags->pix_fmt == fmt) return tags->fourcc; @@ -313,7 +313,7 @@ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt) return 0; } -const PixelFormatTag avpriv_pix_fmt_bps_avi[] = { +static const PixelFormatTag pix_fmt_bps_avi[] = { { AV_PIX_FMT_PAL8, 1 }, { AV_PIX_FMT_PAL8, 2 }, { AV_PIX_FMT_PAL8, 4 }, @@ -326,7 +326,7 @@ const PixelFormatTag avpriv_pix_fmt_bps_avi[] = { { AV_PIX_FMT_NONE, 0 }, }; -const PixelFormatTag avpriv_pix_fmt_bps_mov[] = { +static const PixelFormatTag pix_fmt_bps_mov[] = { { AV_PIX_FMT_PAL8, 1 }, { AV_PIX_FMT_PAL8, 2 }, { AV_PIX_FMT_PAL8, 4 }, @@ -337,3 +337,33 @@ const PixelFormatTag avpriv_pix_fmt_bps_mov[] = { { AV_PIX_FMT_PAL8, 33 }, { AV_PIX_FMT_NONE, 0 }, }; + +static enum AVPixelFormat find_pix_fmt(const PixelFormatTag *tags, + unsigned int fourcc) +{ + while (tags->pix_fmt != AV_PIX_FMT_NONE) { + if (tags->fourcc == fourcc) + return tags->pix_fmt; + tags++; + } + return AV_PIX_FMT_NONE; +} + +enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list, + unsigned fourcc) +{ + const PixelFormatTag *tags; + + switch (list) { + case PIX_FMT_LIST_RAW: + tags = raw_pix_fmt_tags; + break; + case PIX_FMT_LIST_AVI: + tags = pix_fmt_bps_avi; + break; + case PIX_FMT_LIST_MOV: + tags = pix_fmt_bps_mov; + break; + } + return find_pix_fmt(tags, fourcc); +} diff --git a/libavcodec/raw.h b/libavcodec/raw.h index 6a041690b1..9a4ddef8fc 100644 --- a/libavcodec/raw.h +++ b/libavcodec/raw.h @@ -28,20 +28,21 @@ #define AVCODEC_RAW_H #include "libavutil/pixfmt.h" -#include "internal.h" typedef struct PixelFormatTag { enum AVPixelFormat pix_fmt; unsigned int fourcc; } PixelFormatTag; -extern const PixelFormatTag ff_raw_pix_fmt_tags[]; // exposed through avpriv_get_raw_pix_fmt_tags() - const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void); -enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc); +enum PixelFormatTagLists { + PIX_FMT_LIST_RAW, + PIX_FMT_LIST_AVI, + PIX_FMT_LIST_MOV, +}; -extern av_export_avcodec const PixelFormatTag avpriv_pix_fmt_bps_avi[]; -extern av_export_avcodec const PixelFormatTag avpriv_pix_fmt_bps_mov[]; +enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list, + unsigned fourcc); #endif /* AVCODEC_RAW_H */ diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index b22e36e984..9724cce13f 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -76,15 +76,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) if ( avctx->codec_tag == MKTAG('r','a','w',' ') || avctx->codec_tag == MKTAG('N','O','1','6')) - avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov, + avctx->pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_MOV, avctx->bits_per_coded_sample); else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W')) - avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi, + avctx->pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_AVI, avctx->bits_per_coded_sample); else if (avctx->codec_tag && (avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0)) - avctx->pix_fmt = avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag); + avctx->pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_RAW, avctx->codec_tag); else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample) - avctx->pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi, + avctx->pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_AVI, avctx->bits_per_coded_sample); desc = av_pix_fmt_desc_get(avctx->pix_fmt); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a91a54b0dc..4d236ff1cd 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -436,17 +436,6 @@ void ff_color_frame(AVFrame *frame, const int c[4]) } } -enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, - unsigned int fourcc) -{ - while (tags->pix_fmt >= 0) { - if (tags->fourcc == fourcc) - return tags->pix_fmt; - tags++; - } - return AV_PIX_FMT_NONE; -} - int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec){ return !!(codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM); } diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index ef78781865..ec1501ef8e 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -51,7 +51,7 @@ static enum AVPixelFormat dshow_pixfmt(DWORD biCompression, WORD biBitCount) return AV_PIX_FMT_0RGB32; } } - return avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), biCompression); // all others + return avpriv_pix_fmt_find(PIX_FMT_LIST_RAW, biCompression); // all others } static int diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3fbde0be1e..be2493ce55 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -448,7 +448,7 @@ static int avi_write_header(AVFormatContext *s) par->bits_per_coded_sample = 16; avist->pal_offset = avio_tell(pb) + 40; ff_put_bmp_header(pb, par, 0, 0, avi->flipped_raw_rgb); - pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi, + pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_AVI, par->bits_per_coded_sample); if ( !par->codec_tag && par->codec_id == AV_CODEC_ID_RAWVIDEO diff --git a/libavformat/demux.c b/libavformat/demux.c index 745dc8687c..360abd6014 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2795,7 +2795,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (avctx->codec_id == AV_CODEC_ID_RAWVIDEO && !avctx->codec_tag && !avctx->bits_per_coded_sample) { uint32_t tag= avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt); - if (avpriv_find_pix_fmt(avpriv_get_raw_pix_fmt_tags(), tag) == avctx->pix_fmt) + if (avpriv_pix_fmt_find(PIX_FMT_LIST_RAW, tag) == avctx->pix_fmt) avctx->codec_tag= tag; } diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0f912dd012..7216331fa1 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1636,7 +1636,7 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) } } - pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_mov, + pix_fmt = avpriv_pix_fmt_find(PIX_FMT_LIST_MOV, track->par->bits_per_coded_sample); if (tag == MKTAG('r','a','w',' ') && track->par->format != pix_fmt && From patchwork Wed Dec 15 12:35:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32523 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8175651iog; Wed, 15 Dec 2021 04:36:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNQWNtCauU8AZh83s3ZRIv9JDUcKuOzo17JPJtJFwuN2kFK5H7XIxfMFk1Dd+tKcvz5kJ2 X-Received: by 2002:a50:e003:: with SMTP id e3mr14350258edl.374.1639571772835; Wed, 15 Dec 2021 04:36:12 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e16si1057983ejs.1009.2021.12.15.04.36.12; Wed, 15 Dec 2021 04:36:12 -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=@outlook.com header.s=selector1 header.b=TevacaRj; 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 DFD6668B0D3; Wed, 15 Dec 2021 14:36:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5072A68AF33 for ; Wed, 15 Dec 2021 14:35:56 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X86U/Lhwbada2aX4EKVRQWKDmneS0ITtwDahiW+sGYaVBaXdFzlyxLMkIZKiJHA9GcL5l2CZ9SjTp/ZDG4Sv3tAjQGipEMYl1vfR8+70uAen4K6yAF1Vcm3nGiRALmoGXbiRjI+zS0vYXrU0Sqq1O5BDbM5kFVlCd63Y6td6Oy2TmApGtrxY5M2PEPsQhAXE3pofa/O257b4AAY7vo2IOJxBz2CLoGxxc97gk8icqvtmOVb8xzKh2mjYRKpQsvDdFR3Cy5ktw02D/YCW/BrwK0w5cR8PoX5dYBrLAy+Lft0VUd+eiSD4LHcXN1DkTNygV8wcT5aYH/YjA+a1l59IBg== 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=uTb5it9C/FliU2qTkLTKIqe11yZScZqEZIxlte5p2Bg=; b=jX9Y++/M4f0WJ8Jk9V5BLrPw0ZwQcetPbB94wjco4h5/HAgP6AgwET3riBaYr4G9t0tmx8IqjNEtrR25SeB5EzGqPDooOz0PNCwLujVeUoRLF26XiAjeF8SI7weohltxGUJ3wn9m4EgWx7Nw5aLcXO5xE2ayAeVYPzTrD8fsQ0RINxg0OPEtnR3uyhuwFJZ2BzIyK28DEZIO/rbDCZ7biz/fMbYry+YRVOxiA8yDb4e6m0ff3yylm8+EgVJBdre93hC7R1AzW0KK176/EKsGdSdrCTK9W4rDkeuXwwaaB6qh8voUalCdpMUvxNZ0Wff7c3EsQxZyET/pwMA6MvakCA== 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=uTb5it9C/FliU2qTkLTKIqe11yZScZqEZIxlte5p2Bg=; b=TevacaRjhcbLT/953waqENdK6td+he3p7ed46YWjefKYmCg48OchdvSTeOVmpNmY6/PYLq/9Cad5GpAusohjahoACJxbDErf86CkL8TZBYB6C/HoCPdZFzT1UtSHVaTqDZxqreXwwijnll72GOAQF4SfQWQyIec3iRJhVjPIeoxsJv7UzK1mrD9NEz1PIdHSH64ud7uuEllVV7CtxDHnQRmWx3jtWKD3oEUqiMU7APdLSwuWQ2t3b/SY4A+el4IKST32irvDriV2b65x0qqWBbnP9Io4lIvlF2XVg/MAlw7OFEtI7ezfOtlBeQYPjHOMuxq+8Jd+Djr4iuaG/Sxwbg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:51 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:33 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [fuN+z35AIG8exL9Tq47QGYmvU2sJBAvu] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df204b10-de17-4def-0041-08d9bfc76dbe X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JD2vMspIFObwLczIsl/dKTPcnrMVifcHqEuDKiC6kK6lWI8kcvzSq1wOzKXgDCu1h3LdC22RqAPph95D5WS/MWSNxARLiqlN5jlMF/i/L/xwxgGMUS4bdcGEkUCagI7ufOn/bUB134X3MVa/mTyzWzvstGbBxGJGm7VUXaOq9o2ADbnht49dbH0IXpKkeQWDshQ3VvaqVN+OvKEXaywLpH6W+YUD+NIcdzDruyNdDNT4oP4onWYgC+56LX/RVbJK90Vyw7TSvB+zrXQ7gfSn68XVAYLngtAoskUkTN2J9ceu7YaKo7B0S6ht0IGlJwMvdO2EwL5WeUhZbgbOos2nPFg9knRwkWwZiq91a/mx4gY/eZkWTupagmmd61wqXL0aci11DzwdXtlczEvw9zf8sjfeP0Rci0Uo4aklULuhhgUzmD2kqwBeG6TsBztixxa7niKHMqZOQ1Uy70GdbDIx0BFHVYl/upM+rg9U/yndnpPAZQem/jwLIqR5sBDIuus3sojT0a0Voqd7ZyF2B4+txPbIYnPtZ9hgUIfpVSxT9jWpAKYNeJd1HJQIqTLhuVTqGMIuE9GoHs1quv0/lK0ymxp5j3m4VGkCQ+tgEMYSmEy2yp+XeALhNLLv0G3vIk6E+z40mBqWW2PZlx6y6Scbx1qWgFdzp1V65uL58ns5THJg/L7lX34qLFPBOrgiADprRyjRr949cmHGD7nTJGssokaKMcomSEqTDpO0myfC5FLQ= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rKBfhvsqhXby2QiL4zj9EFy1QchEd40IIpxxX0E1MJ66LKQ3StkoAdp4WchnwsYmriKeO1Ck4ciSE+NKtg546FG8W218M3DdIT01dz/YN1FQaFaSadNBI1dWNt/PezONWgERWKT4GfQ+JlLsNYPjQ/a/DFgRSGl2CaRPUr505vxVZD9zudupZsPvBJegDsZrYyGfXQ5j0rAvK4wYXQWAOlxXa6mE6NDsPeS4724xhuvkiM6qV5zKvnwP7IU9S723w1xDgqRPAHlHkrWXEw6YN82aOn6SDLWWhYBy8OkgBVsR8xwIvQixQQ4VmseSdhPZlYb89Q9kRgnpe8gPID7n7T27LgdC8pdy+JwzRxTvunIba3EEulYG0Uw6p92r50waAPjm3Twm6uEOUyEodowbklJURQZg0f23opfTTybIWVdthnixL7C/7ajaQEJBjO2XsFc4woULzerd0GgKuLWJPKDmgKRXhp7V7rC2YWXAEbqn7fWl+ctno/FJzAqKoW6FEMx2PNljKVt0B+sjyBivFENqgX3HAX0ROaVZZGBChzu0IEjX653K/qtecWzQito5YhK8DBHpI8cM1hFfC3GW+A== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zAcki8wy0+V+q8+GpTszOWhHFLJuM7OUf95X9uWO0Ek9WjE1pUSfR8+JCiPeBe/+4FI8d3LLm6DX936Ajq/5NjaOJJT4Q8Z8BibcH607yhK9so84v7u5mYmV6M0kU02c0GL22PtX6Y3GPJnRZpte2D/gH4Jv8yziXXda2ZScsVzqsBsAtwh3cp6M7ziBk/Kt4loO5xtnMpU0XQMYrx6Nh2/Zza68tGfk8sWuJKaLDoNCAy08m6GIsZKOSUI0p/pXrANA77umorK2fasSLLpscMrfLClNONZZNuNGenAdj6VmV4b+1SDjAfDW5pfRAuub4KrIIXEEBsmrVMNw598dd+taL+QMhBwb9vXOkmiW5YT0T6iHSOkFJdJYAeTKRpeu4aV0hEJW0ZZnfTqajuXyK53xHdglldEKR1XujFLrpQxv6qTs+Zy0Z+s+bT1jRD/183Ca9RWEaSIMkf/g/fQUsH73Hnrw3g0xnnV2LNtWaIOBLUDg46px0h93Kus8+gLK2zaHeSBVZHWQ6MjVonCgGeb8FFdwn3RjJQhN41U4p4ywMyu97effDEAQM/c4+2ZrvxScWig1NeDl9QfZsxg9XEu8SfxMjDnaMdTiSj7+15x0ctaM53F5s5FypeWJkhs4G/f/FPb/VbbrgybtZGsk5ajA5dx/kJAqQMAtMdvDhGDMTk0vBF3tjPEen2vWxr05JeBdmoH1sykVWSnouM2AnR+T1BtckBghMKdiGtfzeYWCThPQ8I+Xv08wMH8+T8vGk0Rmr+UXA/n9jOnlOgYL2bKp4kMkejiX2GgdrMl1yDCC2nUt8rMlD4a+euyIyoRVjZ4UDTIZPvWHrEmeQ4f63KeLZ4QvnBKkynmbo6j/qyPHGWYjjJBNraUWc62ckdzZTbFYRvJpX2x1RKTxiZWj9ry5O2sFLEWMw9/L9e9fYyHeXpLuF7aggxwa4x1jsSBq34eZel+5yOhe0kvRbkIN/w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: df204b10-de17-4def-0041-08d9bfc76dbe X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:51.2857 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 03/11] Makefile: Redo duplicating object files in shared builds 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: juH8XBb4WHiU In case of shared builds, some object files containing tables are currently duplicated into other libraries: log2_tab.c, golomb.c, reverse.c. The check for whether this is duplicated is simply whether CONFIG_SHARED is true. Yet this is crude: E.g. libavdevice includes reverse.c for shared builds, but only needs it for the decklink input device, which given that decklink is not enabled by default will be unused in most libavdevice.so. This commit changes this by making it more explicit about what to duplicate from other libraries. To do this, two new Makefile variables were added: SHLIBOBJS and STLIBOBJS. SHLIBOBJS contains the objects that are duplicated from other libraries in case of shared builds; STLIBOBJS contains stuff that a library has to provide for other libraries in case of static builds. These new variables provide a way to enable/disable with a finer granularity than just whether shared builds are enabled or not. E.g. lavd's Makefile now contains: SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o Another example is provided by the golomb tables. These are provided by lavc for static builds, even if one uses a build configuration that makes only lavf use them. Therefore lavc's Makefile contains STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o, whereas lavf's Makefile has a corresponding SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o. E.g. in case the MXF muxer is the only component needing these tables only libavformat.so will contain them for shared builds; currently libavcodec.so does so, too. (There is currently a CONFIG_EXTRA group for golomb. But actually one would need two groups (golomb_avcodec and golomb_avformat) in order to know when and where to include these tables. Therefore this commit uses a Makefile-based approach for this and stops using these groups for the users in libavformat.) Signed-off-by: Andreas Rheinhardt --- Makefile | 2 +- configure | 4 ++-- ffbuild/common.mak | 10 ++++++++-- ffbuild/library.mak | 22 +++++++++++++++++++--- libavcodec/Makefile | 10 ++++++++-- libavdevice/Makefile | 4 +++- libavfilter/Makefile | 5 +++-- libavformat/Makefile | 6 +++++- libswresample/Makefile | 4 +++- libswscale/Makefile | 3 ++- 10 files changed, 54 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 26c9107237..fd6a7f0230 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ SUBDIR_VARS := CLEANFILES FFLIBS HOSTPROGS TESTPROGS TOOLS \ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ ALTIVEC-OBJS VSX-OBJS MMX-OBJS X86ASM-OBJS \ MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSP-OBJS MSA-OBJS \ - MMI-OBJS OBJS SLIBOBJS HOSTOBJS TESTOBJS + MMI-OBJS OBJS SLIBOBJS SHLIBOBJS STLIBOBJS HOSTOBJS TESTOBJS define RESET $(1) := diff --git a/configure b/configure index a7593ec2db..ab1b9f6b66 100755 --- a/configure +++ b/configure @@ -3419,7 +3419,7 @@ mp4_muxer_select="mov_muxer" mpegts_demuxer_select="iso_media" mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf hevc_mp4toannexb_bsf" mpegtsraw_demuxer_select="mpegts_demuxer" -mxf_muxer_select="golomb pcm_rechunk_bsf" +mxf_muxer_select="pcm_rechunk_bsf" mxf_d10_muxer_select="mxf_muxer" mxf_opatom_muxer_select="mxf_muxer" nut_muxer_select="riffenc" @@ -3432,7 +3432,7 @@ ogv_muxer_select="ogg_muxer" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" -rtp_muxer_select="golomb jpegtables" +rtp_muxer_select="jpegtables" rtp_mpegts_muxer_select="mpegts_muxer rtp_muxer" rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp" rtsp_demuxer_select="http_protocol rtpdec" diff --git a/ffbuild/common.mak b/ffbuild/common.mak index 268ae61154..616d39ddba 100644 --- a/ffbuild/common.mak +++ b/ffbuild/common.mak @@ -140,6 +140,8 @@ include $(SRC_PATH)/ffbuild/arch.mak OBJS += $(OBJS-yes) SLIBOBJS += $(SLIBOBJS-yes) +SHLIBOBJS += $(SHLIBOBJS-yes) +STLIBOBJS += $(STLIBOBJS-yes) FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) @@ -148,6 +150,8 @@ FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%= OBJS := $(sort $(OBJS:%=$(SUBDIR)%)) SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%)) +SHLIBOBJS := $(sort $(SHLIBOBJS:%=$(SUBDIR)%)) +STLIBOBJS := $(sort $(STLIBOBJS:%=$(SUBDIR)%)) TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o) TESTPROGS := $(TESTPROGS:%=$(SUBDIR)tests/%$(EXESUF)) HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o) @@ -183,10 +187,12 @@ $(OBJS): | $(sort $(dir $(OBJS))) $(HOBJS): | $(sort $(dir $(HOBJS))) $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS))) $(SLIBOBJS): | $(sort $(dir $(SLIBOBJS))) +$(SHLIBOBJS): | $(sort $(dir $(SHLIBOBJS))) +$(STLIBOBJS): | $(sort $(dir $(STLIBOBJS))) $(TESTOBJS): | $(sort $(dir $(TESTOBJS))) $(TOOLOBJS): | tools -OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) +OUTDIRS := $(OUTDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(SHLIBOBJS) $(STLIBOBJS) $(TESTOBJS)) CLEANSUFFIXES = *.d *.gcda *.gcno *.h.c *.ho *.map *.o *.pc *.ptx *.ptx.gz *.ptx.c *.ver *.version *$(DEFAULT_X86ASMD).asm *~ *.ilk *.pdb LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a @@ -198,4 +204,4 @@ endef $(eval $(RULES)) --include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d) +-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SHLIBOBJS:.o=.d) $(STLIBOBJS:.o=.d) $(SLIBOBJS:.o=.d)) $(OBJS:.o=$(DEFAULT_X86ASMD).d) diff --git a/ffbuild/library.mak b/ffbuild/library.mak index 612bacb980..ad09f20da9 100644 --- a/ffbuild/library.mak +++ b/ffbuild/library.mak @@ -14,10 +14,26 @@ INSTHEADERS := $(INSTHEADERS) $(HEADERS:%=$(SUBDIR)%) all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME) $(SUBDIR)lib$(FULLNAME).pc all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) $(SUBDIR)lib$(FULLNAME).pc -LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS) +LIBOBJS := $(OBJS) $(SHLIBOBJS) $(STLIBOBJS) $(SUBDIR)%.h.o $(TESTOBJS) $(LIBOBJS) $(LIBOBJS:.o=.s) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H -$(SUBDIR)$(LIBNAME): $(OBJS) +ifdef CONFIG_SHARED +# In case both shared libs and static libs are enabled, it can happen +# that a user might want to link e.g. libavformat statically, but +# libavcodec and the other libs dynamically. In this case +# libavformat won't be able to access libavcodec's internal symbols, +# so that they have to be duplicated into the archive just like +# for purely shared builds. +# Test programs are always statically linked against their library +# to be able to access their library's internals, even with shared builds. +# Yet linking against dependend libraries still uses dynamic linking. +# This means that we are in the scenario described above. +# In case only static libs are used, the linker will only use +# one of these copies; this depends on the duplicated object files +# containing exactly the same symbols. +OBJS += $(SHLIBOBJS) +endif +$(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS) $(RM) $@ $(AR) $(ARFLAGS) $(AR_O) $^ $(RANLIB) $@ @@ -48,7 +64,7 @@ $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS) $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) -$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver +$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SHLIBOBJS) $(SLIBOBJS) $(SUBDIR)lib$(NAME).ver $(SLIB_CREATE_DEF_CMD) $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDSOFLAGS) $$(LD_O) $$(filter %.o,$$^) $(FFEXTRALIBS) $(SLIB_EXTRA_CMD) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index fb90ecea84..d855f5a229 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -139,7 +139,6 @@ OBJS-$(CONFIG_QSVENC) += qsvenc.o OBJS-$(CONFIG_RANGECODER) += rangecoder.o OBJS-$(CONFIG_RDFT) += rdft.o OBJS-$(CONFIG_RV34DSP) += rv34dsp.o -OBJS-$(CONFIG_SHARED) += log2_tab.o reverse.o OBJS-$(CONFIG_SINEWIN) += sinewin.o OBJS-$(CONFIG_SNAPPY) += snappy.o OBJS-$(CONFIG_STARTCODE) += startcode.o @@ -979,7 +978,10 @@ OBJS-$(CONFIG_VP9_VDPAU_HWACCEL) += vdpau_vp9.o OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) += videotoolbox_vp9.o OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o -# libavformat dependencies +# Objects duplicated from other libraries for shared builds +SHLIBOBJS += log2_tab.o reverse.o + +# General libavformat dependencies OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o @@ -995,6 +997,10 @@ OBJS-$(CONFIG_SPDIF_MUXER) += dca.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o +# libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o + # libavfilter dependencies OBJS-$(CONFIG_ELBG_FILTER) += elbg.o diff --git a/libavdevice/Makefile b/libavdevice/Makefile index 0dfe47a1f4..53efda0514 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -9,7 +9,6 @@ OBJS = alldevices.o \ utils.o \ OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o -OBJS-$(CONFIG_SHARED) += reverse.o # input/output devices OBJS-$(CONFIG_ALSA_INDEV) += alsa_dec.o alsa.o timefilter.o @@ -54,6 +53,9 @@ OBJS-$(CONFIG_XV_OUTDEV) += xv.o OBJS-$(CONFIG_LIBCDIO_INDEV) += libcdio.o OBJS-$(CONFIG_LIBDC1394_INDEV) += libdc1394.o +# Objects duplicated from other libraries for shared builds +SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o + # Windows resource file SLIBOBJS-$(HAVE_GNU_WINDRES) += avdeviceres.o diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 2fe495df28..f4f077af46 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -572,13 +572,14 @@ OBJS-$(CONFIG_SPECTRUMSYNTH_FILTER) += vaf_spectrumsynth.o OBJS-$(CONFIG_AMOVIE_FILTER) += src_movie.o OBJS-$(CONFIG_MOVIE_FILTER) += src_movie.o +# Objects duplicated from other libraries for shared builds +SHLIBOBJS += log2_tab.o + # Windows resource file SLIBOBJS-$(HAVE_GNU_WINDRES) += avfilterres.o SKIPHEADERS-$(CONFIG_LIBVIDSTAB) += vidstabutils.h -OBJS-$(CONFIG_SHARED) += log2_tab.o - SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_vpp.h diff --git a/libavformat/Makefile b/libavformat/Makefile index 2b5caf9d33..2b5bb43745 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -61,7 +61,6 @@ OBJS-$(CONFIG_RTPDEC) += rdt.o \ rtpdec_vp9.o \ rtpdec_xiph.o OBJS-$(CONFIG_RTPENC_CHAIN) += rtpenc_chain.o rtp.o -OBJS-$(CONFIG_SHARED) += log2_tab.o golomb_tab.o OBJS-$(CONFIG_SRTP) += srtp.o # muxers/demuxers @@ -677,6 +676,11 @@ OBJS-$(CONFIG_LIBSRT_PROTOCOL) += libsrt.o OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o +# Objects duplicated from other libraries for shared builds +SHLIBOBJS += log2_tab.o +SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o +SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o + # libavdevice dependencies OBJS-$(CONFIG_IEC61883_INDEV) += dv.o diff --git a/libswresample/Makefile b/libswresample/Makefile index 42666e4dd2..f528427f55 100644 --- a/libswresample/Makefile +++ b/libswresample/Makefile @@ -15,7 +15,9 @@ OBJS = audioconvert.o \ swresample_frame.o \ OBJS-$(CONFIG_LIBSOXR) += soxr_resample.o -OBJS-$(CONFIG_SHARED) += log2_tab.o + +# Objects duplicated from other libraries for shared builds +SHLIBOBJS += log2_tab.o # Windows resource file SLIBOBJS-$(HAVE_GNU_WINDRES) += swresampleres.o diff --git a/libswscale/Makefile b/libswscale/Makefile index 4b8f9de425..a0ec71e06f 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -19,7 +19,8 @@ OBJS = alphablend.o \ yuv2rgb.o \ vscale.o \ -OBJS-$(CONFIG_SHARED) += log2_tab.o +# Objects duplicated from other libraries for shared builds +SHLIBOBJS += log2_tab.o # Windows resource file SLIBOBJS-$(HAVE_GNU_WINDRES) += swscaleres.o From patchwork Wed Dec 15 12:35:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32524 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8175804iog; Wed, 15 Dec 2021 04:36:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIYFOgY8eIACLnCAPQyvdpJKVMjkIkYP1t73Z4/uBHHaOkzIMfAjGRYcMJ36M/gOcW0DmL X-Received: by 2002:a17:907:3e9d:: with SMTP id hs29mr10605695ejc.677.1639571784670; Wed, 15 Dec 2021 04:36:24 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d13si1027232ejp.33.2021.12.15.04.36.24; Wed, 15 Dec 2021 04:36:24 -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=@outlook.com header.s=selector1 header.b=f3yALzgf; 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 E8CC968B0DF; Wed, 15 Dec 2021 14:36:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 68F6568AF5B for ; Wed, 15 Dec 2021 14:36:01 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OKrkbSArEDUE32KDg04DxXMxAIUwg26ysrKb7SUsX6f6KWrimfRxVCoZk3agUmlEIAg2EfWAAMKGCHSkpBmVU20n/C9xUZTs2KGOwH0rWqxMGi5Z+DWJmfOURMhqLPCz+/YnvYxlyxNgzhwSy4o3ugNcI6OBtajy/H9mXPvH45aOUxT0BQMwsfoXr1Fe/EG9RW3C9H54fW8MnVKErNX3j4Bx+EFGbTHsec9xHKIFevMiHAOnxGInYAhi2MH37flRfMeDz7QuFyxlxlWeEqj/tJeqehSYv4zm1Q+XF6z+SUMJ1YkmXeCQ0d2MTBCM0i99UOaD/6oq7B59zK1fBf2hEQ== 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=4DRGo8OuitV1ql3SnFS7amSZt40ndzi25Dhh7XVSsCg=; b=Nht9G4ncv9UigI3mRwTJy2E+e65oZ9LZRC5gN42ENbR7Eoho2c+7KZh4w1tLqOeqRAEZkzFafU8NqB1YH+wi7mf1yBY39NC1qjoeHM/twojCZMuWFHn88Gt5yPHApCVW4fDfcpoqmYYY1FqhQuKuyRKgY2uoPwqMMx6zkJ9zN17mGgg/qmiYs/fPYPmAXtLf1yVY04kfon6OGzwWqRrG3nACT4LVLZl1IASusxUBZB13b0C4DM/lmv7xDfb0x5lRqB7LtSfTGJNLBQgsP0AdcTXBeU4nQlr2PQgOQJSGIp78eHIvgBVGiTpM+cO1pt7qleehGE3h6MFyoo4S0HyfhA== 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=4DRGo8OuitV1ql3SnFS7amSZt40ndzi25Dhh7XVSsCg=; b=f3yALzgfi8kJ/BwVC0SZFpeTMJ9Q/6E4MW3+Ig66VJGDtf6YM0iT783N5b7xoKU3Cwaj9VYEf7rYK8JgTj7A2zKHdjmowg7UoYTFsnn9is0mdiDnL66Fg0PLluW81CAykbyqEMG79vUODOrt7Ad0nd3r9JqjpgkdAF3nFSkVZvC/6NeGAESVVX3w9j6EcMhpLueWeVmXQ6Ggs1N1mu4ZoFf1WTSLgFTB6iUMS3EggoS3A1aEtCWThhNdsKSEqw9hldFIgYlutfu4twDmp2kk//cnpcV+BzLPoFnL5SswAqnvf9clHYWhj5v8PgDEEdsWyAghLHoWIX03FoDp5Z5Vgw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:53 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:34 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [8O/v0E1rwCF6qJdqJDQoxwzGTyaqs154] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43cbbe52-d352-4d27-7ecf-08d9bfc76eb8 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlcBlK86j0plhg1pHd9PbfoAMHR5t6cyWrYS6bEX9vAcxHSvRvdkh8YMx7+6Q7ddUs5lG0awThPOhxxFEHKoWjMHrBAJxxI8+jTX9o5lt/0C23T9Cpx5Gssx8VbkJFp9amVShFObl8FvvfiF3NZKQhe85aowyhHG3AScCKpwVNvHNtjRTN7DVXAJXtX2E+WKDrBqFJ8Xtti2osbQ87FDPl24ZVeBIaKHU+XonrBl83SfEFZSRpFTyKuj6RQ5LMCsNxdALuHCxlY6trR5r+3mM1jl1Iuat9TU4jitwqJ+ILRo0xmbk7PHHqL4RKgnCDZFKD58QMlzDyMTvAppvts+mhlvSBAF6Pe+VvTvK/xOcqt2JKpED/O23c5KxVdO3YvduhtfUZB3sSCtVn82IuqcsIThwju1jvkK0fBnIfpYj62fIULqY8zUDmj52wsfg1WhcOLBahTn7ZethoaejFqYe112ij+LVbm3hKxPpoSWQ4yR1UbwPog3ILWMqNSSBgY72Q+bMBXi2cBW2uZyCv4DbQ8mH3Q/8AEb+K6ULcA2L8hVy8l1z8Pl0IwuizWOe90n1UswXD/pbdcSrnKnbj3Ad31JqopQ0ghLZ48+JV0b3K86x1DXSmEIjoZbIaij5twFy1DEhQkOUazmMwJL5LxYb7DgBH/3xBJ+7Y8ELIT812RbOceeksv+hJ5pj8RbiKaaOcJl0moGq6mXE= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w8h9n+5iOHjrF1v+rE5ksZ33goaJchmurfszXND1XZW0h83Mtg6h5kqFOcdpf0lOqWCuCwsD7Vd3YB/G+EuGWjOiBhhSOO+k3nWL9BPR6n044efFepuldKdISDax4tG/8oPi8rpNwh5S4GGuLBleLev8BAK3HMXqEqWRpo2a5V6XuqAmxiGFsVDespIQCEw+E+UHZvLxfPACIZMGBIniM4p/wDywt9H7z1JYtP3LbxjYtQgbpM1PAGXI5bww85ALeIot6y6bo9q4xUeXtcOZ7XDL4pJ7hOFqyEzfSWZvbDwPHM+Ek6euoC1YG/3dvkF0Fvyg7ddQuBxoVaEMR2hQ3hu//hhj6Akq4USQ45msfGEurmG2h7MT3+2VtbWMs7LUbjygy1+U9bwZArGsklK4g7QlUMOwh+F7dqpb9u597F97f96eFCCaJ/51O0ZJVOJ3fr29vjEeATLo4p/HyGjzhfC9BbODATzcJIMnxNvZhNA3UFdfOoUiclkJ43VDzWEgek5K/22yFdbiVWHXwzVGlM636VeVZT3kmUNNIVtyy2+OjaLXRjBYkGUUXakugbL8Ym0x76fK87ADHj7hZidsm4Gt1VBxY6N15B7Yj/FDRiIwMQ75WutsjeDF9+fb1/wU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pi54zsv8Hel/Lw6/gMILQXrd0+hnDbx1NL5h4Gld5kRsutMDAtSINJhP5kYVET2uLkcv2s3oiwqVMWlyFNbUf2xAmq6+dOX9BM4UTb0KElh7Ozsa36CEWbdf51GarJXFaFR4qIbvEIFobkJr1Z8gxPpIFBM9jt5Y4VVBZj1hMCYzODZMEwfRY10niXXem+u9fpJepDPwZ3OtQuGvZ9o0svC3+D+kDDD/YE0+Ii5maP/4JsciXuF1Sei0ryu7H96GUB78C3QBRnlZ25utfn8ZMVgHHtEL4XRP9pfK5wbJV9qy3lvWgSOQ3PV+YrnZxKfCQ1K0VScvm9YaN5l9CR3rw0iYFIE5DuvjirTjlhOrFY+svvQkO29jZaQFqUhOvCPjecfaznvHsXtOrW4G5OEeLMpiFctbsEzG7SA2tu4ahyJdQbNmne5t2gOqQw7mrw6n7/iqyBQeSYCZA3/J4hIk7DbnXhs5bw7FXdIdQuJXElZIGNMkiitzK6GvdJmqQpMykkUTXF7nBG4b8rGUX2+o714jvGilgYTsCqXdczQ1JxWq2w0EJSLxwkgG0/+ouH2wRlhobIJNuldgx/ngK99CvWO3ufDt1+82hoZY3HHD8t5vVDSd3uT21Wkqc7pBIWq7hlzdCRYvYfUGUhcU7eyj8daylynnO/XTmJFYULPPGcIwHPQ0d9alUFw19X94qqoS2ONyzY+cgHZXXIqZUbk0Y7MvjI+qHPwxhYMpvt21Nx3VzBdZOUlxuPIkhsDWMkvM0bsvlsSO1w/PtXT7lVq2yYGW9sps7C02MND9bSeNTyPweckWBfLJzA5R2RmCpg7OFsT9uslQofSGuIoCgTqvMx/+nto5i4RdBaGibiluRC+UEnKkK+kgrCUGDEg69wqE1uvYufpAqloBr1T8/Iq5ftPzHEECCiXen7bWqZm42Z7kuu5Vjb/xh005q8mODtz4aXGu7gzBEQ3h8uMfS4FY2w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43cbbe52-d352-4d27-7ecf-08d9bfc76eb8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:52.9273 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 04/11] avcodec/ac3tab: Unavpriv ac3_channel_layout_tab 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: 91cAjK/GG38W It is small (16 B) and therefore the overhead of exporting it more than outweighs the size savings from not having duplicated symbols: When the symbol is no longer avpriv, one saves twice the size of the string containing the symbols name (2x30 byte), two entries in .dynsym (24 bytes each on x64), one entry in the importing libraries .got and .rela.dyn (8 + 24 bytes on x64) and two entries for the symbol version (2 bytes each) and one hash value in the exporting library (4 bytes). (The exact numbers are of course different for other platforms (e.g. when using dlls), but given that the strings saved alone more than outweigh the array size it can be presumed that this is beneficial for all platforms.) Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 12 +++++--- libavcodec/ac3_channel_layout_tab.c | 22 +++++++++++++++ libavcodec/ac3_channel_layout_tab.h | 41 ++++++++++++++++++++++++++++ libavcodec/ac3_parser.c | 2 +- libavcodec/ac3dec.c | 4 +-- libavcodec/ac3enc.h | 1 + libavcodec/ac3tab.c | 14 ---------- libavcodec/ac3tab.h | 4 +-- libavcodec/eac3_data.c | 2 ++ libavformat/Makefile | 2 ++ libavformat/ac3_channel_layout_tab.c | 22 +++++++++++++++ libavformat/hls_sample_encryption.c | 4 ++- libavformat/mov.c | 4 +-- 13 files changed, 107 insertions(+), 27 deletions(-) create mode 100644 libavcodec/ac3_channel_layout_tab.c create mode 100644 libavcodec/ac3_channel_layout_tab.h create mode 100644 libavformat/ac3_channel_layout_tab.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index d855f5a229..36a1a1a4de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -174,8 +174,10 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \ psymodel.o mpeg4audio.o kbdwin.o OBJS-$(CONFIG_AAC_MF_ENCODER) += mfenc.o mf_utils.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o -OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o -OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o kbdwin.o ac3tab.o +OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \ + kbdwin.o ac3tab.o ac3_channel_layout_tab.o +OBJS-$(CONFIG_AC3_FIXED_DECODER) += ac3dec_fixed.o ac3dec_data.o ac3.o \ + kbdwin.o ac3tab.o ac3_channel_layout_tab.o OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \ ac3.o kbdwin.o OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3enc.o ac3tab.o ac3.o kbdwin.o @@ -989,7 +991,6 @@ OBJS-$(CONFIG_FITS_DEMUXER) += fits.o OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_MOV_DEMUXER) += ac3tab.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o @@ -998,6 +999,8 @@ OBJS-$(CONFIG_TAK_DEMUXER) += tak.o OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o +STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o @@ -1084,7 +1087,8 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ mpeg4audio.o -OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o +OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \ + ac3_channel_layout_tab.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o diff --git a/libavcodec/ac3_channel_layout_tab.c b/libavcodec/ac3_channel_layout_tab.c new file mode 100644 index 0000000000..4fed46b6e7 --- /dev/null +++ b/libavcodec/ac3_channel_layout_tab.c @@ -0,0 +1,22 @@ +/* + * AC-3 channel layout table + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "ac3_channel_layout_tab.h" diff --git a/libavcodec/ac3_channel_layout_tab.h b/libavcodec/ac3_channel_layout_tab.h new file mode 100644 index 0000000000..46fa9ecdfe --- /dev/null +++ b/libavcodec/ac3_channel_layout_tab.h @@ -0,0 +1,41 @@ +/* + * AC-3 channel layout table + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AC3_CHANNEL_LAYOUT_TAB_H +#define AVCODEC_AC3_CHANNEL_LAYOUT_TAB_H + +#include +#include "libavutil/channel_layout.h" + +/** + * Map audio coding mode (acmod) to channel layout mask. + */ +const uint16_t ff_ac3_channel_layout_tab[8] = { + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_2_1, + AV_CH_LAYOUT_4POINT0, + AV_CH_LAYOUT_2_2, + AV_CH_LAYOUT_5POINT0 +}; +#endif diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c index 9ed6ede5c3..f3c7d27d59 100644 --- a/libavcodec/ac3_parser.c +++ b/libavcodec/ac3_parser.c @@ -141,7 +141,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) (hdr->num_blocks * 256); hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; } - hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode]; + hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode]; if (hdr->lfe_on) hdr->channel_layout |= AV_CH_LOW_FREQUENCY; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index c7deb56e1c..ae00373dcb 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1616,7 +1616,7 @@ dependent_frame: return AVERROR_INVALIDDATA; } avctx->channels = s->out_channels; - avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON]; + avctx->channel_layout = ff_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON]; if (s->output_mode & AC3_OUTPUT_LFEON) avctx->channel_layout |= AV_CH_LOW_FREQUENCY; @@ -1700,7 +1700,7 @@ skip: extended_channel_map[ch] = ch; if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) { - uint64_t ich_layout = avpriv_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON]; + uint64_t ich_layout = ff_ac3_channel_layout_tab[s->prev_output_mode & ~AC3_OUTPUT_LFEON]; int channel_map_size = ff_ac3_channels_tab[s->output_mode & ~AC3_OUTPUT_LFEON] + s->lfe_on; uint64_t channel_layout; int extend = 0; diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h index ec9ead8a4e..39a41fe0b0 100644 --- a/libavcodec/ac3enc.h +++ b/libavcodec/ac3enc.h @@ -35,6 +35,7 @@ #include "ac3dsp.h" #include "avcodec.h" #include "fft.h" +#include "internal.h" #include "mathops.h" #include "me_cmp.h" #include "put_bits.h" diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c index 5c5ea7e27e..766e293a1d 100644 --- a/libavcodec/ac3tab.c +++ b/libavcodec/ac3tab.c @@ -82,20 +82,6 @@ const uint8_t ff_ac3_channels_tab[8] = { 2, 1, 2, 3, 3, 4, 4, 5 }; -/** - * Map audio coding mode (acmod) to channel layout mask. - */ -const uint16_t avpriv_ac3_channel_layout_tab[8] = { - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_SURROUND, - AV_CH_LAYOUT_2_1, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_2_2, - AV_CH_LAYOUT_5POINT0 -}; - /** * Table to remap channels from AC-3 order to SMPTE order. * [channel_mode][lfe][ch] diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h index ea8e3340c7..bc470204fe 100644 --- a/libavcodec/ac3tab.h +++ b/libavcodec/ac3tab.h @@ -24,13 +24,11 @@ #include -#include "libavutil/internal.h" #include "ac3.h" -#include "internal.h" extern const uint16_t ff_ac3_frame_size_tab[38][3]; extern const uint8_t ff_ac3_channels_tab[8]; -extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8]; +extern const uint16_t ff_ac3_channel_layout_tab[8]; extern const uint8_t ff_ac3_dec_channel_map[8][2][6]; extern const int ff_ac3_sample_rate_tab[]; extern const uint16_t ff_ac3_bitrate_tab[19]; diff --git a/libavcodec/eac3_data.c b/libavcodec/eac3_data.c index b159e1682f..2ef0e2053c 100644 --- a/libavcodec/eac3_data.c +++ b/libavcodec/eac3_data.c @@ -24,6 +24,8 @@ * Tables taken directly from the E-AC-3 spec. */ +#include + #include "eac3_data.h" #include "ac3.h" diff --git a/libavformat/Makefile b/libavformat/Makefile index 2b5bb43745..e30d34f924 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -678,6 +678,8 @@ OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o # Objects duplicated from other libraries for shared builds SHLIBOBJS += log2_tab.o +SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o +SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o diff --git a/libavformat/ac3_channel_layout_tab.c b/libavformat/ac3_channel_layout_tab.c new file mode 100644 index 0000000000..cba198ccc5 --- /dev/null +++ b/libavformat/ac3_channel_layout_tab.c @@ -0,0 +1,22 @@ +/* + * AC-3 channel layout table + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/ac3_channel_layout_tab.h" diff --git a/libavformat/hls_sample_encryption.c b/libavformat/hls_sample_encryption.c index 38795c7fb0..3dbaff717e 100644 --- a/libavformat/hls_sample_encryption.c +++ b/libavformat/hls_sample_encryption.c @@ -26,6 +26,8 @@ * https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption */ +#include "libavutil/channel_layout.h" + #include "hls_sample_encryption.h" #include "libavcodec/adts_header.h" @@ -129,7 +131,7 @@ int ff_hls_senc_parse_audio_setup_info(AVStream *st, HLSAudioSetupInfo *info) st->codecpar->sample_rate = eac3_sample_rate_tab[fscod]; - st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; + st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod]; if (lfeon) st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY; diff --git a/libavformat/mov.c b/libavformat/mov.c index 9ebfa0bcc7..1f11f0f7ae 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -810,7 +810,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codecpar->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; - st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; + st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod]; if (lfeon) st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY; *ast = bsmod; @@ -843,7 +843,7 @@ static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) bsmod = (eac3info >> 12) & 0x1f; acmod = (eac3info >> 9) & 0x7; lfeon = (eac3info >> 8) & 0x1; - st->codecpar->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; + st->codecpar->channel_layout = ff_ac3_channel_layout_tab[acmod]; if (lfeon) st->codecpar->channel_layout |= AV_CH_LOW_FREQUENCY; st->codecpar->channels = av_get_channel_layout_nb_channels(st->codecpar->channel_layout); From patchwork Wed Dec 15 12:35:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32529 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176787iog; Wed, 15 Dec 2021 04:37:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvIhUlJgRy2jtQsQkuW5p1vKrgF+nwIUeMPDx58b7OmHw8SOxFx/YJQ6MN6vBi/LRZJ5gD X-Received: by 2002:a05:6402:2790:: with SMTP id b16mr15046270ede.24.1639571854030; Wed, 15 Dec 2021 04:37:34 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gy2si1032436ejb.342.2021.12.15.04.37.33; Wed, 15 Dec 2021 04:37:34 -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=@outlook.com header.s=selector1 header.b=JWXHuD1r; 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 469C268B11B; Wed, 15 Dec 2021 14:36:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7E2B668B0F0 for ; Wed, 15 Dec 2021 14:36:06 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SqqDkKEaOxYfcHVqtgBIO1dAuU9NnAGgUW73r7h9h7bbCmQvESufU149nX1I3fLNmnkqrD72EzZQ6rd8hTTu5a+63SLEgRwomRZ/w7SnXpE29zBdSOJoAC6G1ag6yOqFLWZy22/1fhquZoTlYuunF0V8hRNHybjKIU+0XjIjDVA1tuFQ/GXezryHR3yUPNHZ0ugWtZIhvpKaS6Jfsl1EsEmFWBUGEn16M0WzZw4PSTzbzPs8zhtV+2L6VSHCSrFwZKMxgIP5nEzOAXKPJ8BGoCy8l785LNfKGVCwQxkeK10FQZNW3kbIGWgpxIjPwdiNEJPQJqy3tA/w4PJ7uPuBaA== 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=N1LAsml2YVm3NkWZ5Sp3eNMXJFvWH0ueW0iuejVAboA=; b=EKz5ejhpVdUkXNiV0GymLv4bKga2rBLZIlCCl9Zj9KFBLvFSPMQS7rhCRiZ4S3okDHCA1gCjn4kMu36OxImRgwniuCHE81D4u8oMHMOse2grhZqwVuvutvpgJeIeds9l47ElyqWruWHyK2gAtS/NNbu5gtpdBxnB1jnKJBRl27X63QuiQVrW8sdJuLSijnguylXq2SHrjkrLWi1+dM98mNR451RuNCe+4OSDqFAjuhQNJ7eWi5uRxG9TH/BDE/tHBYPH3UIQd/f0whfJURXN8+G1JTOSctjloHR+uNbdSghaAXbXY9Zp+9z44xi+wc2SuTO0UOfPKnRp8hO8rPDXVA== 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=N1LAsml2YVm3NkWZ5Sp3eNMXJFvWH0ueW0iuejVAboA=; b=JWXHuD1rXccahwB2F/YNtE3H5IRQfRWHwWMVP//q2YQaUSNLSFTNHHi6W1lnlhXvmW3ISuyaN9IHZ3K2Kvv97GF39QFhFRg8FPctaIDcTcYRz4buuRxAOPuPEDgjx/E+qjMp+YBJWyVqJXbopE5lwDWLFU/Vi7ggRGuw2j+zdYSOOnLlNlQDKVrRglTYFV307NRBinN+QGsP51R4VL9DMnQenL30J20kiZHya1BORXSuslxbWc9TGjMGFQphvkwmC5K604HaDEdrepmgDNxC8RYXFE441mHvgtIjc02V2E5mOLGoi+PRxo9hi5dbATX59dwpMBiXb6GopQDdR2+cDw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:54 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:54 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:35 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [U4Fqfm5++sld0jvmcHeV6+NWl4YY3AKO] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1836fab-9335-4012-b4ba-08d9bfc76f79 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UJ+cHfC79vTguh6WqLpD1ahmrhZc+sv5AjJ/7p1oAUXuRulPkRYA1QDloIW+UF7Yk+naj5iLHouxO6Qhh3f7Wx7hyVZiVIUfyWEO5wAWJKkSNyX+r5n3j8RTwTO9Shtd0jzkwZiG2dsWJ6vfVvlN5frsdO+aBoXhberi7/O13qPj5x28le66Alk3LHVHha9rwiPz1oobxS1unhuhscmXfW13Si0+a6yBUByixs03Pq3vBPrioqEvz+AGPrYbTSZqWTFqGToqbDijD3OCk8h6ICslwVL1GCMLQSYvmgJq7cSNCjKOISbDQSgKnxmLE5gYOm6VoxCj/J5rfif6k2vs91icQCMd8qbDZyIzPZ42B9x0AkElV2qIlKGd5JiVRb/igZiyhHDQVz7OvWkGaHa5+RDBp/YLnRZIHhZzb/JmA3vF8YFHt57SPrSez3Jb64WTJkzaK59vJjLXruxXo8AvapWH3zNS38T9sj6m4bCep9llnwEj+dvBMV2r3RSXTd5+RiLAumN/QWZHvyIFvjHFHktL5bTQ9ShyT2Rap6RZ6NDvYan37jO/bVrLS9/uGnC7GAHQsUowheZXiFqvruXjGZhcvKbtb0OXYEQRVWN6QyIE9Xyw70w3NFO9E3j4zoEvj/0hKQ4GdALtJ044PegBR3ek2pwcxSPYdu40zocfceiAp25MUSg1ZUyy1kkdgK4zNqULGqgnMJCaQ== X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U3asW6UXRsChqw5vNYIbT9k9VlKSdEmnMQ++ZxUqg+glJ+DbyDbJyTT2MGIJLtKP3qFiSbb9NSGpCEcSwyBjNRoeGALuNxG4xDy6FYgcsWdgzysPA0pQYERyfyPbIipazpEZ2KtBdhrGwcDYRKrfZOQdM4qX8pYzXRvnXtdyA6oPyQShUq32o7g6p+SdQHDBatS7fJZ3jD097xUwZIhIqSktFxIC2R/BOt1smzWttDf52MNKErTJ3vm4rLuVs3z8D7NWXkmYystvJc4qb/uh+SmfqMj8IEye+cwl0kG1ZbzupQyBrvVHkj/hTdNPNlr7Vw2c7i/TZiHieyr8+NWIgupp0FYXWxCisNGe/PubY08rxPqREIj+RMivAcMl0v4R/z3Hcf1zetKcE1wubnCi6d2ByB6njT9wNuppl7sCkUkhNeD6LkFCn4aXjCaSDn6hgqufCRPAhvQtgOUmGibaUo6B4cZNABWk95ldBJk0luTFo2NmFFtx8ZwfqCMk0NUkxatcC+FUsmCRHhMS9gfrC1dLvObulBrnx201u52ydk0swQe9pOoOxL3ELBCoNWRJmFHxz9QLQoSiQ9+ch+ftjg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ve6rwIffe1mNaxRGMfEgLRlhtCuB13qk8BdZZAgGogT2mxBCxLca6jFLNAr6kwrVzN7la7/4wHdwKGEJKznYlOtIlxyWkNqAo1XD9/piM7aaLkDYxB/KvDoioLKGOQklczqhZQOjg+04YhrWG0YTmyb3sxGKKgqhcuUQoif+hVnJm6qgEbUZUvStYp29WjbRzH24Pc+Grh2Km5NBig8BRYz6PPIT3awbNpZe9GhKPzRQ1n777AdIVgN6mMQt/f8XDRY34Akka99VUeC9dtYnjt85Qx5gY1uCHskpxPHgfVNNpMFpJD+tLN//Y2PS/YCeLarNwkaVpn0fiKjB5t9x/jgxVAKwFIfviGM+5Kre8oVatz2AIGu7Oaum2e7yxh1bJZPH6Pp785CGtuoY7WF/jx827heZsI+EKtRXZepQFeafSXV8p6qP+EX0cvd61G8nu728k/S3OKQU5nE0wjOfGBOUSKPsMQNRersUor/SzPGwYeVFj0kn7DtBD5FbZ5IkCx20w5O48uC43giT1PaVFNAEkIU8yD6ZYycLaanICpkEewIfYUw7xWmarTFndUpH39ZL4a8VUcnGMVsmOvOfwoNMLxr689M89r+BhJWmuv0GE2j8O6LE9Y3a7xJmfgp0c+bX1EAyRfALQUp88nhLeeoZG/YeDvESevzIEel897fgI3FmmwsH0J523WqB3vEthMb41muULwVh36A0h0YDVKlRnzRfu+Cb45da90AU/Ms+L0h1Ks1o5rVIm0O2XeXXFDZVw0EBBUZG7LGl0eeJwYnQF0yhMJcbcvbEtioojvy3Jg+qgmk46/phZeXHKWZszxUIpoeN0BVRJQjro1DldzKR0qHhaWA7geEdX1cHkIYsPcJs+vB7YXzNMcuFOxgEJ/bbl6dDzleRCI82AV5BDeLfH9XH6qEu3bgwVQ3A7FA6Z+p6+YJ2hyjRObaU1QjE9I3dTumvIhpNqMnnujEegg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1836fab-9335-4012-b4ba-08d9bfc76f79 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:54.1937 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 05/11] avcodec/dca: Unavpriv dca_sample_rates 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: oByn0wky7NFe Said table is 64 bytes long and exported so that it can be used both in libavcodec and libavformat. This commit stops doing so and instead duplicates it for shared builds, because the overhead of exporting the symbol is bigger than 64 bytes. It consists of the length of the name of the symbol (2x24 bytes), two entries in .dynsym (2x24 bytes), two entries for symbol version (2x2 bytes), one hash value in the exporting library (4 bytes) in addition to one entry in the importing library's .got and .rela.dyn (8 + 24 bytes). (The above numbers are for a Linux/GNU/Elf system; the numbers for other platforms may be different.) Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 8 +++++--- libavcodec/dca.c | 7 +------ libavcodec/dca.h | 4 +--- libavcodec/dca_core.c | 2 +- libavcodec/dca_parser.c | 2 +- libavcodec/dca_sample_rate_tab.c | 25 +++++++++++++++++++++++ libavcodec/dca_sample_rate_tab.h | 33 +++++++++++++++++++++++++++++++ libavformat/Makefile | 1 + libavformat/dca_sample_rate_tab.c | 25 +++++++++++++++++++++++ libavformat/spdifenc.c | 2 +- 10 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 libavcodec/dca_sample_rate_tab.c create mode 100644 libavcodec/dca_sample_rate_tab.h create mode 100644 libavformat/dca_sample_rate_tab.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 36a1a1a4de..e4a547ffaa 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -275,7 +275,8 @@ OBJS-$(CONFIG_CSCD_DECODER) += cscd.o OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o OBJS-$(CONFIG_DCA_DECODER) += dcadec.o dca.o dcadata.o dcahuff.o \ dca_core.o dca_exss.o dca_xll.o dca_lbr.o \ - dcadsp.o dcadct.o synth_filter.o + dcadsp.o dcadct.o dca_sample_rate_tab.o \ + synth_filter.o OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o dcadata.o dcahuff.o \ dcaadpcm.o OBJS-$(CONFIG_DDS_DECODER) += dds.o @@ -994,7 +995,6 @@ OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_SPDIF_MUXER) += dca.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o @@ -1003,6 +1003,7 @@ STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavfilter dependencies OBJS-$(CONFIG_ELBG_FILTER) += elbg.o @@ -1098,7 +1099,8 @@ OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o OBJS-$(CONFIG_CRI_PARSER) += cri_parser.o -OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o +OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o dca_exss.o dca.o \ + dca_sample_rate_tab.o OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o dnxhddata.o OBJS-$(CONFIG_DOLBY_E_PARSER) += dolby_e_parser.o dolby_e_parse.o diff --git a/libavcodec/dca.c b/libavcodec/dca.c index b2152524a5..fb359b2ff3 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -33,11 +33,6 @@ #include "get_bits.h" #include "put_bits.h" -const uint32_t avpriv_dca_sample_rates[16] = { - 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, - 12000, 24000, 48000, 96000, 192000 -}; - const uint32_t ff_dca_sampling_freqs[16] = { 8000, 16000, 32000, 64000, 128000, 22050, 44100, 88200, 176400, 352800, 12000, 24000, 48000, 96000, 192000, 384000, @@ -112,7 +107,7 @@ int ff_dca_parse_core_frame_header(DCACoreFrameHeader *h, GetBitContext *gb) return DCA_PARSE_ERROR_AMODE; h->sr_code = get_bits(gb, 4); - if (!avpriv_dca_sample_rates[h->sr_code]) + if (!ff_dca_sample_rates[h->sr_code]) return DCA_PARSE_ERROR_SAMPLE_RATE; h->br_code = get_bits(gb, 5); diff --git a/libavcodec/dca.h b/libavcodec/dca.h index e96c589c02..6be975fdfa 100644 --- a/libavcodec/dca.h +++ b/libavcodec/dca.h @@ -32,7 +32,6 @@ #include "libavutil/intreadwrite.h" #include "get_bits.h" -#include "internal.h" #define DCA_CORE_FRAME_HEADER_SIZE 18 @@ -195,8 +194,7 @@ enum DCADownMixType { DCA_DMIX_TYPE_COUNT }; -extern av_export_avcodec const uint32_t avpriv_dca_sample_rates[16]; - +extern const uint32_t ff_dca_sample_rates[16]; extern const uint32_t ff_dca_sampling_freqs[16]; extern const uint8_t ff_dca_freq_ranges[16]; extern const uint8_t ff_dca_bits_per_sample[8]; diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c index f0a3c18d62..758e3447a6 100644 --- a/libavcodec/dca_core.c +++ b/libavcodec/dca_core.c @@ -129,7 +129,7 @@ static int parse_frame_header(DCACoreDecoder *s) s->npcmblocks = h.npcmblocks; s->frame_size = h.frame_size; s->audio_mode = h.audio_mode; - s->sample_rate = avpriv_dca_sample_rates[h.sr_code]; + s->sample_rate = ff_dca_sample_rates[h.sr_code]; s->bit_rate = ff_dca_bit_rates[h.br_code]; s->drc_present = h.drc_present; s->ts_present = h.ts_present; diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c index 8b5c354312..3148397b7d 100644 --- a/libavcodec/dca_parser.c +++ b/libavcodec/dca_parser.c @@ -267,7 +267,7 @@ static int dca_parse_params(DCAParseContext *pc1, const uint8_t *buf, return AVERROR_INVALIDDATA; *duration = h.npcmblocks * DCA_PCMBLOCK_SAMPLES; - *sample_rate = avpriv_dca_sample_rates[h.sr_code]; + *sample_rate = ff_dca_sample_rates[h.sr_code]; if (*profile != FF_PROFILE_UNKNOWN) return 0; diff --git a/libavcodec/dca_sample_rate_tab.c b/libavcodec/dca_sample_rate_tab.c new file mode 100644 index 0000000000..16ee04b1d2 --- /dev/null +++ b/libavcodec/dca_sample_rate_tab.c @@ -0,0 +1,25 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larsson + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "dca_sample_rate_tab.h" diff --git a/libavcodec/dca_sample_rate_tab.h b/libavcodec/dca_sample_rate_tab.h new file mode 100644 index 0000000000..93d9a13663 --- /dev/null +++ b/libavcodec/dca_sample_rate_tab.h @@ -0,0 +1,33 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larssonb + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DCA_SAMPLE_RATE_TAB_H +#define AVCODEC_DCA_SAMPLE_RATE_TAB_H +#include + +const uint32_t ff_dca_sample_rates[16] = { + 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, + 12000, 24000, 48000, 96000, 192000 +}; +#endif diff --git a/libavformat/Makefile b/libavformat/Makefile index e30d34f924..8f05b8d83c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -682,6 +682,7 @@ SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o +SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavdevice dependencies OBJS-$(CONFIG_IEC61883_INDEV) += dv.o diff --git a/libavformat/dca_sample_rate_tab.c b/libavformat/dca_sample_rate_tab.c new file mode 100644 index 0000000000..ed2380b0cd --- /dev/null +++ b/libavformat/dca_sample_rate_tab.c @@ -0,0 +1,25 @@ +/* + * DCA sample rates + * Copyright (C) 2004 Gildas Bazin + * Copyright (C) 2004 Benjamin Zores + * Copyright (C) 2006 Benjamin Larsson + * Copyright (C) 2007 Konstantin Shishkov + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/dca_sample_rate_tab.h" diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c index e8f54bff4b..3be89328df 100644 --- a/libavformat/spdifenc.c +++ b/libavformat/spdifenc.c @@ -263,7 +263,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt) case DCA_SYNCWORD_CORE_BE: blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f; core_size = ((AV_RB24(pkt->data + 5) >> 4) & 0x3fff) + 1; - sample_rate = avpriv_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; + sample_rate = ff_dca_sample_rates[(pkt->data[8] >> 2) & 0x0f]; break; case DCA_SYNCWORD_CORE_LE: blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f; From patchwork Wed Dec 15 12:35:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32525 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8175979iog; Wed, 15 Dec 2021 04:36:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwH+9d5Uhiacae8/oAXgCsGyEUSkYLpxzTPlOXN4siMmb66wjlBTygxamNiC4GPPGnREtqE X-Received: by 2002:a05:6402:291:: with SMTP id l17mr14450660edv.242.1639571796614; Wed, 15 Dec 2021 04:36:36 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sc33si1578764ejc.409.2021.12.15.04.36.36; Wed, 15 Dec 2021 04:36:36 -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=@outlook.com header.s=selector1 header.b=gUXbET7L; 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 3CD7668B106; Wed, 15 Dec 2021 14:36:11 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067080.outbound.protection.outlook.com [40.92.67.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 548AF68AF5B for ; Wed, 15 Dec 2021 14:36:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3Kh1R18d5SnZpuv32+qzw1PmwVhn5NbrJzQ/GSA6Og1k1EEWFDcfTM+ef4q03gzqhlVEW26TBYfHo8YaM/u+qYBLA0JGVISfR7HlEkJb1L5xcBBKQ9KskvfXeU200u1hLlDZuarkGnPaD1Yke7rmWKQXLg3fKbJi930MmMEc/2KLH4cqhluKy6hiGyvP5au7iML/7tvNaZVt/EuFYdSyu/0lApxjuQAChWElnctxMRnfAo1VILb2o6mt8tBOVUA66qyaWbYejbtkltnIndKSxm7iKsfxdKWge8KZBIbLvqDWbI9dW/ReNW/VOUg+oqqwyJk7BSAWtzNr804aaANnQ== 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=UL8NhGZ+1vBHbhwK2MDPeb5Z50W/28sVxlnpTXQHB7Y=; b=CX5dw+GsxgHqV/Y5NkTACEKKImf/5HVVRE9nOBX13ejcHvrlzhKQRGIbIZcyGGS6YVSaVP+Cch7au205TToQ/W/ekDPfc3XR5JWUUYXS5kyLq1ZTFftZPGxv0JUFR1ySpdiu3dprQvwMQFKX9qz0L87BjFGcP2nz0mv9N7nRwR2Vxusm2sSxqcKIwPMqxd11gjzv4Nbn7rNjMVLbhfXLEJGaJPu38YzzpcxpIfDiwrrxiLvkWAxJcWz2OPFrVhZld0LO5CaJSQ3M/5O5NWEFlCIv0s1nY3yrMRNaVVchPecyR7wWUXj3FP/yayiLwX7riwnGrjYt1lhY6rHRtbgPgg== 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=UL8NhGZ+1vBHbhwK2MDPeb5Z50W/28sVxlnpTXQHB7Y=; b=gUXbET7Lzvv6CWNBHvWCI1LpzhUTr1W6aVjC5T9fz/59zdy3jZ9SrggroJtp/nSOnY8Q8UZx/9iZMU0sqcxxOs3nwQuhChMQDAKCJtV6BHVq9W/qV9BfqON2R3RSUKiqOiP++hgAaazkpxKIX2F+y+qZG2i7ACa6prTIXZp1Fh+lLd4nQBgxmxwKI+92EZGGgc59+Dkzdvt7rEBHfaDhK3tXIke2ZpcDKkXGCkdBjVKj9cWttpZqzwk1CCzZIg3GiE/mOrZW4EGaIcdwOh5QmMct6ySFaxUSbZ26T0jT0SpP7urigtaDwDM7fqDd1qpnO6ilfY29pqdZOVycrxQi7g== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:58 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:58 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:36 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [ZHgkaRpl+Nawdhr8BW0CKk0ezopGZUQY] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 244f0ba3-3cca-4ca4-4370-08d9bfc771e4 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhl5L2MG940+Bl7jCThzVyyS6kXMDalPjjet2h8ghic9F0vOqRm484RpxmrBk9NE6yTv+0LJaFCW8UAr5VWvo23eiWYGyN8s4y21KwEUEbXUV/7Xl1FF+FeT+7AcaskIUJfUzBVJakwzuQEVxKcK4WTMYuIixcTNQFqKg1NAMcsnvvgPcWF+OLPkw62/vKIqDL1hW1N8gHGRXk27crttuXgzxZywpXAGLBeJObnyu4pUaouPsF7SlWVQYReXPRIJhQcsEKqPceb6RTjfiflwUZD+W6vsoJTsWsxI73m1rwCvZaQPhTzugFu6voaXbFevysa3xyZM+cVyu1grVhqbL+pPHykrvJ9ejY/CZriaLhalJgGDTTO4JeObZ+PJUHNwinpw8vy8fam+scLbby5RHx7prD+yNUxQjphQYAkV5kXHd89HTSc48MN5MwXR/ETX2rDtLwmHiJeeztuLWQlp6xuKhzQFbIUgaKKgye83Jwv90LFADPkQZ6ZR9O1Uy0TxEFo/DCfeZL5lKljQo8IxyNFUDcqM+x6nPxhesFMbCH6/Zm6GrLWJwkaCEaf+gQ9I12B6PkRo+8nAbCDX87tFZnIdoUHhrh4TOWKq+HTNcAKI2Eh+pmBKbgEy9GhpVu7ImS3xZoTl5dzPotPvAHOp3QPaFjnn6EM4ODWDg8DtTjxbJxd0Gk1R6xiQCdSR6RdxjoY7Qym/fQFQY4= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Sq4vG7htFx9SX9WTWzVczERykUez6xev5yxltUKNBFf5l/9DAf0Gvufs3GmcL7AuFMAwAy3+LOpWpAs5LppcF5f3Gsiu26+UgWKVdWwALazlkXdHE58/LQLcU/MMBNaHFT2nO9LQB/9Xy3xDCx5y3A6cIFI15BqANV0hDbev5EiLPBj8PLGePnzhjUcFEzr1kp8TLeptbFaOBEYbLYVP+3AdlLwC1Ui80e7yyJV9bH2QCr91nMbZVh5BxCGC6ObRvst/7jIlK+UOWvlEg/pmWFqpue1f0wUJu+aVFH+w/tQogZ+UW2o5LxJ8Z02nLxqLZ+H7QZbgVNCPEOIc/df7v7O9xCHM1SJA8dDPLe9l5Lh58zry4AuE1FnbaYkBeJB9RsuC+S3777ldCZPxsv7lyj4TFHoE71Ldlm9UhqPQso9/3wttikofvniIICoroP8eePYxEQFBjqQqdYidAKYfm32KBJCgqPn7rw+hhhZcMMU05awAc1A7kev4NAVk2SW6Lnikwy3GiCciZy/rOGjrnAHPg3D636WOKFVw3n61oaKKV5nHZeh5K6deo8a3xTwTZH/1if5ctSmwJIZCjApNA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FtNuIewJTdp6OshdaWwTTjz2k5BNov354EUxBle/DwMj9gYmQoQYd3Ygb9h7v3pDbPiWUoJQhsQ8/a3vg7fv2pMJs7yva92Q/Ac0O4cLaxk8Yi3+r++s7RMuiuQybSiCvgoZl9mj+FgZ1ieWgqwr0g093p26PzoGMaGgBNQpTj6HF5G9bQm08motHyJdpsD2id+/4L3LhivPwcGotW3PriCqASuhscdQTNYNK5TEA5MQjHlO4/4BJvF/SaQqiwXBhqyxMIJmmte7o7NMIjuGKvLqU6lkpVAKgDCGfmUrffbLEAL8VnJh7jWxedn9tlrKVA/sw8BdirbUuroQKCJ0nR9D5IDYtjFxpIkqwj5ZZWgKjo4fwLtd7sh4Tdk4b0CdhyRYyTSXmAxa1lB48Cc/ZZt251sEErtny1GF1XvyNXSh+HZDgmJzIkaskWQrV25W3h0c74og1tFYniYcmLHyWZUCQ4hwyKxUcpilPVzyRYbgTS5BFGUWixZQ8b8sI+2wOa8pePUnOpFHj00VqARhNojapayvhflPOEDposj+HEXLfFypi5b9WY615W6ZGN5QPq4xt2lFct7zFQBaqs260zasUPFZ5d7cxLdVHrqNBMeIV1sGH1pWqYfFfy7+9kdq+7FUhUHgsv4K7fDPQeGavdAMz8IqK9mM6y+UiDXyDPzMxbwH6tbbNhdAWJHMZ92mS4xo3I7DycZuNTOu67PkBWoXdGXlCFkNoT8g0X22mh03uIh79IAK+ycQN40cl8b0l2TYzYfY3bkhAUVxnZh4hjjbOdBR8i0fPHEBwqbxtII8R5ECGeQBxBwaFsG5CS/M6IZgIA9EEgsq8B6Ztc50KrUr3Ms2Rv9/Ye+BIxUjZX5bWFwqsLoh/fKLeupQopYI9MgyVOEU5mZXpAgvWNV4Bc7F+6SYQJ0X/TsvcnEMwcXhd+U+YNlwnkE2TrKjn6ySidoPBLFqYTcq0pHIpLU2+g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 244f0ba3-3cca-4ca4-4370-08d9bfc771e4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:58.3266 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 06/11] avcodec/jpegtables: Unavpriv MJPEG-tables 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: WO6PnGPArSub There are seven MJPEG-tables, five small (1x12, 4x17) and two not small (2x162). These are all avpriv, despite this not being worthwhile due to the overhead of exporting a symbol: The total overhead for each symbol consists of two entries in .dynsym (24B each), one entry in the importing library's .rela.dyn (24B) and one in .got (8B) as well as 2x2B for symbol versions and 4B for symbol hashes in the exporting library; in addition to that, the name of the symbol is included in both exporting and importing libraries, using 2x210 bytes in this case. (The above numbers are for a x64 Elf/Linux/GNU system. Other platforms will give different numbers.) Signed-off-by: Andreas Rheinhardt --- configure | 3 +- libavcodec/Makefile | 3 +- libavcodec/g2meet.c | 16 +++--- libavcodec/jpegtables.c | 66 +---------------------- libavcodec/jpegtables.h | 16 +++--- libavcodec/jpegtabs.h | 92 +++++++++++++++++++++++++++++++++ libavcodec/ljpegenc.c | 8 +-- libavcodec/mjpeg2jpeg_bsf.c | 12 ++--- libavcodec/mjpegdec.c | 24 ++++----- libavcodec/mjpegenc.c | 16 +++--- libavcodec/mjpegenc_common.c | 18 +++---- libavcodec/mss4.c | 8 +-- libavcodec/vaapi_encode_mjpeg.c | 16 +++--- libavformat/Makefile | 3 +- libavformat/jpegtables.c | 24 +++++++++ libavformat/rtpdec_jpeg.c | 16 +++--- libavformat/rtpenc_jpeg.c | 16 +++--- 17 files changed, 204 insertions(+), 153 deletions(-) create mode 100644 libavcodec/jpegtabs.h create mode 100644 libavformat/jpegtables.c diff --git a/configure b/configure index ab1b9f6b66..b5888e845a 100755 --- a/configure +++ b/configure @@ -3432,9 +3432,8 @@ ogv_muxer_select="ogg_muxer" opus_muxer_select="ogg_muxer" psp_muxer_select="mov_muxer" rtp_demuxer_select="sdp_demuxer" -rtp_muxer_select="jpegtables" rtp_mpegts_muxer_select="mpegts_muxer rtp_muxer" -rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp" +rtpdec_select="asf_demuxer mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp" rtsp_demuxer_select="http_protocol rtpdec" rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain" sap_demuxer_select="sdp_demuxer" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index e4a547ffaa..0b568138be 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1002,7 +1002,8 @@ OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o -STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o +STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavfilter dependencies diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index c9e8d11ab8..4c53838af5 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -164,20 +164,20 @@ static av_cold int jpg_init(AVCodecContext *avctx, JPGContext *c) { int ret; - ret = ff_mjpeg_build_vlc(&c->dc_vlc[0], avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc, 0, avctx); + ret = ff_mjpeg_build_vlc(&c->dc_vlc[0], ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc, 0, avctx); if (ret) return ret; - ret = ff_mjpeg_build_vlc(&c->dc_vlc[1], avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc, 0, avctx); + ret = ff_mjpeg_build_vlc(&c->dc_vlc[1], ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc, 0, avctx); if (ret) return ret; - ret = ff_mjpeg_build_vlc(&c->ac_vlc[0], avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance, 1, avctx); + ret = ff_mjpeg_build_vlc(&c->ac_vlc[0], ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance, 1, avctx); if (ret) return ret; - ret = ff_mjpeg_build_vlc(&c->ac_vlc[1], avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance, 1, avctx); + ret = ff_mjpeg_build_vlc(&c->ac_vlc[1], ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance, 1, avctx); if (ret) return ret; diff --git a/libavcodec/jpegtables.c b/libavcodec/jpegtables.c index ef3f8dee20..e453fcf90d 100644 --- a/libavcodec/jpegtables.c +++ b/libavcodec/jpegtables.c @@ -30,8 +30,7 @@ * MJPEG encoder and decoder. */ -#include "jpegtables.h" - +#include "jpegtabs.h" #if 0 /* These are the sample quantization tables given in JPEG spec section K.1. @@ -59,66 +58,3 @@ static const unsigned char std_chrominance_quant_tbl[64] = { 99, 99, 99, 99, 99, 99, 99, 99 }; #endif - -/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ -/* IMPORTANT: these are only valid for 8-bit data precision! */ -const uint8_t avpriv_mjpeg_bits_dc_luminance[17] = -{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; -const uint8_t avpriv_mjpeg_val_dc[12] = -{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; - -const uint8_t avpriv_mjpeg_bits_dc_chrominance[17] = -{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; - -const uint8_t avpriv_mjpeg_bits_ac_luminance[17] = -{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; -const uint8_t avpriv_mjpeg_val_ac_luminance[] = -{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, - 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, - 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, - 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, - 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, - 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, - 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, - 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, - 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, - 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, - 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, - 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, - 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, - 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, - 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, - 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, - 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, - 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, - 0xf9, 0xfa -}; - -const uint8_t avpriv_mjpeg_bits_ac_chrominance[17] = -{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; - -const uint8_t avpriv_mjpeg_val_ac_chrominance[] = -{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, - 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, - 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, - 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, - 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, - 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, - 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, - 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, - 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, - 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, - 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, - 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, - 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, - 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, - 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, - 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, - 0xf9, 0xfa -}; diff --git a/libavcodec/jpegtables.h b/libavcodec/jpegtables.h index 0907280445..49b5ecdeb0 100644 --- a/libavcodec/jpegtables.h +++ b/libavcodec/jpegtables.h @@ -23,17 +23,15 @@ #include -#include "internal.h" +extern const uint8_t ff_mjpeg_bits_dc_luminance[]; +extern const uint8_t ff_mjpeg_val_dc[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_dc_luminance[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_val_dc[]; +extern const uint8_t ff_mjpeg_bits_dc_chrominance[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_dc_chrominance[]; +extern const uint8_t ff_mjpeg_bits_ac_luminance[]; +extern const uint8_t ff_mjpeg_val_ac_luminance[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_ac_luminance[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_val_ac_luminance[]; - -extern av_export_avcodec const uint8_t avpriv_mjpeg_bits_ac_chrominance[]; -extern av_export_avcodec const uint8_t avpriv_mjpeg_val_ac_chrominance[]; +extern const uint8_t ff_mjpeg_bits_ac_chrominance[]; +extern const uint8_t ff_mjpeg_val_ac_chrominance[]; #endif /* AVCODEC_JPEGTABLES_H */ diff --git a/libavcodec/jpegtabs.h b/libavcodec/jpegtabs.h new file mode 100644 index 0000000000..7106f66df0 --- /dev/null +++ b/libavcodec/jpegtabs.h @@ -0,0 +1,92 @@ +/* + * MJPEG tables + * Copyright (c) 2000, 2001 Fabrice Bellard + * Copyright (c) 2003 Alex Beregszaszi + * Copyright (c) 2003-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_JPEGTABS_H +#define AVCODEC_JPEGTABS_H + +#include +#include "jpegtables.h" + +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ +const uint8_t ff_mjpeg_bits_dc_luminance[17] = +{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; +const uint8_t ff_mjpeg_val_dc[12] = +{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const uint8_t ff_mjpeg_bits_dc_chrominance[17] = +{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; + +const uint8_t ff_mjpeg_bits_ac_luminance[17] = +{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; +const uint8_t ff_mjpeg_val_ac_luminance[] = +{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; + +const uint8_t ff_mjpeg_bits_ac_chrominance[17] = +{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + +const uint8_t ff_mjpeg_val_ac_chrominance[] = +{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; +#endif diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 968ba1fb60..ecdedeb6a3 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -293,12 +293,12 @@ static av_cold int ljpeg_encode_init(AVCodecContext *avctx) ff_mjpeg_build_huffman_codes(s->huff_size_dc_luminance, s->huff_code_dc_luminance, - avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc); + ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(s->huff_size_dc_chrominance, s->huff_code_dc_chrominance, - avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc); + ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc); return 0; } diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c index b30f391bf9..2a972a7c37 100644 --- a/libavcodec/mjpeg2jpeg_bsf.c +++ b/libavcodec/mjpeg2jpeg_bsf.c @@ -65,15 +65,15 @@ static uint8_t *append(uint8_t *buf, const uint8_t *src, int size) static uint8_t *append_dht_segment(uint8_t *buf) { buf = append(buf, dht_segment_head, sizeof(dht_segment_head)); - buf = append(buf, avpriv_mjpeg_bits_dc_luminance + 1, 16); + buf = append(buf, ff_mjpeg_bits_dc_luminance + 1, 16); buf = append(buf, dht_segment_frag, sizeof(dht_segment_frag)); - buf = append(buf, avpriv_mjpeg_val_dc, 12); + buf = append(buf, ff_mjpeg_val_dc, 12); *(buf++) = 0x10; - buf = append(buf, avpriv_mjpeg_bits_ac_luminance + 1, 16); - buf = append(buf, avpriv_mjpeg_val_ac_luminance, 162); + buf = append(buf, ff_mjpeg_bits_ac_luminance + 1, 16); + buf = append(buf, ff_mjpeg_val_ac_luminance, 162); *(buf++) = 0x11; - buf = append(buf, avpriv_mjpeg_bits_ac_chrominance + 1, 16); - buf = append(buf, avpriv_mjpeg_val_ac_chrominance, 162); + buf = append(buf, ff_mjpeg_bits_ac_chrominance + 1, 16); + buf = append(buf, ff_mjpeg_val_ac_chrominance, 162); return buf; } diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 8b154ce0ab..d447ddce77 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -61,18 +61,18 @@ static int init_default_huffman_tables(MJpegDecodeContext *s) const uint8_t *values; int length; } ht[] = { - { 0, 0, avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc, 12 }, - { 0, 1, avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc, 12 }, - { 1, 0, avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance, 162 }, - { 1, 1, avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance, 162 }, - { 2, 0, avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance, 162 }, - { 2, 1, avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance, 162 }, + { 0, 0, ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc, 12 }, + { 0, 1, ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc, 12 }, + { 1, 0, ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance, 162 }, + { 1, 1, ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance, 162 }, + { 2, 0, ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance, 162 }, + { 2, 1, ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance, 162 }, }; int i, ret; diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 0ade66bc5f..30cbbddb59 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -288,20 +288,20 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s) // they are needed at least right now for some processes like trellis. ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, - avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc); + ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, - avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc); + ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, - avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance); + ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance); ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, - avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance); + ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance); init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len); init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len); diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index c1b842d547..368e87128c 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -121,15 +121,15 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p, size += put_huffman_table(p, 1, 1, s->mjpeg_ctx->bits_ac_chrominance, s->mjpeg_ctx->val_ac_chrominance); } else { - size += put_huffman_table(p, 0, 0, avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc); - size += put_huffman_table(p, 0, 1, avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc); - - size += put_huffman_table(p, 1, 0, avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance); - size += put_huffman_table(p, 1, 1, avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance); + size += put_huffman_table(p, 0, 0, ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc); + size += put_huffman_table(p, 0, 1, ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc); + + size += put_huffman_table(p, 1, 0, ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance); + size += put_huffman_table(p, 1, 1, ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance); } AV_WB16(ptr, size); } diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index 6c44c76c50..216df2852d 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -124,10 +124,10 @@ static av_cold void mss4_init_vlcs(void) for (unsigned i = 0, offset = 0; i < 2; i++) { mss4_init_vlc(&dc_vlc[i], &offset, mss4_dc_vlc_lens[i], NULL); mss4_init_vlc(&ac_vlc[i], &offset, - i ? avpriv_mjpeg_bits_ac_chrominance + 1 - : avpriv_mjpeg_bits_ac_luminance + 1, - i ? avpriv_mjpeg_val_ac_chrominance - : avpriv_mjpeg_val_ac_luminance); + i ? ff_mjpeg_bits_ac_chrominance + 1 + : ff_mjpeg_bits_ac_luminance + 1, + i ? ff_mjpeg_val_ac_chrominance + : ff_mjpeg_val_ac_luminance); mss4_init_vlc(&vec_entry_vlc[i], &offset, mss4_vec_entry_vlc_lens[i], mss4_vec_entry_vlc_syms[i]); } diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c index d35f416ad7..6206b23e5f 100644 --- a/libavcodec/vaapi_encode_mjpeg.c +++ b/libavcodec/vaapi_encode_mjpeg.c @@ -327,20 +327,20 @@ static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, switch (t) { case 0: - lengths = avpriv_mjpeg_bits_dc_luminance + 1; - values = avpriv_mjpeg_val_dc; + lengths = ff_mjpeg_bits_dc_luminance + 1; + values = ff_mjpeg_val_dc; break; case 1: - lengths = avpriv_mjpeg_bits_ac_luminance + 1; - values = avpriv_mjpeg_val_ac_luminance; + lengths = ff_mjpeg_bits_ac_luminance + 1; + values = ff_mjpeg_val_ac_luminance; break; case 2: - lengths = avpriv_mjpeg_bits_dc_chrominance + 1; - values = avpriv_mjpeg_val_dc; + lengths = ff_mjpeg_bits_dc_chrominance + 1; + values = ff_mjpeg_val_dc; break; case 3: - lengths = avpriv_mjpeg_bits_ac_chrominance + 1; - values = avpriv_mjpeg_val_ac_chrominance; + lengths = ff_mjpeg_bits_ac_chrominance + 1; + values = ff_mjpeg_val_ac_chrominance; break; } diff --git a/libavformat/Makefile b/libavformat/Makefile index 8f05b8d83c..ee6a6370cd 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -681,7 +681,8 @@ SHLIBOBJS += log2_tab.o SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o -SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o +SHLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o +SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavdevice dependencies diff --git a/libavformat/jpegtables.c b/libavformat/jpegtables.c new file mode 100644 index 0000000000..57eae9f9a6 --- /dev/null +++ b/libavformat/jpegtables.c @@ -0,0 +1,24 @@ +/* + * MJPEG tables + * Copyright (c) 2000, 2001 Fabrice Bellard + * Copyright (c) 2003 Alex Beregszaszi + * Copyright (c) 2003-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/jpegtabs.h" diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c index b32d074136..81036247c1 100644 --- a/libavformat/rtpdec_jpeg.c +++ b/libavformat/rtpdec_jpeg.c @@ -144,14 +144,14 @@ static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t w, bytestream2_put_be16(&pbc, 0); dht_size = 2; - dht_size += jpeg_create_huffman_table(&pbc, 0, 0,avpriv_mjpeg_bits_dc_luminance, - avpriv_mjpeg_val_dc); - dht_size += jpeg_create_huffman_table(&pbc, 0, 1, avpriv_mjpeg_bits_dc_chrominance, - avpriv_mjpeg_val_dc); - dht_size += jpeg_create_huffman_table(&pbc, 1, 0, avpriv_mjpeg_bits_ac_luminance, - avpriv_mjpeg_val_ac_luminance); - dht_size += jpeg_create_huffman_table(&pbc, 1, 1, avpriv_mjpeg_bits_ac_chrominance, - avpriv_mjpeg_val_ac_chrominance); + dht_size += jpeg_create_huffman_table(&pbc, 0, 0,ff_mjpeg_bits_dc_luminance, + ff_mjpeg_val_dc); + dht_size += jpeg_create_huffman_table(&pbc, 0, 1, ff_mjpeg_bits_dc_chrominance, + ff_mjpeg_val_dc); + dht_size += jpeg_create_huffman_table(&pbc, 1, 0, ff_mjpeg_bits_ac_luminance, + ff_mjpeg_val_ac_luminance); + dht_size += jpeg_create_huffman_table(&pbc, 1, 1, ff_mjpeg_bits_ac_chrominance, + ff_mjpeg_val_ac_chrominance); AV_WB16(dht_size_ptr, dht_size); /* SOF0 */ diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c index 38eb2e68eb..91116832da 100644 --- a/libavformat/rtpenc_jpeg.c +++ b/libavformat/rtpenc_jpeg.c @@ -101,8 +101,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) switch (buf[i + 1]) { case 0x00: if ( dht_size >= 29 - && !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_luminance + 1, 16) - && !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) { + && !memcmp(buf + i + 2, ff_mjpeg_bits_dc_luminance + 1, 16) + && !memcmp(buf + i + 18, ff_mjpeg_val_dc, 12)) { default_huffman_tables |= 1; i += 29; dht_size -= 29; @@ -113,8 +113,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) break; case 0x01: if ( dht_size >= 29 - && !memcmp(buf + i + 2, avpriv_mjpeg_bits_dc_chrominance + 1, 16) - && !memcmp(buf + i + 18, avpriv_mjpeg_val_dc, 12)) { + && !memcmp(buf + i + 2, ff_mjpeg_bits_dc_chrominance + 1, 16) + && !memcmp(buf + i + 18, ff_mjpeg_val_dc, 12)) { default_huffman_tables |= 1 << 1; i += 29; dht_size -= 29; @@ -125,8 +125,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) break; case 0x10: if ( dht_size >= 179 - && !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_luminance + 1, 16) - && !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_luminance, 162)) { + && !memcmp(buf + i + 2, ff_mjpeg_bits_ac_luminance + 1, 16) + && !memcmp(buf + i + 18, ff_mjpeg_val_ac_luminance, 162)) { default_huffman_tables |= 1 << 2; i += 179; dht_size -= 179; @@ -137,8 +137,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size) break; case 0x11: if ( dht_size >= 179 - && !memcmp(buf + i + 2, avpriv_mjpeg_bits_ac_chrominance + 1, 16) - && !memcmp(buf + i + 18, avpriv_mjpeg_val_ac_chrominance, 162)) { + && !memcmp(buf + i + 2, ff_mjpeg_bits_ac_chrominance + 1, 16) + && !memcmp(buf + i + 18, ff_mjpeg_val_ac_chrominance, 162)) { default_huffman_tables |= 1 << 3; i += 179; dht_size -= 179; From patchwork Wed Dec 15 12:35:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32526 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176180iog; Wed, 15 Dec 2021 04:36:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJywLIe95/93OPi323wzdxBfcRAk25jZ0uA4WGOb/GccjUfHl8KWP1SWg4BH8RZb65iOkr7Z X-Received: by 2002:a50:9d48:: with SMTP id j8mr13969381edk.192.1639571808697; Wed, 15 Dec 2021 04:36:48 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id jz15si1098780ejb.106.2021.12.15.04.36.48; Wed, 15 Dec 2021 04:36:48 -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=@outlook.com header.s=selector1 header.b=A8UCke2F; 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 19FE868B0EE; Wed, 15 Dec 2021 14:36:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067080.outbound.protection.outlook.com [40.92.67.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7370368B0D8 for ; Wed, 15 Dec 2021 14:36:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXoVongDemZgXdf/TnWjnMrDXq0cUYFfIcA50Wz1gR+VgIezF5YO7a0jdvouPi5/eSCoRPW4x5siNRECl/9AmzMQ3hIjpNdPaQ5kx9x64eYLtz4vQiSlFfIG/A8JBLdfUkcFIwrwtsAHCWw2BYKoUh+GHrodOYu3p2RCo37pOV7GPdCFz9yjStqPw9kEVSiTm7RgEuSd5LujOgdpgYAGmmF7PyGGYZkGQHZfbdBWV5uFoDO2RBWiZHqdwo8thVJbW4tZVuzvWnoS6nXISHEg44gTHQWuOewL+ACOkUZc2alqQVSvaonpINfcVP8c3VqnKozxUtEavE2Qms+OzZnRJQ== 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=pC8LV+U9rZSa4pUBfW0oXFogsbGL4HxZas0eZMpu1ro=; b=ij25SDpaWQ45dWjQ+xwlulfrCSqDh9dgfVmmodjcIK5lB8FZe2T98sEfX1u7oJ0oSXHQe+bZaigTPKmNy/YstnKfm+TNn2Bqrfebn6DaUB+8seyXMM0SVVR3WTEMNM2/jD4MRl+MzjlrQh8Q8CnhcyDiRl+Po65mbIIcvSQ88NtKhGOWKlJxnCn9B0g7I8oSTG/uZAT6D/Ld+J6YprfxpWET4gJJINiSWuXqmqr8/y0nGsLOkHZZlrH4A4l0/zYJ24txQduif8EEauivX/NIe5cshhE4dCsEgIYDYF06im4ENNrAjcHvP1olObu1+gb8qvLYQiOaPP/LQuEST72rtw== 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=pC8LV+U9rZSa4pUBfW0oXFogsbGL4HxZas0eZMpu1ro=; b=A8UCke2FQ2OEaAeUgPXCQGLrUZ44cmS6K4ybJKKr6Q+kexZDOjnnkRkN88DiiObs/jpQMfjCyNWrJ6ecSJ4iX3qtP+YeCwVlS2h9ELIhzWGXgpJcfY9BHromqMVm0oiH6TvHD1avKz4oPTLOhRos2EFnh8aWEDI6CCsWVkw5f6qbe3/ra1Fzw7SHYOqm6hO5CxGtyh5MQdpr3v5bVP2QvlX8WUNZTf0X5BjAICfwv+49SLwVYv/UD/u5hfbg4dnrijz7aogZ7Ml92KP2bfjEY7hYvItze9ZtDxUcAbtsgLBWJhb8YABKcBn8B/aAeMGITpzqrXn1cjYXJRX9nPBrPg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:35:59 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:35:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:37 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [IPCwgDIXArvrYQh8IBEPzNjSlNUdQYUo] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-6-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a71bdef2-1d95-49ad-3dfe-08d9bfc7729e X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEuBoyQUf2rHPVuupI3Je4ybf2IByYiF1NV6hxzpVIWmo7V1o1HsfwzdItoOS7jZA2ClctcWZBNM/S1aTYC3CMCxu/HJeYtGst3VtSeowmqKl7zhr1p0Z0WxSAX71DZ8iHRRcY10GWbUz3CLSomENoaqHs4OrOfWwlFj82FR7qXrUd+PdlVG2U0Ew5/zaw5ZqVoFnHQx8Lf3qo8iXI2TB+Are5SBhOaTHRvLKxRq1FWDMmJdfTLAd/oFYE83o9AUhk+ulYP0xWXI8XhI/h8mJAs1/KP93rA2MyVCDffgbOFBdBV4ppJkd9IMHr/WzX8ceIlmFhtmzZfsCkGPiBOHQjMQMlYSkl5uwthQbmmo5N9rpFPtT92ZCo3nRRcDIAyDJfiWPZXynDThnHel7G/ENwp1a8KJyh2ahkyd/iY0xq/yT72DVEpxXMKiDag1lr6YF8D+DuZynBOltLfk2guS+53g+s2PbHRleUghXPbWb6MnW82DVmaazocSl1leMeq0tJYt1/F8nFru4NFxf3depZKJNRCuXMrmmLcrCJ/vNl/8HUcOCxhagKfAkxGOZ8mX09K5iZ/UbmqHcAV2qi/z0B2bd3goTOrvK986761sdB8nviwcVTgg6AJDMStw9RFpnI36VyFjuu6z6Ua0Q+ifo42bKhiFudWj8KBGaSti9ZEfz1d9C+sj9exoWPsf/u71Bv4Vd+NwI+7rfiD7rKkvsfo/0EOKPapSpo5NO/OVtpWHeQJnBTtJEr7PvKqESvPLcrqGIK7KRSGHxrtxAa1H9NMf X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qzF4dorbWqrCRQe++brcmWhy3718FkgLdL/AQrhvK6eOp+qNJfpzPQESyW3qy2XwlWDwgrLck0fGWH8ci4LEGDx+DeegnhK2JUlC5/0eVPJaDQkWkLFLE9PeH0pZd2UKmWVTobvdsIz0Sh9Cn7F1XIUNNSasdU4rGw3fM+EsXaYxqP+OPn2xpYRdVoU98hN6aBRlWZrwxU6PrJju7zZOGqPoQLYR74H4PoX4okNbp91B62uP3APnUK+lZ1Xe3Lmwv/kOA8O0oAJygjJYVL8EPUqcFX3afkOumnhJFklIgxsIeIiRrQ3R6nQKYOcItjTK1gWmfAXszZa6ei5PTOztnHzkCv6hZ60yvKDGFkpaRexY80u1FzFy9809f/M96+FdlGlqoLiMJUuUTzjKWm4MpCpt/RHZRez1vrTk3/ocS7cl7gc7p+o6bU9wlUYeXmv061lGs+C/9OPV2sqTErIxoK3UY8BM95vHRkvRxf8cfv1k3l3HCyoCbOlr/uTQ8e5a6AS+7uXCr5ebxdJVzbrGHEJu3p2e0snA5m4RO9Da4RCRO3YEzZQvAVVr32GQzhoKiozMNcr7Nem1C9rd7d6cGw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 95rRnu4wISX/D+BrE8/k2hrPh2+nzE/9BGgtybEjxUtehALaxNPzya+8bDp3maHPVjZ2WBaHE18VZ57y8tCmFSji3p5VKohYJ4kL/FnI9zGHmw+raAF7a5DYITi8qrMln0v2T57Xc/aXRluPt+DDMbHe3YhtATF7CQCpPhjSa16O2d5GLYXcP20tLFQXrCDVy3EjvbcpPBHD57SkgVG38lDxZ0l+ctqymHvjWwFpH0Xm3T9mRIanE2E6qTT8NOAfJP8XtL4Zxh3pYAblY/W9ux9auqtXa1sMePL03RVzV7GdYOHdMgppvWzrr59vbq+tJKvZiYWNSwX3G10ycNq+CIbpVMnTTYnO7dKwm5HHLsNVW1+5TUInetlGfRzSl7ap71EZpbR3fDILglpcQpvTitxWWtw0CK/BcgabPjgPA7GTvybI7R+klfE8CVvBkGHoz7v0gsGzMnOSHfzcpTDiaXrLez9+3Jm7q6c1oMN/4VefldSn+KAnEYos7tJTYeRVl4kkdlWaLuY3/xBblRZhMZMhKyL0+SbL1/mmZRYYQadsgPWksVZaIfMFuai7ZVGP9uaTlwRAppYb92B4h1s9e/Rfcnm5XgEdiDXAP8lkYhhhlMOqn4hC4FNmiC711mw6wzKxE2gKP9jtkKPfV80a/5NX2cJIH8gcGv3BrBzVkJgzXMZgJEJ7DvgLPxmfv3qZ6cce/J4lQ6U3EPCzK9Co8Vlt9U5RBsASaORdPl9nM6TzOuorFHT6GNLkC7oS6t0Z818Kcaba6Zw/3W20drsgI/q3J5+0UriXUmykY9em3EPDHy7tY036o79a3e7krSuHm5hVDPNtMTZSZazT7gJezb9FlmJ2f7X+3bKCC/jTP89DJOCKJ4QKg413wwImwjFrmlqMyyxv/ipEBzRAa8pn206IQBdc0YncwheMZANL8W/D7z2dRVG3kMJCO0LgDkTl+RKP1hhqLL+n3PQWilVlzg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a71bdef2-1d95-49ad-3dfe-08d9bfc7729e X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:35:59.7473 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 07/11] configure, avcodec/Makefile: Add new mpeg4audio CONFIG_EXTRA group 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: ZIIZ7sp+J3/3 This group is mainly for the users of *_mpeg4audio_get_config2(); it is not for those who only use avpriv_mpeg4audio_sample_rates. This is in preparation for splitting the latter into a file of its own; if there were no CONFIG_EXTRA group for *_mpeg4audio_get_config2() users, one would have to add a dependency to the new file for all these users on top of the existing dependency on mpeg4audio.o. Adding a new CONFIG_EXTRA group only takes effect after a reconfigure; so in order to force a reconfigure some unnecessary headers from libavdevice/alldevices.c have been removed. Signed-off-by: Andreas Rheinhardt --- configure | 23 +++++++++++++---------- libavcodec/Makefile | 23 +++++++++-------------- libavdevice/alldevices.c | 2 -- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/configure b/configure index b5888e845a..28e45b7e95 100755 --- a/configure +++ b/configure @@ -2467,6 +2467,7 @@ CONFIG_EXTRA=" mpegaudio mpegaudiodsp mpegaudioheader + mpeg4audio mpegvideo mpegvideoenc mss34dsp @@ -2704,6 +2705,7 @@ h264dsp_select="startcode" hevcparse_select="atsc_a53 golomb" frame_thread_encoder_deps="encoders threads" intrax8_select="blockdsp idctdsp" +iso_media_select="mpeg4audio" mdct_select="fft" mdct15_select="fft" me_cmp_select="fdctdsp idctdsp pixblockdsp" @@ -2716,8 +2718,8 @@ vc1dsp_select="h264chroma qpeldsp startcode" rdft_select="fft" # decoders / encoders -aac_decoder_select="adts_header mdct15 mdct sinewin" -aac_fixed_decoder_select="adts_header mdct" +aac_decoder_select="adts_header mdct15 mdct mpeg4audio sinewin" +aac_fixed_decoder_select="adts_header mdct mpeg4audio" aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct" @@ -2729,7 +2731,7 @@ adpcm_g722_decoder_select="g722dsp" adpcm_g722_encoder_select="g722dsp" aic_decoder_select="golomb idctdsp" alac_encoder_select="lpc" -als_decoder_select="bswapdsp" +als_decoder_select="bswapdsp mpeg4audio" amrnb_decoder_select="lsp" amrwb_decoder_select="lsp" amv_decoder_select="sp5x_decoder exif" @@ -2849,8 +2851,8 @@ mp3_decoder_select="mpegaudio" mp3adu_decoder_select="mpegaudio" mp3adufloat_decoder_select="mpegaudio" mp3float_decoder_select="mpegaudio" -mp3on4_decoder_select="mpegaudio" -mp3on4float_decoder_select="mpegaudio" +mp3on4_decoder_select="mpegaudio mpeg4audio" +mp3on4float_decoder_select="mpegaudio mpeg4audio" mpc7_decoder_select="bswapdsp mpegaudiodsp" mpc8_decoder_select="mpegaudiodsp" mpegvideo_decoder_select="mpegvideo" @@ -3227,7 +3229,7 @@ wmv3_crystalhd_decoder_select="crystalhd" av1_qsv_decoder_select="qsvdec" # parsers -aac_parser_select="adts_header" +aac_parser_select="adts_header mpeg4audio" av1_parser_select="cbs_av1" h264_parser_select="atsc_a53 golomb h264dsp h264parse" hevc_parser_select="hevcparse" @@ -3237,7 +3239,7 @@ mpeg4video_parser_select="h263dsp mpegvideo qpeldsp" vc1_parser_select="vc1dsp" # bitstream_filters -aac_adtstoasc_bsf_select="adts_header" +aac_adtstoasc_bsf_select="adts_header mpeg4audio" av1_frame_merge_bsf_select="cbs_av1" av1_frame_split_bsf_select="cbs_av1" av1_metadata_bsf_select="cbs_av1" @@ -3370,6 +3372,7 @@ videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrame # demuxers / muxers ac3_demuxer_select="ac3_parser" act_demuxer_select="riffdec" +adts_muxer_select="mpeg4audio" aiff_muxer_select="iso_media" asf_demuxer_select="riffdec" asf_o_demuxer_select="riffdec" @@ -3403,11 +3406,11 @@ image2_brender_pix_demuxer_select="image2_demuxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" ivf_muxer_select="av1_metadata_bsf vp9_superframe_bsf" -latm_muxer_select="aac_adtstoasc_bsf" +latm_muxer_select="aac_adtstoasc_bsf mpeg4audio" matroska_audio_muxer_select="matroska_muxer" matroska_demuxer_select="riffdec" matroska_demuxer_suggest="bzlib lzo zlib" -matroska_muxer_select="riffenc vp9_superframe_bsf aac_adtstoasc_bsf" +matroska_muxer_select="mpeg4audio riffenc vp9_superframe_bsf aac_adtstoasc_bsf" mlp_demuxer_select="mlp_parser" mmf_muxer_select="riffenc" mov_demuxer_select="iso_media riffdec" @@ -3454,7 +3457,7 @@ w64_muxer_select="wav_muxer" wav_demuxer_select="riffdec" wav_muxer_select="riffenc" webm_chunk_muxer_select="webm_muxer" -webm_muxer_select="riffenc" +webm_muxer_select="mpeg4audio riffenc" webm_dash_manifest_demuxer_select="matroska_demuxer" wtv_demuxer_select="mpegts_demuxer riffdec" wtv_muxer_select="mpegts_muxer riffenc" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0b568138be..026b558d32 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -123,6 +123,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_fixed.o \ mpegaudiodsp_float.o OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o +OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ mpegvideodata.o mpegpicture.o @@ -160,10 +161,10 @@ OBJS-$(CONFIG_ZERO12V_DECODER) += 012v.o OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps_common.o aacps_float.o \ - mpeg4audio.o kbdwin.o \ + kbdwin.o \ sbrdsp.o aacpsdsp_float.o cbrt_data.o OBJS-$(CONFIG_AAC_FIXED_DECODER) += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \ - mpeg4audio.o kbdwin.o \ + kbdwin.o \ sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \ aacpsy.o aactab.o \ @@ -189,7 +190,7 @@ OBJS-$(CONFIG_ALAC_DECODER) += alac.o alac_data.o alacdsp.o OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o alac_data.o OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ celp_math.o acelp_filters.o \ acelp_vectors.o \ @@ -479,8 +480,8 @@ OBJS-$(CONFIG_MP3_MF_ENCODER) += mfenc.o mf_utils.o OBJS-$(CONFIG_MP3ADU_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP3ADUFLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MP3FLOAT_DECODER) += mpegaudiodec_float.o -OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o mpeg4audio.o -OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o mpeg4audio.o +OBJS-$(CONFIG_MP3ON4_DECODER) += mpegaudiodec_fixed.o +OBJS-$(CONFIG_MP3ON4FLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MPC7_DECODER) += mpc7.o mpc.o OBJS-$(CONFIG_MPC8_DECODER) += mpc8.o mpc.o OBJS-$(CONFIG_MPEGVIDEO_DECODER) += mpeg12dec.o mpeg12.o mpeg12data.o @@ -985,18 +986,13 @@ OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o SHLIBOBJS += log2_tab.o reverse.o # General libavformat dependencies -OBJS-$(CONFIG_ISO_MEDIA) += mpeg4audio.o mpegaudiodata.o +OBJS-$(CONFIG_ISO_MEDIA) += mpegaudiodata.o -OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o OBJS-$(CONFIG_FITS_DEMUXER) += fits.o -OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += mpeg4audio.o -OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o -OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o # libavformat dependencies for static builds STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o @@ -1087,8 +1083,7 @@ OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o # parsers OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o -OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ - mpeg4audio.o +OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o OBJS-$(CONFIG_AC3_PARSER) += aac_ac3_parser.o ac3tab.o \ ac3_channel_layout_tab.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o @@ -1148,7 +1143,7 @@ OBJS-$(CONFIG_XBM_PARSER) += xbm_parser.o OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o # bitstream filters -OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o +OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o OBJS-$(CONFIG_AV1_FRAME_MERGE_BSF) += av1_frame_merge_bsf.o OBJS-$(CONFIG_AV1_FRAME_SPLIT_BSF) += av1_frame_split_bsf.o diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index fbbe187a51..22323a0a44 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "config.h" -#include "libavutil/thread.h" #include "libavformat/internal.h" #include "avdevice.h" From patchwork Wed Dec 15 12:35:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32527 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176344iog; Wed, 15 Dec 2021 04:37:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJys4q/8sXEBjqvGSYUIVD2C3Wea3ZUAm0y8oK7v/h63sqWrEiOP63lxoyskGYnnw0vvLoQ9 X-Received: by 2002:a05:6402:516c:: with SMTP id d12mr14029031ede.391.1639571820125; Wed, 15 Dec 2021 04:37:00 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qf38si1301723ejc.831.2021.12.15.04.36.59; Wed, 15 Dec 2021 04:37:00 -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=@outlook.com header.s=selector1 header.b=kZbhkaI6; 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 11A3868B0E9; Wed, 15 Dec 2021 14:36:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067080.outbound.protection.outlook.com [40.92.67.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 913EA68AF5B for ; Wed, 15 Dec 2021 14:36:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XxDnLnqp7c79V+rsbrx36ng9gLrtoB4y9irXBjGNa8Vw+hEiO9qUqdY0PCGsdOp6QK1UlGDHaynr/WcFlBpm6iQFejtkhhW93uGdvWIrWaFVdHE/8UxxCmklg0kSAmADgU1130ozNXw7oo5yGjwEIHK1EN6VL8Q6REJqH9Qs6C0NUFS06Fh/v/1QbrsONMqOZ1j/MRhBrScX6OVZM580RXkuffnMYnBWj8IPBVWbNIF5OS29xMXcajBM26e4yHEQn8b4ya85knU1OB8VetqkClkdL44vKGpKiMwXA0xkwGyXKQI572wRR5hSCY5DJNqAEnHH/8YfIDWCHo6YBjVpSQ== 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=6c4rlmiSTezWgG1xdgDl54f6YnxhN2IOt5cmy8udbY0=; b=kKrH96CFOBuHdu9Q6wOS7gxnoeALjkhEmlGymWHdBpmwDmN7cx5ILkMgsLW9K/gPl0Ux2mYOfRueVU38npH7KEdH1Lv3QiDp3koM9Wv3oo+dDAZeFF08pSAOM9F57uUvoYlNzrp10muM44oFt/7X/ArxPpe6qwORY933vKNVJbfTYGFRn0mDZg3HMY4EECY8VsQb2Y83vWB3JB3zdOQtixPKx8Wx0JamDcHTP9TcU0L0C2TwGqwxqwQcIQaN+ySkUxit8TWxkrakC600s2Dy8rZDeoDE3O1nZzjComJVPvAEJU3B2hYRhS+JMEjqRIGMHBrdshlMtAgyTmtyMyab5w== 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=6c4rlmiSTezWgG1xdgDl54f6YnxhN2IOt5cmy8udbY0=; b=kZbhkaI66Jw68m1HmDcF1D3YjryE2xPg1XhB+jm3tJdCEsTFzP1fu6PJMMlMDiT/FQvPrVvz96sBMfVYZMi29lEhqFePAHtExmxVeiW4jyl9YUc6IjS17GcH7FFoDP84pVlkm/PubMaa4yQMGHzU4uGtRzgrF80YKp+WShlp9I5eTpQHA0JAvjQzBDGACaAj9idYyISgUXBVRMcr5BZi9R17PdBv19Fc+1TzsEY90rGhfoluRySp2J9kptrB7CdMrKT8HQDDpXRboyJSHOjf8hV03TQ7wlGxlvoZOiR71hged4lIFHQ8bM7r/bwHjGLXhvYnSrl2vo582a1blFK+5g== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:36:01 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:36:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:38 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [2F39YqcvAbDvmXPiIBAbteA+VpBwer6D] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3bcb505-6e91-4b5d-5e4f-08d9bfc773ae X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlGbOjvIzX7qlllizbKbI7Wx81Yodz/xd870MMHumcGcl4tG8SUetI6ELKC7F+Hqfk1yTQtck5kcOjpFD7hCj1IWGzB0QEc1ddFGOsfjRZrzqxGXg4oBB4hvsrqrvzEH7QqhW7oiE4va0cb0/yKXqnDjuEPIS2pJmK0s/fOuHUCT20hy6nW/8OX1HPiIGVUorUhtdfByE0hXLfG3bgkY25zLazLm/Ap+Z+7yyVx9DQtbXDWyuZTZFUstvbeeE8mUyb6mf7RT8r2sQUw9eZzobDiWfv7Y5LZwAweYE+lNkO7K1pZXD4ZR+SJ96uvS+uKaq65syqNpVkSTiAEknQskBKlcNq+TPwG8s2hg5rOV6JaizVGllJqw/D6G/tHrXCQBCHp5Rrz+9D2bPb82bbua1d5qpWLXiziVu5Eh4L8mNsXQrbmsRv0AyyWkQvGtgD7MWGWdcg2V5SFFum7zG8C6fN5LtF15P3Erv96l+0/EaOhatg+pT0cXXedFt7Ib2ESBHPttl3+kpHSSjIWTVDmd22W9URfg43FJFqyGCpxDurYWqtlJSzSDls5K3E//5EwUwXOT7IrtNdhep7XcmBlhbquds0Wo+eknDfFMYb6FnQhmgUzti4nk61bXIcCEPOIRkrwxxVQs17/QiW/lejmsgFJrUJi4sIoHESQEzyw6CIxtxGGaVKRW4/ptDv7f6YT1jh4IfPUAhtUzY= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /cARDVDQygiGJdTwkcKQZ2Qvvzy0kO3oNvRAypHDQmenVfkJmVXKHAS7ZDFJLieARxeisvbj8hY/WZXvau872Q8mM0ZiX6018yMYNKhQ/EcUqAf4F9fwz5Em/VqjvXh86k2mRzs9HKJzjSgbpmA8YvYXfxgmPikyn3hL7a1FKQlR8K7mE9nDExfippUbpvaI/5lgWkDOovlT7PdpRs99dHxtHScf4k/AN1gXoWQUEkQ3/CLahXAK/kYsiR261Fl+u9EEUVEtZ2cAxIAtD+n+/t3nceXtcqZcqvVWOAwfkKfjYTgxfGm7OCHF3IbJBnb12H5HiBhf9WvvwtBZUt6LdQxWzwSspMUyw/PAmuMXsOfWEfcE68CKZM5m8Uyd+3XxrMzlGqSz8UTQyUp3iHxc4m7DxUyTFSnAmPlmS8Clfqs9ynfJPQ5FYQpknRp0MbZJFodpcJLqYZ4X+uCoPkhckCjJ6xJYUtm6V159JluWNZwqZePicuh5Q3NA5U6L7+ihoxYggWa8bMCBGlhIVchOYxrMoWgLhho9tWNIx3Em+HL/aJXvYOkVo110QNGCrCraVDCi4r/JU3hzlDSD76GsAw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 34XuVHYxVSXyZ1M7KJ4/220Qyl2Tk87EC+3DL7G1Yc9ICut43UlZtOmOIvc9WJBzfM6+XLxBgokeUa4JkPamB/cDB3JvUbkYogYHlwc4234fKBK0AD6kxKY9v7wIKHE5Cjk2IFfFGFvS1pSQFyuCUcDA6K21n+6TM9MxSWtrW7wrIPY0jheVEhbPAOjOPy8GQdl9CVT5TcvnyqfV6aKVzc/CBQ0Nbhact4bG8vuW83dm16+UDC2hfrQGLULb1Y3KzFv434g0Ri1iVjEI+hUX1XnTtLIeFaEGs2dWFBWLULQM9Nkxzq0XYNTuLJkSI45WdTthp34mWLVUZKkmYZwv3xUmaGBccbICbEu9xZ1l8tp+QTqp+pKAY5eFAsWWs95eDXFirty7sCzszKwa1JKlaG//SSbFfogOh9epk0Hghlr4RgGIeosjl7Em8l0oPs40/gIIDNVhM2unpvPNP4IZJWa1OUF0I6jnP9RZbQJ1vYp6G580W13TnymPqMnn0Sdnw2ZdN+6pQVnJs0bbANuon+ZJMyVmZggvmkgE5Ke8xrZshf+X7YGRosQSH59gTKU6zz7fpzbCwwOiVAV62ylJq/7l/JuVHeTdYThuxmanu0nTvVG1eF0N0So4OOHnY6fkukNd+zkhKHxVcoXYH+Ug56B4mI1bDv1JcHSbvzvRPgNE6qavoKRMAch4eR/3oJii5XkexqGQpJinaNBnWT47DtOMD/dxRWtxFJWnXcNiusMQYQlPB4ZL+JI1Nz4yeQ1aRIx4AI/0cjDS9Elq19IvmWONQfT9Isx3khtZf4HZCDPwWazdyupiLIMTZk+ZhrPM+sz5i3U11Js/RDe0LinxPgJopP0RS5RwaPm1UpOMEcODP4/kCAeDsvqplJok4HXC6O/44G6id6CaA+SziF4BGuo9/yXynVDuh7Dm1mTt4e3HaAPbTVeFwnwFzMkHB8JKhd3+Xq6YMBiD8NpoxhAiPw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3bcb505-6e91-4b5d-5e4f-08d9bfc773ae X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:36:01.2339 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 08/11] avcodec/mpeg4audio: Unavpriv and deduplicate mpeg4audio_sample_rates 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: 0Kdv/220MH2l avpriv_mpeg4audio_sample_rates has a size of 64B and it is currently avpriv; a clone of it exists in aacenctab.h and from there it is inlined in aacenc.c (which also uses the avpriv version) and in the FLV muxer. This means that despite it being avpriv both libavformat as well as libavcodec have copies already. This situation is clearly suboptimal. Given the overhead of exporting symbols (for x64 Elf/Linux/GNU: 2x2B version, 2x24B .dynsym, 24B .rela.dyn, 8B .got, 4B hash + twice the size of the name (here 31B)) the object is unavprived, i.e. duplicated into libavformat when creating a shared build; but the duplicates in the AAC encoder and FLV muxer are removed. This involves splitting of the sample rate table into a file of its own; this allowed to break some spurious dependencies (e.g. both the AAC encoder as well as the Matroska demuxer actually don't need the mpeg4audio_get_config stuff). Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 14 +++++++------ libavcodec/aacenc.c | 4 ++-- libavcodec/aacenctab.h | 7 ------- libavcodec/adts_header.c | 4 ++-- libavcodec/mpeg4audio.c | 9 +------- libavcodec/mpeg4audio.h | 3 +-- libavcodec/mpeg4audio_sample_rates.c | 23 ++++++++++++++++++++ libavcodec/mpeg4audio_sample_rates.h | 30 +++++++++++++++++++++++++++ libavformat/Makefile | 5 ++++- libavformat/flvenc.c | 4 ++-- libavformat/matroskadec.c | 4 ++-- libavformat/mpeg4audio_sample_rates.c | 23 ++++++++++++++++++++ libavformat/sdp.c | 2 +- 13 files changed, 99 insertions(+), 33 deletions(-) create mode 100644 libavcodec/mpeg4audio_sample_rates.c create mode 100644 libavcodec/mpeg4audio_sample_rates.h create mode 100644 libavformat/mpeg4audio_sample_rates.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 026b558d32..42caa1d59c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -60,7 +60,7 @@ OBJS = ac3_parser.o \ # subsystems OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ac3.o ac3tab.o -OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio.o +OBJS-$(CONFIG_ADTS_HEADER) += adts_header.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_AMF) += amfenc.o OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o OBJS-$(CONFIG_ATSC_A53) += atsc_a53.o @@ -123,7 +123,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_fixed.o \ mpegaudiodsp_float.o OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o -OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o +OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ mpegvideodata.o mpegpicture.o @@ -172,7 +172,8 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o aacenctab.o \ aacenc_tns.o \ aacenc_ltp.o \ aacenc_pred.o \ - psymodel.o mpeg4audio.o kbdwin.o + psymodel.o kbdwin.o \ + mpeg4audio_sample_rates.o OBJS-$(CONFIG_AAC_MF_ENCODER) += mfenc.o mf_utils.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o OBJS-$(CONFIG_AC3_DECODER) += ac3dec_float.o ac3dec_data.o ac3.o \ @@ -989,17 +990,18 @@ SHLIBOBJS += log2_tab.o reverse.o OBJS-$(CONFIG_ISO_MEDIA) += mpegaudiodata.o OBJS-$(CONFIG_FITS_DEMUXER) += fits.o -OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o -OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o +STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o -STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o +STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o \ + mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavfilter dependencies diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index e462566078..a1004c3e98 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -998,7 +998,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) /* Samplerate */ for (i = 0; i < 16; i++) - if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i]) + if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i]) break; s->samplerate_index = i; ERROR_IF(s->samplerate_index == 16 || @@ -1143,7 +1143,7 @@ const AVCodec ff_aac_encoder = { .encode2 = aac_encode_frame, .close = aac_encode_end, .defaults = aac_encode_defaults, - .supported_samplerates = mpeg4audio_sample_rates, + .supported_samplerates = ff_mpeg4audio_sample_rates, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, .capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP, diff --git a/libavcodec/aacenctab.h b/libavcodec/aacenctab.h index f54dd16bed..33cb7ae95b 100644 --- a/libavcodec/aacenctab.h +++ b/libavcodec/aacenctab.h @@ -81,13 +81,6 @@ static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = { { 2, 0, 1, 6, 7, 4, 5, 3 }, }; -/* duplicated from avpriv_mpeg4audio_sample_rates to avoid shared build - * failures */ -static const int mpeg4audio_sample_rates[16] = { - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000, 7350 -}; - /** bits needed to code codebook run value for long windows */ static const uint8_t run_value_bits_long[64] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, diff --git a/libavcodec/adts_header.c b/libavcodec/adts_header.c index e4454529c4..ff4efafbf7 100644 --- a/libavcodec/adts_header.c +++ b/libavcodec/adts_header.c @@ -40,7 +40,7 @@ int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr) crc_abs = get_bits1(gbc); /* protection_absent */ aot = get_bits(gbc, 2); /* profile_objecttype */ sr = get_bits(gbc, 4); /* sample_frequency_index */ - if (!avpriv_mpeg4audio_sample_rates[sr]) + if (!ff_mpeg4audio_sample_rates[sr]) return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; skip_bits1(gbc); /* private_bit */ ch = get_bits(gbc, 3); /* channel_configuration */ @@ -63,7 +63,7 @@ int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr) hdr->crc_absent = crc_abs; hdr->num_aac_frames = rdb + 1; hdr->sampling_index = sr; - hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr]; + hdr->sample_rate = ff_mpeg4audio_sample_rates[sr]; hdr->samples = (rdb + 1) * 1024; hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; hdr->frame_length = size; diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c index be50de9052..ed72a80f6d 100644 --- a/libavcodec/mpeg4audio.c +++ b/libavcodec/mpeg4audio.c @@ -57,13 +57,6 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx return 0; } -/* XXX: make sure to update the copies in the different encoders if you change - * this table */ -const int avpriv_mpeg4audio_sample_rates[16] = { - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000, 7350 -}; - const uint8_t ff_mpeg4audio_channels[14] = { 0, 1, // mono (1/0) @@ -93,7 +86,7 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) { *index = get_bits(gb, 4); return *index == 0x0f ? get_bits(gb, 24) : - avpriv_mpeg4audio_sample_rates[*index]; + ff_mpeg4audio_sample_rates[*index]; } int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h index 3187df68d2..c486a3ddef 100644 --- a/libavcodec/mpeg4audio.h +++ b/libavcodec/mpeg4audio.h @@ -27,7 +27,6 @@ #include "libavutil/attributes.h" #include "get_bits.h" -#include "internal.h" #include "put_bits.h" typedef struct MPEG4AudioConfig { @@ -45,7 +44,7 @@ typedef struct MPEG4AudioConfig { int frame_length_short; } MPEG4AudioConfig; -extern av_export_avcodec const int avpriv_mpeg4audio_sample_rates[16]; +extern const int ff_mpeg4audio_sample_rates[16]; extern const uint8_t ff_mpeg4audio_channels[14]; /** diff --git a/libavcodec/mpeg4audio_sample_rates.c b/libavcodec/mpeg4audio_sample_rates.c new file mode 100644 index 0000000000..b5ceb59c6e --- /dev/null +++ b/libavcodec/mpeg4audio_sample_rates.c @@ -0,0 +1,23 @@ +/* + * MPEG-4 Audio sample rates + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "mpeg4audio_sample_rates.h" diff --git a/libavcodec/mpeg4audio_sample_rates.h b/libavcodec/mpeg4audio_sample_rates.h new file mode 100644 index 0000000000..0b8caa6d76 --- /dev/null +++ b/libavcodec/mpeg4audio_sample_rates.h @@ -0,0 +1,30 @@ +/* + * MPEG-4 Audio sample rates + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H +#define AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H + +const int ff_mpeg4audio_sample_rates[16] = { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000, 7350 +}; +#endif diff --git a/libavformat/Makefile b/libavformat/Makefile index ee6a6370cd..c89e413dda 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -678,11 +678,14 @@ OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o # Objects duplicated from other libraries for shared builds SHLIBOBJS += log2_tab.o +SHLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o +SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o SHLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o -SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o +SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o \ + mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_SPDIF_MUXER) += dca_sample_rate_tab.o # libavdevice dependencies diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 5130d429ad..f1ef15b1bb 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -24,6 +24,7 @@ #include "libavutil/intfloat.h" #include "libavutil/avassert.h" #include "libavutil/mathematics.h" +#include "libavcodec/mpeg4audio.h" #include "avio_internal.h" #include "avio.h" #include "avc.h" @@ -33,7 +34,6 @@ #include "metadata.h" #include "libavutil/opt.h" #include "libavcodec/put_bits.h" -#include "libavcodec/aacenctab.h" static const AVCodecTag flv_video_codec_ids[] = { @@ -514,7 +514,7 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i for (samplerate_index = 0; samplerate_index < 16; samplerate_index++) if (flv->audio_par->sample_rate - == mpeg4audio_sample_rates[samplerate_index]) + == ff_mpeg4audio_sample_rates[samplerate_index]) break; init_put_bits(&pbc, data, sizeof(data)); diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a4bbbe954e..f823fb96b8 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2011,8 +2011,8 @@ static int matroska_aac_sri(int samplerate) { int sri; - for (sri = 0; sri < FF_ARRAY_ELEMS(avpriv_mpeg4audio_sample_rates); sri++) - if (avpriv_mpeg4audio_sample_rates[sri] == samplerate) + for (sri = 0; sri < FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++) + if (ff_mpeg4audio_sample_rates[sri] == samplerate) break; return sri; } diff --git a/libavformat/mpeg4audio_sample_rates.c b/libavformat/mpeg4audio_sample_rates.c new file mode 100644 index 0000000000..212385f348 --- /dev/null +++ b/libavformat/mpeg4audio_sample_rates.c @@ -0,0 +1,23 @@ +/* + * MPEG-4 Audio sample rates + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/mpeg4audio_sample_rates.h" diff --git a/libavformat/sdp.c b/libavformat/sdp.c index e83616cfbe..e3617616c5 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -453,7 +453,7 @@ static char *latm_context2config(AVFormatContext *s, AVCodecParameters *par) char *config; for (rate_index = 0; rate_index < 16; rate_index++) - if (avpriv_mpeg4audio_sample_rates[rate_index] == par->sample_rate) + if (ff_mpeg4audio_sample_rates[rate_index] == par->sample_rate) break; if (rate_index == 16) { av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n"); From patchwork Wed Dec 15 12:35:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32660 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a0c:e101:0:0:0:0:0 with SMTP id w1csp229784qvk; Wed, 15 Dec 2021 04:37:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdAav9zb/sIWpIJmoxcNOAc53h1nbe1Cwl1nr72lp2Pt5Z+ir4aOV+xCHWFenrqHcrBy/z X-Received: by 2002:a17:906:2a11:: with SMTP id j17mr10585734eje.555.1639571827934; Wed, 15 Dec 2021 04:37:07 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u8si1200596eds.199.2021.12.15.04.37.07; Wed, 15 Dec 2021 04:37:07 -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=@outlook.com header.s=selector1 header.b=BnsIMDrJ; 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 D4D1368B10D; Wed, 15 Dec 2021 14:36:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067080.outbound.protection.outlook.com [40.92.67.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A805C68B0D8 for ; Wed, 15 Dec 2021 14:36:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k6/cHoiVDy0pB+hj0XmKJpRqYvmmNIQryBczWZp+B7NIK8mwQR9fTHBkKkE00omARwFbdF1APiFE6dMLgLpWkNN9nXauWhe00SJc4pc7xTb0w4rLyQGtoD9KY8eI4QWBLDA+uw/t3iErhVPcLGX+gsCJrJGlpjHLsPmUmAKLikYJ1kznF/7ZGENPzug/G4KDS0bvZVWfoMVimm3qgmVAadX8bU0PwGaIw9L9SKk1+cZNgP7O2QrIudSipZSS9nxSTpUk/3bb7AtuFTvndCjgeWlkwkrNn0ZwLJHvIEVOkRkXUC0qOqjfiGiD6XkZ8wjY+sfDwUDiCSCi+H9x34UZjw== 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=oVLkVYeSMMbiFuI5AxHJZV0nMLFrTMzfZpaPj8OoQjc=; b=KkRp43R4xf9bdhqGUwrJWrcH582PSh61WQGwbIvOdMj3yDzRj+ORYJlIch3AjhawM+/KJOcsmfZ+wsue0GTYW5/GBPnDs5fRgLj/scN/2sq/pam3KJ9HlamlWsN2HmYiXfCFSvUsYdhIUD4gyrnHMFNgUoGqXjYOq6ZnzmZFxNaV1y/lWgB0IuqgOCN8iefHenG30cB5bVmEoRZQ1Kt2mLvn9Scog0izSglgnVCB85NsBXlbmbw+pW7DEAe+K4h9bHF+Ur5SKboa2pV0GFc9l4w5oXJhLvAcCnonJTtqFzw7+R3xqCNyz3W41eNlsfLOIOoRQIFH5miePKpRSLx9bg== 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=oVLkVYeSMMbiFuI5AxHJZV0nMLFrTMzfZpaPj8OoQjc=; b=BnsIMDrJeexW+Q9We5+fdDxuYvkgYSbebG2J2ARseO2g+A/otN53wwgbqYgf2BMG4LZ2BtPijhcsujP2Szd696pQcakl7FHOTQcrXzSQrnciRYwhCXU90kPstfj9k7A4SNIlomw1LYooEIecRWwfewev9UDDPLH6b7PW5ppiXCBMJbAeq0X+SrfxFdExWLClWZwCIfEo9llaM5t6zL/NOdugxHg8D+2qQc04R64Z3tzjDOlQo7dZi3yrF3SS96EK8NCpKzjL6XjXOeCdKnz7JGivn6cM9c/uZ81CIDQRviowA5PeiCk1Ztk5t9UROQOTNl8Z5jDaAMVFmvuvr0CT2A== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:36:05 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:36:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:39 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [ZgBYr3fZqohZ8Zp/p/hZdMH1uG4GQLq3] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7dfc010-b849-4477-2eeb-08d9bfc77600 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JZg9tEmIvrua12M23mW7q70ToEKE9bSuEuf9hsxf2btnmc3H0vLAfaMIGBuw4uwpZpZ9aKirmCGvNq8+/9Ser5rYjGtbVH4U/PH2yzEXNPnmkJE5DmAdwwCRCNCfdWeFh+8MW9o6mvvmZnxY7vF1FVwGkIeBNgL1X+SIKnqXSR8iDrfjO5ZvDpTs9Q2+6SrBRdHBy1/v03hyAV6PmzL/Xe8vjIOoDb08zMtqz6JEpQDZZO41MhgDWv+0IOIStmPPp1LWoPTobCE7PWzY2b4Q9j0qTYSU1OwzwHiOntBQ4J8N2EUROVc2GPYjB9WLTMs3JXZCwMunQptN5HX1cf/Lk1/wraoUIydyxnMShZ8qygELcjG7RLpYoGhMcyR7DMc9jx5Ob0vc/qp6hNzWw2nq60s00HralTccRFkINTNhUj6d3NtqAG6ARSr/svzt15IWOqrUtCigCGxK3idJNP1A0KJ3vtgTt3AVRUpyGyFRBoBw83l4SBPzxWW8tsw5ax3M2bG9Ivvdbz0goFX1RcQLTI4eWHje6pR1C2+VLxQ9Wgk+tw0W10lSol7EfH2e5rPeZHTs5siTn8iv1I7PuTJgdy7cJs/ux78JUE5k7heLN8euVgx1jdx2sGzUl9kzyQKgrtKTv3e2qQTgvgyskQ7XcKIOTgz0LAdAA5YyJ6iysQ2XSFGv+QJETq4f+9qFoHPOK/Lv/QXeUHCbPRJauUF8muq+XeiYiH3g+3TYa3WaKO+o= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1yAmh3qDsEvUWH3bK5O5FYj8fTXu03TMq0Zh3SXHio3AG453ChsQr/cukq1t4mmCna1oW/2cg+f5bSZfMn31FRcvgt0i3Ce0GZrmaYhIUPaFj6sMZq07vxxsEuhUbpzy9QJ/RbnZCGnAFyWgoyXQOlnYEgEbH+XKvAj4gevIQBfS2oGLVUPoIPEgWxTPbqBlL1QCGifO9uEdJNgY7TGCXcRffwtsquIpfTtRkhBzXj7vQpVd9IqfIZ2fL7Ia4vleXUz/mZkY9MtUZOUfidB49ZVIAuAuPm9kpFpO5PEGbCUN/1/vUzQXHsphK5P5laAkFOYIzLr4X07YU28CXcFLoQnfMuUcF1npWkR+tplLcRvb6m8MNY1J/39MF3H34bgGKfD42nfFEIZcarQB2WkWjjJGo2/CXrPZ2QIbLfmc7qzklReNJwBUvU/dBw5X4geQyanjyoq1vtzoOiL6rzVz5fFk16xA3VZ+WTviRTW2f+NQkhP8YE6Evp/TMeww6aY2r7+9Ancosju5PPGlCHLev53ReZpVO8k4PzrRPK5RQEAZRFJVA9M3QtCaryPjwQo2iRhjKPbyx2a3KDVLvTl83w== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yFFcnLilg0vq7e9oMGMvsX1KZHL1F+2IzViCO95sFeTJSGTk6IDKYZIhXsA9wxzygevAYzR2dQ6YLWUCUw21d5RXmTWTX9GqEYRB/8b005zPjBmBYoVDei5/DAtc8NDxfO29UFzyBf9Fi0h9K+AQHKTcDtMc9E3iFuAfUoSSASzSzdGAlQBZqX4lXlWezO2r9W2TZlMRwgg5/5Iv5oVMzUVfLp6OKGgSw7pxt78NXT1oHJk58/9gzuulGpDVcHBAZxUdYrzMeGRRulznTlPHEn2jyAF5WAwHKXRq/8CX3MdPAk5P3238fbHjwbRqfigy++k+lIKO2YTX1LsZ3SAt2fPEbEoceGAGRmalADLzTsM0vUUA+QQBnIS3ICvn5GfKY1IHD10LwdTaVj8d5Hp+/WwHy1dyaNtqU55370r7/f0L8A8DTn6FVHCjvOFnNlQXYzDjyoqVIg6Ajup7/gvwBJQSDi7MhGCjXjI/bwD3WTfl0tlUFT3+bCdzjRVUnFM2Z7U5p7cZbODO9uwKNVGk1QAKOc1EpBxZooLZhlXy9JV/LhduroiZJ8WgO+Dhcys3pevGKXbrnh/IRrSfwGJFcbp43qTqZQZZj4oD2bX271ANco6SSWJcwsdFgHtCuwF2hoI3/1eEviOtgyRM4Buwj5cMN5yUSfMJ45BMJ9GTpRfm8/CqMx9+opulmy4ZufNHpaS+utHM/xuaT9ShHXYaRaL8clRM3dQg/r2hXJwlbaaW/ZkGKJAviyVvycXhypOYdLhDT0enWloLw2rRQaQ8FPKUcr2RNOvyP7cNnFRqaKtEZAhHi4gQ5++NJUU24mfN0sDUmPhzDgn811TKJEIu1DlaSe4Xk5jVFwkCIL1tgB9bbBZCFpkFJmaX6Tpj6aq4T3tSTJpvojfS1hhpX7MyGoM4BhfzH98ieqYPGweDfNEHw/26yaTJC2IYjrfhOqg8x6CTalUNyEuoZlwCBwDf9w== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7dfc010-b849-4477-2eeb-08d9bfc77600 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:36:05.1412 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 09/11] avcodec/mpegaudiodata: Unavpriv mpa_bitrate and mpa_frequency tabs 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: I4lUUoFyKTsO Content-Length: 18290 These arrays have a size of 180 resp. six bytes. This does not make it worthwhile to export them due to the overhead this occurs; for x64 Elf/Linux/GNU: 2x2B version, 2x24B .dynsym, 24B .rela.dyn, 8B .got, 4B hash + twice the size of the name (here 20+23B). Therefore these symbols are unavprived and duplicated for shared builds. Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 16 ++++++----- libavcodec/mp3_header_decompress_bsf.c | 5 ++-- libavcodec/mpegaudiodata.c | 13 --------- libavcodec/mpegaudiodata.h | 5 ++-- libavcodec/mpegaudiodecheader.c | 6 ++-- libavcodec/mpegaudioenc_template.c | 8 +++--- libavcodec/mpegaudiotabs.c | 22 +++++++++++++++ libavcodec/mpegaudiotabs.h | 39 ++++++++++++++++++++++++++ libavformat/Makefile | 3 ++ libavformat/isom.c | 2 +- libavformat/mp3enc.c | 8 +++--- libavformat/mpegaudiotabs.c | 22 +++++++++++++++ libavformat/nutenc.c | 4 +-- 13 files changed, 114 insertions(+), 39 deletions(-) create mode 100644 libavcodec/mpegaudiotabs.c create mode 100644 libavcodec/mpegaudiotabs.h create mode 100644 libavformat/mpegaudiotabs.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 42caa1d59c..0b4aaf544e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -122,7 +122,7 @@ OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \ mpegaudiodsp_data.o \ mpegaudiodsp_fixed.o \ mpegaudiodsp_float.o -OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiodata.o +OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ @@ -472,9 +472,11 @@ OBJS-$(CONFIG_MP1_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP1FLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MP2_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc_float.o mpegaudio.o \ - mpegaudiodata.o mpegaudiodsp_data.o + mpegaudiodata.o mpegaudiodsp_data.o \ + mpegaudiotabs.o OBJS-$(CONFIG_MP2FIXED_ENCODER) += mpegaudioenc_fixed.o mpegaudio.o \ - mpegaudiodata.o mpegaudiodsp_data.o + mpegaudiodata.o mpegaudiodsp_data.o \ + mpegaudiotabs.o OBJS-$(CONFIG_MP2FLOAT_DECODER) += mpegaudiodec_float.o OBJS-$(CONFIG_MP3_DECODER) += mpegaudiodec_fixed.o OBJS-$(CONFIG_MP3_MF_ENCODER) += mfenc.o mf_utils.o @@ -987,18 +989,18 @@ OBJS-$(CONFIG_VP8_QSV_HWACCEL) += qsvdec.o SHLIBOBJS += log2_tab.o reverse.o # General libavformat dependencies -OBJS-$(CONFIG_ISO_MEDIA) += mpegaudiodata.o - OBJS-$(CONFIG_FITS_DEMUXER) += fits.o -OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o +STLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o +STLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o STLIBOBJS-$(CONFIG_RTP_MUXER) += golomb.o jpegtables.o \ mpeg4audio_sample_rates.o @@ -1168,7 +1170,7 @@ OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o OBJS-$(CONFIG_MPEG4_UNPACK_BFRAMES_BSF) += mpeg4_unpack_bframes_bsf.o OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) += mp3_header_decompress_bsf.o \ - mpegaudiodata.o + mpegaudiotabs.o OBJS-$(CONFIG_MPEG2_METADATA_BSF) += mpeg2_metadata_bsf.o OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o OBJS-$(CONFIG_NULL_BSF) += null_bsf.o diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c index 44c174c21c..ebf6bde1c2 100644 --- a/libavcodec/mp3_header_decompress_bsf.c +++ b/libavcodec/mp3_header_decompress_bsf.c @@ -22,6 +22,7 @@ #include "libavutil/intreadwrite.h" #include "bsf.h" #include "bsf_internal.h" +#include "defs.h" #include "mpegaudiodecheader.h" #include "mpegaudiodata.h" @@ -67,10 +68,10 @@ static int mp3_header_decompress(AVBSFContext *ctx, AVPacket *out) goto fail; } - sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off + sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off for(bitrate_index=2; bitrate_index<30; bitrate_index++){ - frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; + frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); if(frame_size == buf_size + 4) break; diff --git a/libavcodec/mpegaudiodata.c b/libavcodec/mpegaudiodata.c index 0569281109..669590908f 100644 --- a/libavcodec/mpegaudiodata.c +++ b/libavcodec/mpegaudiodata.c @@ -26,19 +26,6 @@ #include "mpegaudiodata.h" - -const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = { - { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, - {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, - { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160} - } -}; - -const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 }; - /*******************************************************/ /* layer 2 tables */ diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h index 0a425ef6a8..a4148a1ffe 100644 --- a/libavcodec/mpegaudiodata.h +++ b/libavcodec/mpegaudiodata.h @@ -31,14 +31,13 @@ #include "config.h" -#include "internal.h" #include "vlc.h" #define MODE_EXT_MS_STEREO 2 #define MODE_EXT_I_STEREO 1 -extern av_export_avcodec const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; -extern av_export_avcodec const uint16_t avpriv_mpa_freq_tab[3]; +extern const uint16_t ff_mpa_bitrate_tab[2][3][15]; +extern const uint16_t ff_mpa_freq_tab[3]; extern const int ff_mpa_sblimit_table[5]; extern const int ff_mpa_quant_steps[17]; extern const int ff_mpa_quant_bits[17]; diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c index 93c5f3d8f8..446a6e29d8 100644 --- a/libavcodec/mpegaudiodecheader.c +++ b/libavcodec/mpegaudiodecheader.c @@ -52,9 +52,9 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) s->layer = 4 - ((header >> 17) & 3); /* extract frequency */ sample_rate_index = (header >> 10) & 3; - if (sample_rate_index >= FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) + if (sample_rate_index >= FF_ARRAY_ELEMS(ff_mpa_freq_tab)) sample_rate_index = 0; - sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); + sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); sample_rate_index += 3 * (s->lsf + mpeg25); s->sample_rate_index = sample_rate_index; s->error_protection = ((header >> 16) & 1) ^ 1; @@ -75,7 +75,7 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) s->nb_channels = 2; if (bitrate_index != 0) { - frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; + frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; s->bit_rate = frame_size * 1000; switch(s->layer) { case 1: diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c index 1df3cc704a..1ffd31f7cb 100644 --- a/libavcodec/mpegaudioenc_template.c +++ b/libavcodec/mpegaudioenc_template.c @@ -95,9 +95,9 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) /* encoding freq */ s->lsf = 0; for(i=0;i<3;i++) { - if (avpriv_mpa_freq_tab[i] == freq) + if (ff_mpa_freq_tab[i] == freq) break; - if ((avpriv_mpa_freq_tab[i] / 2) == freq) { + if ((ff_mpa_freq_tab[i] / 2) == freq) { s->lsf = 1; break; } @@ -110,12 +110,12 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) /* encoding bitrate & frequency */ for(i=1;i<15;i++) { - if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate) + if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate) break; } if (i == 15 && !avctx->bit_rate) { i = 14; - bitrate = avpriv_mpa_bitrate_tab[s->lsf][1][i]; + bitrate = ff_mpa_bitrate_tab[s->lsf][1][i]; avctx->bit_rate = bitrate * 1000; } if (i == 15){ diff --git a/libavcodec/mpegaudiotabs.c b/libavcodec/mpegaudiotabs.c new file mode 100644 index 0000000000..eaa380c808 --- /dev/null +++ b/libavcodec/mpegaudiotabs.c @@ -0,0 +1,22 @@ +/* + * MPEG Audio common tables + * copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "mpegaudiotabs.h" diff --git a/libavcodec/mpegaudiotabs.h b/libavcodec/mpegaudiotabs.h new file mode 100644 index 0000000000..671b83848d --- /dev/null +++ b/libavcodec/mpegaudiotabs.h @@ -0,0 +1,39 @@ +/* + * MPEG Audio common tables + * copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MPEGAUDIOTABS_H +#define AVCODEC_MPEGAUDIOTABS_H + +#include + +const uint16_t ff_mpa_bitrate_tab[2][3][15] = { + { { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, + { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, + { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, + { { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 }, + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }, + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 } + } +}; + +const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 }; + +#endif diff --git a/libavformat/Makefile b/libavformat/Makefile index c89e413dda..6e93d082d9 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -678,11 +678,14 @@ OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o # Objects duplicated from other libraries for shared builds SHLIBOBJS += log2_tab.o +SHLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o SHLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o SHLIBOBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_MOV_DEMUXER) += ac3_channel_layout_tab.o +SHLIBOBJS-$(CONFIG_MP3_MUXER) += mpegaudiotabs.o SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o +SHLIBOBJS-$(CONFIG_NUT_MUXER) += mpegaudiotabs.o SHLIBOBJS-$(CONFIG_RTPDEC) += jpegtables.o SHLIBOBJS-$(CONFIG_RTP_MUXER) += golomb_tab.o jpegtables.o \ mpeg4audio_sample_rates.o diff --git a/libavformat/isom.c b/libavformat/isom.c index 300ba927c2..015c82e1bb 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -362,7 +362,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext return ret; st->codecpar->channels = cfg.channels; if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 - st->codecpar->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index]; + st->codecpar->sample_rate = ff_mpa_freq_tab[cfg.sampling_index]; else if (cfg.ext_sample_rate) st->codecpar->sample_rate = cfg.ext_sample_rate; else diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index e4b2a65b07..71e96a8651 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -159,8 +159,8 @@ static int mp3_write_xing(AVFormatContext *s) if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) || !mp3->write_xing) return 0; - for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++) { - const uint16_t base_freq = avpriv_mpa_freq_tab[i]; + for (i = 0; i < FF_ARRAY_ELEMS(ff_mpa_freq_tab); i++) { + const uint16_t base_freq = ff_mpa_freq_tab[i]; if (par->sample_rate == base_freq) ver = 0x3; // MPEG 1 else if (par->sample_rate == base_freq / 2) ver = 0x2; // MPEG 2 @@ -170,7 +170,7 @@ static int mp3_write_xing(AVFormatContext *s) srate_idx = i; break; } - if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) { + if (i == FF_ARRAY_ELEMS(ff_mpa_freq_tab)) { av_log(s, AV_LOG_WARNING, "Unsupported sample rate, not writing Xing header.\n"); return -1; } @@ -190,7 +190,7 @@ static int mp3_write_xing(AVFormatContext *s) header |= channels << 6; for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) { - int bit_rate = 1000 * avpriv_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx]; + int bit_rate = 1000 * ff_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx]; int error = FFABS(bit_rate - par->bit_rate); if (error < best_bitrate_error) { diff --git a/libavformat/mpegaudiotabs.c b/libavformat/mpegaudiotabs.c new file mode 100644 index 0000000000..41ac76e21b --- /dev/null +++ b/libavformat/mpegaudiotabs.c @@ -0,0 +1,22 @@ +/* + * MPEG Audio common tables + * copyright (c) 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/mpegaudiotabs.h" diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 7977980935..585ce953ca 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -70,11 +70,11 @@ static int find_expected_header(AVCodecParameters *p, int size, int key_frame, else if (sample_rate < (44100 + 48000) / 2) sample_rate_index = 0; else sample_rate_index = 1; - sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); + sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); for (bitrate_index = 2; bitrate_index < 30; bitrate_index++) { frame_size = - avpriv_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1]; + ff_mpa_bitrate_tab[lsf][layer - 1][bitrate_index >> 1]; frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index & 1); From patchwork Wed Dec 15 12:35:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32528 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176611iog; Wed, 15 Dec 2021 04:37:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyD8s+jv9a6GwULiuDOfe9MyP740bn5wPzpxVMBmwXUaVfjeIUz4UDw2Mq4qPJnDZnn6JKz X-Received: by 2002:a17:906:c9d2:: with SMTP id hk18mr10808771ejb.523.1639571842707; Wed, 15 Dec 2021 04:37:22 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f6si77866edv.437.2021.12.15.04.37.21; Wed, 15 Dec 2021 04:37:22 -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=@outlook.com header.s=selector1 header.b=pHY4Ily4; 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 266EB68B112; Wed, 15 Dec 2021 14:36:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067080.outbound.protection.outlook.com [40.92.67.80]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDA2A68AF5B for ; Wed, 15 Dec 2021 14:36:09 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gTyUw5bK5D7KQZckFWFJBVidhsE6jlN8QxhisVrUmnmC7fzGQDowOZXlSe6zEvs1+k5UG2Tn6VT52UVy5NG8ASci9VWjXAyOYmbxkTSekST2aeveyJmFv1GobArJDumIeq+eLU0sfsT5QpaDQ+mrkM4yE8WoE3KVFqapZjN5vt79Dq5Ch8HIfbSW4ZWMYQMWN6X/mvlA8iFiZ7bc4T39trVEJxmkGrQTtOQc+aNL4IHpQ9ZCKnMzkBi8nTOjt8wcDPrrGReWKIzGFpworLRzNN/pkN80Jvnkbeq2pMcQaTp0HzP30PfjmJm+NBkM/4MrG7vy2lAW4mGOADMPDekO+g== 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=zwYv8FXjGmEO5AsK8ewW/5gJcS6zmQO68IAeCa5XS14=; b=ElT6uDgPWrCkDaDdHwapxRiquiwSKPn4VJUXOs4LZ927yQH5mfA+DE0KWReEltYWoqboOhirTdkI5g12eJjUCA5rG2j/Xkl2DvLVSSOu9uIlVFkjMSj4G4r+wtCgC3RJUuSbd9m/bN3pDAQSkUUcpoqgvX/4/2gKRtHEOLYJfWviKr+p4ZbjXz1/pJjXzYdJwMVVyviRfdr75NSvFg0U6533ToPEb5/YVvfy441c26y51LP0cUfsMuaVleAk/QU3vdQDKSF9fIWoxXiPje5QpSE+j2Qs/4EdmoV0MLKqFtoFF0hjrZJoiNyoROddcFdNc3VKC668Vr2OqVVQZ7OfIQ== 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=zwYv8FXjGmEO5AsK8ewW/5gJcS6zmQO68IAeCa5XS14=; b=pHY4Ily4ajhJJ6SYYh0HeKU/Eqx85DDLY2Sb4bxZWWpKXyum5+e3qZDReHDFFnVJV8Pp6HEwLbFVWGNYHQrRGQGqkzDA0e/EIKY3tChKJWnZozq1L3XuWMV4n63VBqAmzRXkiJsMXGwwDJlCzAzmVVuz9rX5ZwyiqFjumUSuX6/JaeSMDCowhIaBhuhgodrK0FLzF6Ck1m8YunlXal4mMiq6seAhPsL7K0vEIUSaP6T2oUTo9QO8sghY8znsOikiH7NtxkZrDMxFmQL60DB7hrc40/2TYXLiYUd3FGKrifSv3+svHilP21NJXa6eI4dEwOPyBCtnuh+uCvDiVc6ICg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:36:07 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:36:07 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:40 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [JiwtUwgI1bCk8t1iVk9dq93+G+j8N/Hx] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-9-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 925056c8-fd10-469f-9a80-08d9bfc77725 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UJ+cHfC79vTguh6WqLpD1aharvtvfrOS6/4mWsWoYkdu1ZbvKfR2MZf29sQD+XwWustrBGckFrrUkXMgGt/iMqR0fAY2bp3s/dhFP3822MC1fOJnHHcOcrOZVEgmgpJfb0Tpyqlaq/q9kLsU7fpAPIDnoJYrPHQQNK6vyoIGZYR0lZFjAwaS/dbGcJQnMtp3ziXbTB6Od7qSL5Aag6R+OHjAHtJwxEG4LlImCFeCQP1YawJVBYBsQz9r177gLS4J77T2NXkoyAWfBKSZl2zDjAE9xJfD552UK8C5DuOA09/RqVp7Nqt6+fsT1A+/Pia+ZCaqEc0jIW5UWAmp7VFwDSWIYLJm9+az5Va8tUh5F5+wzWMlcb00hLBTrky754lJ29/yM6Ye6q6YVuyK31Rkhvk30ikSyMQk7/VWoodOrYJEK6lvg0dMGzH8TuQhpl4eX3IIR89Vm2vJ/N2VY43PH0KsPmWat5pBomkS0NMxoCAfY81Bm5hl4JTrupUpRqJromxx67vztVWrPGJhj2pPiY/XKHer2LjbMK8CH9yoTullB6ni5KjkkVAdRizvFbdp/YZQdlH4KQ5MA8U63PIQZIuM0jVrXaG+k40wkqnPbCi+jnXfdV+xvB2LGestd24SeKz7mlzBhIXRjUNqPZW88T6Ur9hWxbj048xiVRYNSOYgYC/6twLveYFTSPjhCvpBEC7trzJvKzHog== X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZuD05fRc5wKaNH/t88TV7XFVhChlDvri6eYZ4KyOgzPmc3sP6uUhbQH3L3P1/aEsF7n+q2eSM/g8XanDezoSVUW/zvaJp70jntBhTcsWQY7K0BVoK92CBaWSYVGvMa2m4tka+yi6rGlarEHg7CSAsLW/FhtNBVibaq2gNysk6Iwu7Mg44kVtMctxW8RahfZ1jYyNZKSByrpkg69ufXRxKfeJYwxeOnGL/W8bNGqaRzrLRAT+gQ4eCB3A96zWwSur4UZiXa/RmSBAL6398b4K+4j4KME7oO0jiExPTI7QOphii3slNbctVWEzBgUL6cE8i+9lcTns4nVzsRjJJGA63LOFBViFShmOImwjXW15k64ATczcJzLtJEmcYzomr7HHAzSG4UyXLeVfRFbmk4AnKGatlf1n/7dVLaDrLJKZw3AndqRJK5CvDKpyhvjGVIBZfhQSlrv1NhGczKOgOpDi6KA3AHtSsywlIQyUIIpWC4vCZHpSXRX3bWDIT3U4Mp7dSog279Z6h+aFkMBu0rmL/3NiHjcfXJHPIkutfzDRH8BOwLQRyzgJk5OWuvzzeuVndjmcRsGFR1m/jdH4x4lbIw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jPCDie6KPOaMWlUxo4FHZmXVmG1Z8kCup1HJSXhX1ASotyCptwaVkSXXBeE07I34dDvtxuiJPUikfglDToHBvZoby9RdzSKoMFcQAOVWL4sA7E2KbwAgGf4voYM63WUnPPYcSLaS1EiNQeReHI1HMpwjhJqb1/OXkdXCJlomUDiCmX5c79WgRbf+jcLOH3nBDagrLsu26e8UY31aw6GJRRTlZa76I68/g4IhicPaDxq9r63qqYzFskgL1zBSeVM+8kWyRxsyh1e3qkrjAt32gMknjKtxDNzvCImc+iMPkO7MO2D6gQNDTLo/Xm1EJYdcguoc4lTLrvm2PhaXGJ4FpdqYbK6HaZvq7aGslBC4IpQbxvs5VtS0Bfw/ZRqbYBns+ppe5yZAJhkulSBRK75qBk74ZObDzed+SBS84d3bDlFKp+H3LAYojkegSWjACklStTZOGYgq4lyRHO/UG+iNBsCK3inUFlGUoackTUioVfBRB1zGthqV9lKX6MVRI2Xqasz8FY4fITYrkJ0upLfDkkjbLLbN4Q6C/FoCi8dyHWcX16zWbeYw8SviKqFDOnHBSg59ezA7fp49DiCnP7W6hahC/uQRH50XMzxFQFcWeGJeVMtSqtAfHpxFVzlHdI3k/veQKZPxItmf7jkly6hQFjPDfP+i4r3nlBWsM4uEVnDGq9Wsan+9O/jj2FKtxiIY1b8GB7/qdkBrSoS8NkVEAppCZBZ8rKtcOE2Sw/h3HbEdMjbqSm1Ncek4QWOBGWOVw+j+YwtypVHck3EAK6PcAv9EzYPu+J41oXImdQMdM0Jxk33K4QsYTWbqjFsOGSifc3VVE2h2KkDT27QsoPTuPxQFZU0TcotMgs3afv6F6Ou0kU4yGIsl8s1TJYorqn8OGREFsRbn0YvcSxSHufPISKtwl2FViupTIqEVxg8FQIwi5EnUDj5ppU8ZMXpamZnl6f+PjKH6xN1OGyJMQ4pnIg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 925056c8-fd10-469f-9a80-08d9bfc77725 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:36:07.0798 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 10/11] avcodec/internal: Remove unused av_export_avcodec 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: T6rjDEvA1Iv2 Signed-off-by: Andreas Rheinhardt --- libavcodec/internal.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libavcodec/internal.h b/libavcodec/internal.h index a62f8dbd4e..d3ee0214c5 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -363,10 +363,4 @@ int ff_int_from_list_or_default(void *ctx, const char * val_name, int val, void ff_dvdsub_parse_palette(uint32_t *palette, const char *p); -#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec) -# define av_export_avcodec __declspec(dllimport) -#else -# define av_export_avcodec -#endif - #endif /* AVCODEC_INTERNAL_H */ From patchwork Wed Dec 15 12:35:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32530 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp8176927iog; Wed, 15 Dec 2021 04:37:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwv6zIDm/AhTRw/Qi/jZcFF1emSh4MlEH19suN9WPNiwsnWWmzug9vNX48lvgwqVRLvDuBi X-Received: by 2002:a17:906:c144:: with SMTP id dp4mr8121091ejc.88.1639571866558; Wed, 15 Dec 2021 04:37:46 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h13si1425574ede.483.2021.12.15.04.37.45; Wed, 15 Dec 2021 04:37:46 -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=@outlook.com header.s=selector1 header.b=ZFRtpmbf; 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 2ED9D68B123; Wed, 15 Dec 2021 14:36:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067045.outbound.protection.outlook.com [40.92.67.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A041468B10A for ; Wed, 15 Dec 2021 14:36:11 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2UxjrV7rmdEnZbBY3WZUVsBGo/68Ie3C4cUHP0T9uwHWGfYi6o9Fc+8PpbOxNATEjMPg0zIFVLvJVyWs3LsXaPbeqU9Qn61fvt5RNcKgUqR+NNO7ZpJo1EAB7H8KlVdrZr9lq0PZsukXWnybgp661Nnw27UiA6m3e86oSRoPy7R+KVJXw2PoPKSo7qDs3cFv1AuJybS6eUikJPcrQJfodtScsiHIHOOIV6XX976tJtzDArcQHzEAHo+9uYbLM8Max1Mc8u0nH73DZLhNvG6shsho9SPpPu0kX6pfpOxHQSn2p92ntgBVcNQFXr2KrZxDX3woWpqfOYDP3fS0MUDvA== 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=0xez/CoA5lWByq2EyiprBqArt2CUSY159jbocs1c00Q=; b=Gd1bdE0yfGgJmQl10JtrPLpgoPKwGJtLAYu9uEiIFhTqL7rERcAA7uC9wsoCEl2kU+sw+L6VLoAQ2xhsA4yhj1nC2vavQxWpZqGutiOiqe6i3iIx5Y0cd2xq65YkY6H37CTFkfbJZOfVzU9WOhoYgZYkZbD4GAuO4/n0CBU1QRZs9lfRyBmZVpVqFWhy2HLwJwzXZOo3OwJyX55Mwl3pxE4G3i+fO+m/A5Wx53mktL9LwD5/ecQ38HQhvqAh702HHKGdapzNbFIN6TvwOvQr/zGXn8nbAH2rj0LfGctk/fiCQ8xTGUGrwee8J8ZyzBP+ChVdItenXHdBJyZy+q0Y8A== 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=0xez/CoA5lWByq2EyiprBqArt2CUSY159jbocs1c00Q=; b=ZFRtpmbfBtsFxRCGw1jDY5L8jn+hlNAzbbJANWCJdLjyNbWBYWRBtHt8qV+wQsx6sxsLA29oSgSKdlNmrZbh7HlVNVDUZX/aRnO539DFurmHDrYA4Tv+qu3srIM2CanB+zEDaDWYXPRNQj+32rXVMnX9ESTCrlkUACbXLNQumu9Cmo6bmBKaWrgCTyvVQCx8gGxw6GN8PvVrv2qATNbOOBPmHyKh9LCR3OwkoBudhPEFabFsUkoKcAN/1nAvhmr0qbZSSWIxdPbTdiBX2WMg7ovK26Wa20P7QByeXTKkE+D4GzLNB2CHEy/JQq5mLQo6HXJIhT7GtPm5jEd0vNK9ww== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4952.eurprd03.prod.outlook.com (2603:10a6:20b:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 12:36:08 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Wed, 15 Dec 2021 12:36:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Dec 2021 13:35:41 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [ZWmFEWizwZuP+xGZsFkztzCauHbLr/Wv] X-ClientProxiedBy: AM0PR08CA0014.eurprd08.prod.outlook.com (2603:10a6:208:d2::27) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211215123541.5406-10-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd96ace0-ec77-4720-7e62-08d9bfc77803 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNWm3GLoeUntTG6KfWWWbWhlGo9mVYV4KWQ1G214Skfvhzqa3klEqxeLN+h7+MzbLD4y+ey59xxKajjaHAgqb5qY/PsQxTfdtO2I3hLK8t7YmAeg/peK4LffvRKcnCnhcvjRGq+crdmzvqjJAmt55RYoLa3rEZJm2Uw5OnEp1sblUGZrGzA2Hj2QYo3memyTCkvuJFcF+ka/ItXvZPac9Huquw57nObQTgFLDNlk23zMkNVUVAKHotcgbTqkjbov0x81wT+2fSHNQCrO3BqDPwHFpW+06rbhvRseoCapxQ3p2YCfOwa38rNdSkX2yPTMDHAQjbhGS4H72Z5DN4/dju5eo114OUq7dPoyO9Bcu1LDlQjxpm9j7Y9FsEGXQ3LvjobNZcCSGxUBZT0OV/7PbCHV4jVHHjrLVwjHjmiUEBd5wjykbxYeiMGl6Q47+mKN+EmBod0XkzCi9Q7n2d95v8j9oH/xpkz+z8WkFZI2u1CNAW3cZpQVjTMfnHE7kfF2AbL/cH3NiWeJp/QHeXJqoWeRNJNb9+xdZUhbaXpdQpxBB8ZPOajjiSc4o/qUKwjP4/SEA4NLjlP4hw+kesDQzY/SHc0nPn0fikA/fPwzbQdLwqFGbJG2X7VHamCMUEdwgwW4xkdIQKQS1HU+vRhRwLSqPVxJZoDJZssCmhKK10+bER9HMmfRUpgvuDmNbr8Edd+12f1a/PsRygl4L0EQpQuxx+ZJxSqee8k= X-MS-TrafficTypeDiagnostic: AM6PR03MB4952:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sY8gzTrWYJa836yR1VsFxEIYWe8H0Gb8jr8dtlFEh2GwZr7cwO2ZTOgJpL7x5STaD4mSY+ZBuYMY0CB0xhu5FzdPrTrDvx60Qv0tsOX5ur0ZNKgcwdVN4t95cPRoABTxAjazvduJjHufC6obSQxJSwWFZ/481nIFUNxtJDFy1+AOAyALj80OInBYmqkDhTFnO97DdhnaT9rowUoMBYvQ82fy+wlzgTq2df2i3MloTygdQXRn8R2CWraKGPIfDa+X2ZtoYVVWgOKyeoeVvv//YaTHxdzQhWX/34xHeM1//M7Armq9CgXOlmmmyslYJoC42XN9vlAYmMXluYsbu1CNB95KiIxuaP15pzXrsWSwt2omJs+fFPULHpAktumLW4RgrImHrX1i2cX8j0ij7UqiHcpu99PUEHS/tjI4nxkEAmNzLF9+Z7/RwgyCXD19e/FZu519lq/JP4o8Pg/AxsTke8NxuUFzQ6gXh5dBE5QUkRTw0tWM6LcOl74GHlz+aBPPiy7Ybxv71YKKkqtBSZAUdjKwzPquKlD+oDfS53wlzFok3nT7ShZicJFPJoNKGnhoRsRWjn1dMAv0TtWfk8X2xA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HmCe84ZISgk5KJHyfm070Kqkm1Ry9xTc+/cRlepB80kncRL0s6VReOALrBqc5XESi3O2nNp7fa885mnD64uL4DGm3tuBxpeBeH76JQIebqcgTTbgnfHlcegC0rMjnHnzGAHWoggkjQckR9lJ4pPofT770Ns/zk6Qiqiijty5eGZpXkTyc3H0Oj5MUUAGaRuacwUKDt1bwJF8yvYHU2OZ9nyXyFjebTTow4ds8fIG3tEAqIyklFGYeWqZFD9vOje1m/BGeaX8wRaafP5eQsG4402p+i//bxiitacVzCBG5TybeR8Wh/1dMbI7Aedy7GoG5q0/Fv3oCObsF7e8p7lDNi0LXA5U1IaX4G4DPKsp1h+LEcQHKULX7W7XEdrbcV074PLnm5QqAG5cIY/EW6S9FhLFawNwBZrI3ugX7UID2k3a1IPgWywpVcIdDGokXqzDjU49sfN6MyX9PFwb4yM8tCSL0DEYzxlpzZPvI7QBGCNJAhRPlqgVlhuZXG8ReHbbfsBjORCVJDmtdx0LsFNYg6ogBS27Bz2aYuBE3iFSdO9w4UQUhim0lWwR/Lqb3eyT3BcEfAWDJPaA15pXP1CNhOth7jODPw5eypFVxMTwoKxKMkJ9ZcvC7dNCNZO7nl59mbwkWWJYLXee15nVCjP9sU5bGTLsFUjWHzkiVdjdH5fsnkj3ZQyI78CenYUsyCbKFTGQ4D9hAj7wIozeKcKuHxeuWZRrhMdb5KjXDN5uEMkFltVGMaAt4cdnvtTxjnaR0iAqPg1mcLF9Nd6Lv/40gJf7DYJMo91UTC2UHm/lYOLVRpOP3epVIyMUJLQoHoh7kV1CR4Slrp2yhrECpR1LRBCmCaJmmZTvV6BdaLfrcRG5XNXPtGjM3+2NCzW4CHmgaXnwxu4CIEbjYgueRnO0ZldE00K+2hC8VSyWaJGEkA7JVEBFtu7/HWndLUFR9P3egTbhEFHpuFF1VG1KYeam4g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd96ace0-ec77-4720-7e62-08d9bfc77803 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2021 12:36:08.4402 (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: AM6PR03MB4952 Subject: [FFmpeg-devel] [PATCH 11/11] avcodec/utils: Unavpriv avpriv_toupper4() 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: i2Njp+k2ziOP This function is quite small (96B with GCC 11.2 on x64 Ubuntu 21.10 at -O3), making it more economical to duplicate it into libavformat instead of exporting it as avpriv: Doing so saves 2x24B in .dynsim, 2x16B in .dynstr, 2x2B .gnu.version, 24B in .rela.plt, 16B in .plt, 16B in .plt.sec (if enabled), 4B .gnu.hash; besides the actual duplicated code this also adds 2x8B .eh_frame_hdr and 24B .eh_frame. In other words: Duplicating is neutral size-wise (it is also presumed neutral for other systems). Given that it avoids the runtime overhead of dynamic symbols, it is advantageouos to duplicate the function. Signed-off-by: Andreas Rheinhardt --- libavcodec/Makefile | 4 +++- libavcodec/internal.h | 2 +- libavcodec/mpeg12dec.c | 2 +- libavcodec/mpegvideo.c | 2 +- libavcodec/to_upper4.c | 23 +++++++++++++++++++++++ libavcodec/to_upper4.h | 37 +++++++++++++++++++++++++++++++++++++ libavcodec/utils.c | 8 -------- libavformat/Makefile | 2 +- libavformat/movenc.c | 2 +- libavformat/mux.c | 2 +- libavformat/to_upper4.c | 23 +++++++++++++++++++++++ libavformat/utils.c | 2 +- 12 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 libavcodec/to_upper4.c create mode 100644 libavcodec/to_upper4.h create mode 100644 libavformat/to_upper4.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 0b4aaf544e..292a105266 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -126,7 +126,8 @@ OBJS-$(CONFIG_MPEGAUDIOHEADER) += mpegaudiodecheader.o mpegaudiotabs.o OBJS-$(CONFIG_MPEG4AUDIO) += mpeg4audio.o mpeg4audio_sample_rates.o OBJS-$(CONFIG_MPEGVIDEO) += mpegvideo.o mpegvideodsp.o rl.o \ mpegvideo_motion.o mpegutils.o \ - mpegvideodata.o mpegpicture.o + mpegvideodata.o mpegpicture.o \ + to_upper4.o OBJS-$(CONFIG_MPEGVIDEOENC) += mpegvideo_enc.o mpeg12data.o \ motion_est.o ratecontrol.o \ mpegvideoencdsp.o @@ -993,6 +994,7 @@ OBJS-$(CONFIG_FITS_DEMUXER) += fits.o OBJS-$(CONFIG_TAK_DEMUXER) += tak.o # libavformat dependencies for static builds +STLIBOBJS-$(CONFIG_AVFORMAT) += to_upper4.o STLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o STLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o STLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o diff --git a/libavcodec/internal.h b/libavcodec/internal.h index d3ee0214c5..72ca1553f6 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -225,7 +225,7 @@ extern const uint8_t ff_log2_run[41]; */ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); -unsigned int avpriv_toupper4(unsigned int x); +unsigned int ff_toupper4(unsigned int x); void ff_color_frame(AVFrame *frame, const int color[4]); diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 09b2902bca..172ea92b16 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2831,7 +2831,7 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, } #endif - s2->codec_tag = avpriv_toupper4(avctx->codec_tag); + s2->codec_tag = ff_toupper4(avctx->codec_tag); if (s->mpeg_enc_ctx_allocated == 0 && ( s2->codec_tag == AV_RL32("VCR2") || s2->codec_tag == AV_RL32("BW10") )) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ba5b51955e..90d0a9fd50 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -707,7 +707,7 @@ void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx) s->workaround_bugs = avctx->workaround_bugs; /* convert fourcc to upper case */ - s->codec_tag = avpriv_toupper4(avctx->codec_tag); + s->codec_tag = ff_toupper4(avctx->codec_tag); } /** diff --git a/libavcodec/to_upper4.c b/libavcodec/to_upper4.c new file mode 100644 index 0000000000..29f65bf5c3 --- /dev/null +++ b/libavcodec/to_upper4.c @@ -0,0 +1,23 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "to_upper4.h" diff --git a/libavcodec/to_upper4.h b/libavcodec/to_upper4.h new file mode 100644 index 0000000000..d9648b5ef6 --- /dev/null +++ b/libavcodec/to_upper4.h @@ -0,0 +1,37 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_TO_UPPER4_H +#define AVCODEC_TO_UPPER4_H + +#include "libavutil/avstring.h" +#include "internal.h" + +unsigned int ff_toupper4(unsigned int x) +{ + return av_toupper(x & 0xFF) | + (av_toupper((x >> 8) & 0xFF) << 8) | + (av_toupper((x >> 16) & 0xFF) << 16) | +((unsigned)av_toupper((x >> 24) & 0xFF) << 24); +} + +#endif diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4d236ff1cd..b19befef21 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -863,14 +863,6 @@ const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index) return &codec->hw_configs[index]->public; } -unsigned int avpriv_toupper4(unsigned int x) -{ - return av_toupper(x & 0xFF) + - (av_toupper((x >> 8) & 0xFF) << 8) + - (av_toupper((x >> 16) & 0xFF) << 16) + -((unsigned)av_toupper((x >> 24) & 0xFF) << 24); -} - int ff_thread_ref_frame(ThreadFrame *dst, const ThreadFrame *src) { int ret; diff --git a/libavformat/Makefile b/libavformat/Makefile index 6e93d082d9..c5c9e78fa8 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -677,7 +677,7 @@ OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o # Objects duplicated from other libraries for shared builds -SHLIBOBJS += log2_tab.o +SHLIBOBJS += log2_tab.o to_upper4.o SHLIBOBJS-$(CONFIG_ISO_MEDIA) += mpegaudiotabs.o SHLIBOBJS-$(CONFIG_FLV_MUXER) += mpeg4audio_sample_rates.o SHLIBOBJS-$(CONFIG_HLS_DEMUXER) += ac3_channel_layout_tab.o diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7216331fa1..fc309fb416 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1716,7 +1716,7 @@ static unsigned int validate_codec_tag(const AVCodecTag *const *tags, for (i = 0; tags && tags[i]; i++) { const AVCodecTag *codec_tags = tags[i]; while (codec_tags->id != AV_CODEC_ID_NONE) { - if (avpriv_toupper4(codec_tags->tag) == avpriv_toupper4(tag) && + if (ff_toupper4(codec_tags->tag) == ff_toupper4(tag) && codec_tags->id == codec_id) return codec_tags->tag; codec_tags++; diff --git a/libavformat/mux.c b/libavformat/mux.c index d93dc73f8e..b9c4abb9cf 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -204,7 +204,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st) for (int n = 0; s->oformat->codec_tag[n]; n++) { avctag = s->oformat->codec_tag[n]; while (avctag->id != AV_CODEC_ID_NONE) { - if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codecpar->codec_tag)) { + if (ff_toupper4(avctag->tag) == ff_toupper4(st->codecpar->codec_tag)) { id = avctag->id; if (id == st->codecpar->codec_id) return 1; diff --git a/libavformat/to_upper4.c b/libavformat/to_upper4.c new file mode 100644 index 0000000000..e84c803675 --- /dev/null +++ b/libavformat/to_upper4.c @@ -0,0 +1,23 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavcodec/to_upper4.h" diff --git a/libavformat/utils.c b/libavformat/utils.c index b5a4a09ae8..bd076d532b 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -361,7 +361,7 @@ enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) if (tag == tags[i].tag) return tags[i].id; for (int i = 0; tags[i].id != AV_CODEC_ID_NONE; i++) - if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag)) + if (ff_toupper4(tag) == ff_toupper4(tags[i].tag)) return tags[i].id; return AV_CODEC_ID_NONE; } From patchwork Thu Dec 16 01:29:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32648 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp407852iog; Wed, 15 Dec 2021 17:30:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMRdnQp0XTTlDF3eXZ5O6JBsznlMO+gvTl/8EInWe3KIloRSs1CoRcW4nlDRRuS/YMlIk9 X-Received: by 2002:a05:6402:60c:: with SMTP id n12mr18251430edv.17.1639618210171; Wed, 15 Dec 2021 17:30:10 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s1si3397849ejn.68.2021.12.15.17.29.46; Wed, 15 Dec 2021 17:30:10 -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=@outlook.com header.s=selector1 header.b=JcIl4FAD; 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 F2F1468AE25; Thu, 16 Dec 2021 03:29:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2104.outbound.protection.outlook.com [40.92.89.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1BF876809C4 for ; Thu, 16 Dec 2021 03:29:35 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=agjsMjEEfUCbJD2Kc9TjRdJlcZfy9VwvTtmGhk4xO4+PFrin4+y8/yegjrxeMMB62SYHXKl6soPu9y5GFyAmktusa6e/53ELYbJKi8ap0xPrrXf8PfHp2vssfZemMfoKruDAQni8bHZ0XnAQSa6zO8YAd6jn+87M+KDvLZfW0yfTX6NwrBPT2DjzJK1T95Lc7eb5PPgxcI0gwLm7MT32PQp6rVptYXcd4pWVUpgGqvOQf1ZAbmiqpg1V48ZJqhatoyUfhfuqx8+hfff0faIhfZz1Fw+DY5iIgYLRggvCBgElBGFJOQHPSDWnk70RkDNV6wIgv92lfaCEaW/oa5xduQ== 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=Y9jee0ldHJIMyv6AOWNeptQN/XMgookrsOvijZYrKdE=; b=UQFDFBh3Ww9guoC7gS7z+aEiAz49yosCUh2jC3iSV/T+MISTn5OouAzjapp+jMgkK4JNiQ+siyQijNSwLxIRYAajQTWSCbrqoYNqUc7hGO0s+F8h+AdBTzGC/UXV69CwWuU3di5wVwUJigxhHZg1DDtq8yc9BfiqIF7/nRQSR7svREzS3XijHlgyuziQjqjxUgt7Mp6a55zPnwSKDTrmstzARwmUwDSAlwimW5OShgp+TWm58vqnMVkT3kMvHmoHX+EomY/UQIG/1EWPwN1QdcD7b+RW0+LTftR4OTeZPFnrCg/ys0Axx3kwqtPNCPa/fGOFgTxFRMrsnIXGgY9Blw== 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=Y9jee0ldHJIMyv6AOWNeptQN/XMgookrsOvijZYrKdE=; b=JcIl4FADOCjRBsommF/naMc7kwC+VCvXNJu4k3rw2Dxqt6ayX+5UEH/wH1X1B9RacM0OK2m8bTQOu8kU9wHK2K4Nn2MIXwQ89A9WPm2MO7Y4NMhL77T8CuBrGJ0mayIzaRuIjnUmOIGwZhML4kirRGJaKKe9BALzYm8L/KfMnN7GCQlJjWWR+8kbEDYD2itgOo7Z47ZrTMVd/QGT+r+R0ZL9tQjPXE/5gA1DZ5USPekhtEHsC2UgCBc2uzZA2XZ9vOmWL/MxDpF0xVwc8eStUpmVLsqbutLB/CsoYYqG3lRTwqRiS7MrPREVxyzGsVUN+pZYPVvu6L7o7/0GkrYZjQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR0302MB3191.eurprd03.prod.outlook.com (2603:10a6:209:19::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Thu, 16 Dec 2021 01:29:33 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Thu, 16 Dec 2021 01:29:33 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Dec 2021 02:29:20 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [WQq7ajnCf4Q4azEGqQ+KckxF6lJ442oQ] X-ClientProxiedBy: AM9P192CA0004.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211216012923.404907-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e87c247-cf5b-45af-5908-08d9c033833b X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JSYz06tH3gIhrn4SsTG6tQ9FtBlKQC//NVlMvZRW1aVyKf9fyjNacO29ck3Ji/SR5+rnTSn6ogrP38D0wty3VlixKvuw9mYhn5+svTCQ0AQM+cTsLwbAHxUFs45Lp5y8lBqjGQpe1jLFlvXG2mMMU0O46Qh5tt7qX1oYf21cyjpaWIytkUgSyYQK4Dfi7rGSxmnd0rU4G6o3Eyre2MoXvTgh9WR4ieVTK973bUwR48LiVv2a/jZMDsw8pa6+MFEJY7lM7Jca3VUUrY7sNJi5UZXDsD5f8Tu9XG4LZshKrqFIQZMeVvtui6ek+xcW4fhFhvbIEPI+tqI+ukqL7vQmMuDmuCtjw+kf7+fl/ruhWDO4OkzFrocmOnGszknNkTHtnMVwAXCbiaX6kRBOdXc4VyyO21kMSFBDrIXeSIbzbtKOpIMTS1OwFaVC0cd20GjC7wFoPlugug4AlrLFKwemqwrtDwkMKSDYUpsbgHIhXLb7RGUhluuC8U7fLEa5szV6n+P6NY40PsSbc5BptJZDHcADAVgTzjetrlvxsWW5d0U44fkF+/ENa0FciM1iymz+4r8nystJhcnmZmPnxbRqhyYk6ukcZEubIifT6xKZmGJDwJI6ni/grtCpcvIpylMnCGx/0ZWOkNFfn7s5bPq5J+Kmh+4bjF6DfGrYRpBZJZIjpBAzlpt7wjMQ2SJNAS302TNacNpuXLC10ncC7uVbFzCWdDbcz3qYz8fJen/k6dLY= X-MS-TrafficTypeDiagnostic: AM6PR0302MB3191:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9sQJC9AvWBFpCBtxLHWpxGy8bxFcq6UKZDK9RGEpKX4TBAVY+mvIQ+5Yah8U7gdadAi9bBbB/+44TZ5P6/bna2FATgjQIdNQbmPJjndOD2AHPr6MT9SNgzrl2XcLFT8eXHQVDy1jyuqGg8uxMOQvkq0YcQTrBCttsp1pq8g+RX4NZyP4nlb9y4Xu0KYDH9V9EYgMRafGRYkdLFSKETvaJAKRJWoQ+H1zgU2u/31LgYEcqgKWTkcbiUOOWbfaa4LZzta0qAbbn+NrrNF9QX2klEzB2pf4PfBEmvWb3X27+kvVmTZn3NfvkPDGOjpQgx1jwctfDQ+Hl50DmR2bfK12jYNrNUVfiCm14Mks78UgA3ceUnJwFzchmom3SoyiiwVxy2rq5RI9Y2ix0Ag8vZXTEmVy5cq9tenVqicTL4Ia5TvPzc+UCcaC68L/+cBaf8elSwLOJJr8r+PED5Vu2/0a6KTaPlztzzVhhCMHOYWyiMimYDKW/5jeOeyr8etf4ACWWHE7JxKFji3WKsl3i/0myvKydBUi0fY8S4VXS0RYW3fEq4kZ1UvOkVEqcPLRzWGntnqf8Eii5zHbbM4IZ3lD7A== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RNTeUi3xgVbXy42rTn4AGHMH7UtMIy+6+E8o0180uQ4OSsKgqeKjSgCKQ6m7nuCDUvjHVALjeEHULzelUFI30YlAVufFjXIVpYi6rlkWi1LgVoP0FBfgDY8bOXr7iHAizNv/zmXdrhlElkLKRxXpTwoDOdZ7VrC1/+79aamh6hQ7b2HnIgU2LRuBdJqMMgirinBYQmA9ELAZdg2f7Yfd9tAmXPTWhwG610II96sk7epfjt4yYJrel5zKym+2caPIzjLlcKJs0UfeapRzXBqqriThV5jtpOvMJ9t+A5quvl+3uewbQ+AgpUV6TzUKRSgfCZ7cBFl46Zkye682RBRRd8KTkL9wlan5mgnUaPyVVCDU5ekfQsR+4RfhDywv+m21eE+V5i7nzKIp6ooYz0FG74jR9YG4LmifWCM8/HbdeO7YFVux6Cs/PDGkIr4uowN+ACLee+jN3NDKGOc/hDZiX9cLNY8PsJ8jVP/cvxGWilew8wXan2eH9R2e3Tb6211pbCAQkxF90aemFngwJKaKFngXTw7tHvlNkikP3s0RXGxoSU60mz1KDsEqC9b56LmVGny1S6gZ1KY5Il8GraCTOPwDsnvY0QYi4d12neot73Wf51Zvp798nSbJbyWBRt5bE2+LmOR1Ti2DRiunRUSFuawI4t7GFfnrvYD5fHg2Ptim17MrKaZrEFzBpu9i+qWq5YJ9rKlhMNEfkqRjenZcq3gVwv8wK+EGE6gHdi7Yl+88bA6WDJ6czguvbPrHw5g5r1764ZTYlWDm3GzqzY46BMthQTc/ohGffixDfCgr8DYy6pmBMbOb42TWdR+F2WgHmx/lqORVPmLrt2HEXy3I4bVgo0Y5a39htJ5cIBng3BOjOeVWfo2fhlFlVailHi3jl9y0rbbfsNR/OrFwoVePxrdEeHn7I+qKCH/3mmjl22HSHZTT/nFUf3Y4jWQlAew92iK+LyypOjx2ScFgd4of4g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e87c247-cf5b-45af-5908-08d9c033833b X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 01:29:33.3599 (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: AM6PR0302MB3191 Subject: [FFmpeg-devel] [PATCH 12/15] avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary references 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: KAePm8z/YX4R The packet given to muxers is not used afterwards; it is always unreferenced by libavformat. Ergo muxers are allowed to keep the references in the packets and e.g. move the ownership to a packet list. This is what this commit does. Signed-off-by: Andreas Rheinhardt --- libavformat/aiffenc.c | 2 +- libavformat/flacenc.c | 2 +- libavformat/movenc.c | 4 +++- libavformat/mp3enc.c | 3 ++- libavformat/ttaenc.c | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 24bc17400e..7bb0978a53 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -219,7 +219,7 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; return avpriv_packet_list_put(&aiff->pict_list, &aiff->pict_list_end, - pkt, av_packet_ref, 0); + pkt, NULL, 0); } return 0; diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index f884e5d2c8..e8f043729e 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -360,7 +360,7 @@ static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) if (pkt->stream_index == c->audio_stream_idx) { if (c->waiting_pics) { /* buffer audio packets until we get all the pictures */ - ret = avpriv_packet_list_put(&c->queue, &c->queue_end, pkt, av_packet_ref, 0); + ret = avpriv_packet_list_put(&c->queue, &c->queue_end, pkt, NULL, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Out of memory in packet queue; skipping attached pictures\n"); c->waiting_pics = 0; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index fc309fb416..033a6a9f52 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6197,9 +6197,11 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EINVAL); } + /* The following will reset pkt and is only allowed to be used + * because we return immediately. afterwards. */ if ((ret = avpriv_packet_list_put(&trk->squashed_packet_queue, &trk->squashed_packet_queue_end, - pkt, av_packet_ref, 0)) < 0) { + pkt, NULL, 0)) < 0) { return ret; } diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 71e96a8651..0ffc79c025 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -524,7 +524,8 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt) if (pkt->stream_index == mp3->audio_stream_idx) { if (mp3->pics_to_write) { /* buffer audio packets until we get all the pictures */ - int ret = avpriv_packet_list_put(&mp3->queue, &mp3->queue_end, pkt, av_packet_ref, 0); + int ret = avpriv_packet_list_put(&mp3->queue, &mp3->queue_end, + pkt, NULL, 0); if (ret < 0) { av_log(s, AV_LOG_WARNING, "Not enough memory to buffer audio. Skipping picture streams\n"); diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c index 11855c32d9..5f21fdc144 100644 --- a/libavformat/ttaenc.c +++ b/libavformat/ttaenc.c @@ -95,10 +95,11 @@ static int tta_write_packet(AVFormatContext *s, AVPacket *pkt) int ret; ret = avpriv_packet_list_put(&tta->queue, &tta->queue_end, pkt, - av_packet_ref, 0); + NULL, 0); if (ret < 0) { return ret; } + pkt = &tta->queue_end->pkt; avio_wl32(tta->seek_table, pkt->size); tta->nb_samples += pkt->duration; From patchwork Thu Dec 16 01:29:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32650 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp407950iog; Wed, 15 Dec 2021 17:30:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGMZSqT/NoJiZePIsVNNnsrtQiz4sV0iKU74A9kx3Yb+WsvEZUOJA4VxFXW3gSQ6QfZHeR X-Received: by 2002:a05:6402:11cb:: with SMTP id j11mr18709402edw.38.1639618217630; Wed, 15 Dec 2021 17:30:17 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hp34si3522240ejc.640.2021.12.15.17.29.59; Wed, 15 Dec 2021 17:30:17 -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=@outlook.com header.s=selector1 header.b=s2SWdvVj; 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 3DF0E68AE3E; Thu, 16 Dec 2021 03:29:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2048.outbound.protection.outlook.com [40.92.89.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D8EED689FD9 for ; Thu, 16 Dec 2021 03:29:42 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mwy4uuOc/FXIpxQzLlLgd5U8YLJVfhXTQ/JHJTPs2y+Yw/vfnwk0Xa32ntQPTK4APlPP6gAnfq99MfqgOcw0rYwE/ji3pGzk/Z9PqXdjQmT4baOeeRXoVzy5tVScd7MMlvKy9zvrvrGh+JAyZghUQNSoeM0vO3xEI4Gvr0qAvr4oxx4ibzsknJoxu2ukNshxOqRlQ5TMFRlyNiIUr8MRbghgZeyeono91yPva6NC2FnyTsspBNzDnQHH6hmi2M6sBuCG5Xx+UaJfIsxrrrBe9d05/YxzHFaUy0Tw0GuWo+DpMVuPXxgmn59MlmfIkCg63FFjrdyQbLQcKidBfa4wZA== 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=VK0UKfsFcSImUincDhrCqbhflOcCXykAfOClxHICXpY=; b=akmN5Bq9SMcwzQZpzqYR1STSBDxVXoGqCZqtOlhhRkmidSi/+K/okjSWeG229NdV/lyo8mXQO8JdFKZYeI6ootr8QLkwcSRzIDCMwSrscc4x/RFP4AwB979VSTrL9qjpBjI7jkPrlE2av8InFD4AqsvsIdTWw2EnaOfj1yXarizZmq2XBKqQOL95N6BG0Vvlgrk6lK5ECnXFC6t04SIHch4hNkoUQu9zqCQ7eAU5LdOw87dRTaMtnw+IYj8NqZuenxBOjbkKsm4Gbg2CJmqXj6hheQH0t36tsZjwBRUju/G7oXDlLS83Wqlaauh/PR0aVSSMdm2Syca+sou5W94zQA== 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=VK0UKfsFcSImUincDhrCqbhflOcCXykAfOClxHICXpY=; b=s2SWdvVjbMvvUkoOtEvaSnxtDReWqIzwB2E8PPYdlQv12KPEOce9avBNKufKbllnyN20sl39srsArPBo2fC711uR3YxJgRE3aSaf3s1n53KyhKsVDvAHoI+iCBUiUKtktycR0L0U18R7r+BfTELSpRtT1APN1YGnRxoKJaD7jWgVUIpLUzTZGFpzUy2iL27wjM34ShppD+5UeqLA1KH2CGMEzz8SjgresaigAIqyMwasXAY0dU/ti+G5x8dLPj2eKoYrKBPqMDY8vByIiK8jE/veD9rnW96FYY7MC9A8aQgpahCG/D5s/DkaYUif5NKDeqzMpIusJQspmRz+RI90Sg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6628.eurprd03.prod.outlook.com (2603:10a6:20b:1bf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Thu, 16 Dec 2021 01:29:41 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Thu, 16 Dec 2021 01:29:41 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Dec 2021 02:29:21 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [0OMULZcg1gNCEqa/Aqvk2PwPSjpVxaGA] X-ClientProxiedBy: AM9P192CA0004.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211216012923.404907-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3288af3e-d7d1-4577-64dd-08d9c033882d X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEuBoyQUf2rHPVuupI3Je4ybRM0LTOFTQtJXzsNbXM55m11NHUygSEeBPbgGytUi4IoOS3et8DNjOqJYo7+900sjFGErWm632fdS6VyAsn/e6UO7kLPK9nJeQNwHWjJN0h63+TSCPdvecI/O1XC3cV/Hdwob2vGi8HScVTGNktHeCca/NQT+SfP5UYlIyxqXeJJoTlJ4qfepBBHQ8nF7yJ0zkfj+RM34dUJBJ/BuR16xQPFYxoNxU9aaC+EyQx5itDjGKEqzlzpn1iAlfbXC1+/TXZN7+M+jNTeunt2qHx5gimgVE7TV2RgQU+z1sYF+KR3U2aIRCztRlUhf+3/tJzzcVOrn7RXaUDj4dB8d/icpyceGyjwz6yZEWKtqsTDTZmqVjR/PXWXvXvN4+vpijMrGWZRU2McIDCuk79D3EW09itPCk/nYyJK3QbS28FRL1z/UDDByvGUtHJOdfdobVcpvqEsEIo6OKmIgMcgRQVbzssqHKDzsztzGKs0og8hC096QazCdfHADsB0aE0kA2GJKrhdUwUm+I2UGSfTTXDyeNNLlooOyDtK4pEaZKsCx7n2eHvVxVry8Xa5laJJ50gD2LLcXW24+fc8C9mfq8hbqzDsdGzkWR7kVo7e4Mq+SRRRS7lJatMl5Yn2CsvYTReZ601e2b6xqMI4qkA5U+QByZJ2NLValOOujfNGTJXCFNE02LrRNksaf1MFCftPqmpDjyN1BCnV02B4AASevD7rRwURSijHSkIco685FRTgwqzxOREDv1SYs+BdlYf9v9xV3 X-MS-TrafficTypeDiagnostic: AM7PR03MB6628:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z7jpEqzNYhtS6tgpOXbmKG9kIkyKNLeCSiCUn9A+XZrQ7wVnissAwQAh313gju+aUN1rWN5/cOIIWIQEVgBaLx9L5oIk3H+kuPPOe72J4mJh1cZ+7D2cSi1YCFi7DIGNwpQUroeXDTwlGVfKowZHqpAvEdfrloqBcDW7aPA8my902xqRpLwzx0AIKlpvZv2ztJBusgs8f2wOzkSRiqfDfIdl9TKRBKH1IOgB9zxI2Qp+hDyr8/Vp2eTKNPvXYGRoGd3b+AE8+GMLmWeab1yaAQBtldFF1tXy8P7AK088iA1eXOrFL5r21WU+4FDlFXMQ8W9CG+V/2DyBG9cXtRC5TqGipHxmhC/oQ9u2A8gwUSeihHZmEPFimlifQia25+VEpg2iBOXWXY39dUwKdsJe2C9/3rHiqV4UvEfDkRuGdFAGBKLCOQ2QlLiSr0T/7tQ7mwguD2I2a9LSPzlRvCybcwj8xkfqkX/FDqBl6U+FB0uMMBwaBRlthkrfpopjHuZg6c9WInqc9PKBdhtSb5a3WnsPp4PPeo6/BRZqcAjmkevceOKnv09xLk0UaAie2e5qs1n3+8wDVTuNQ9WX3XVz5w== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TceH8xfrCwPhqJQzNlCpFqaaRbNanFejgL8MvP7K8yTvFYQT2MlEgJD9vX/4qVUG6oV7iF3ZoIZUfHPn+uQTsiIVAU0ktcCI4LEadwmLOeHs3SKxK5UF61JzkDPX4NoPoTzIcChfFLvQC56DmJcTcSd2aZShw8D5nirW0XUAqatYhWST1jLMV4YLHd0SJQ7jYeQ1OHDSnK/5miEa+w0GahhJXaC1YLW9NVpqscQvIF/YOsCOSvYJQBX1Lsid1dHyODuzX74vR58+BVZZVXVRdtxwTfOd3tGI1kOOL9WKAR9/010rUMZ9vhg/44Lu7OW2bI2iN2O22dC6/pfuqvXqGCRoYW4ajaV/HemTwFSe2QK2ZzcrCPhaGCoUBaViCsVLHrvt5wblo2AOuNu3xATLP4AeLN9KXqLdD2FYmJqC3lkTVbFrR8T7FJCQ5ylYX+mLicIJpCzg/ZAa4FVaCRayfUKvxaN70kXyiGZGd1NPJgRroWF+OhKAqJQYpmNRwqG2Cv3oWhMyHlXqSnuA0hoUkCdM9ts6bTWoqMjgR9SOWH7bEdf2wKvg4oaJhdz2cY/ZIb6j970clwVIl3spdWQ5ahS9h08As9InjqHQp2TNjjty51xAiqgw/j+WYP/ugZATYhZK0pTG2NGbEGCfLo+zWHWyxCFe8PhbDEi1wHt6su4iOHE4cL0oig0pR02gvBvl3NRfK9u46L05bfG2SLYGIOOGpSAlKE96LQuWs5FHqPw++LU5A8e9K0NoKroOOR+Tk1OF676z32yqm8oagqEz7dgzDaECeoT4MoNEQ67Mw9egtYZ2LE8Ibp6SoeTMb40ej0ZbnfHbVS3JCGNvAr5UmXs9/zC4IIGhu6McXUGkjHnOV8+1DhBJFEF616vyevb53RbC3XfuUcxeYbdTDLymKYNg7U4Auqze1DVz/XAkL4GAj3M/zpelJwsKWuaax9cxpqZu7VNQSVKdVGSiIAR0zg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3288af3e-d7d1-4577-64dd-08d9c033882d X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 01:29:41.2520 (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: AM7PR03MB6628 Subject: [FFmpeg-devel] [PATCH 13/15] avformat/mux, mxfenc: Don't use sizeof(AVPacket) 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: rqo7ZtKKZd0y This removes the last usage of sizeof(AVPacket) in the generic muxing code. Signed-off-by: Andreas Rheinhardt --- libavformat/mux.c | 8 +------- libavformat/mxfenc.c | 8 ++------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/libavformat/mux.c b/libavformat/mux.c index b9c4abb9cf..0500f636de 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1014,15 +1014,9 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, AVStream *const st = s->streams[pktl->pkt.stream_index]; FFStream *const sti = ffstream(st); - *pkt = pktl->pkt; - - si->packet_buffer = pktl->next; - if (!si->packet_buffer) - si->packet_buffer_end = NULL; - if (sti->last_in_packet_buffer == pktl) sti->last_in_packet_buffer = NULL; - av_freep(&pktl); + avpriv_packet_list_get(&si->packet_buffer, &si->packet_buffer_end, pkt); return 1; } else { diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 00bbe58149..7635e183d0 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -3125,14 +3125,10 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, int flus pktl = si->packet_buffer; } - *out = pktl->pkt; - av_log(s, AV_LOG_TRACE, "out st:%d dts:%"PRId64"\n", (*out).stream_index, (*out).dts); - si->packet_buffer = pktl->next; if (ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer == pktl) ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer = NULL; - if (!si->packet_buffer) - si->packet_buffer_end = NULL; - av_freep(&pktl); + avpriv_packet_list_get(&si->packet_buffer, &si->packet_buffer_end, out); + av_log(s, AV_LOG_TRACE, "out st:%d dts:%"PRId64"\n", out->stream_index, out->dts); return 1; } else { out: From patchwork Thu Dec 16 01:29:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32649 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp407894iog; Wed, 15 Dec 2021 17:30:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUTZosHaJ8ZxlYWHvFOZCYGOg8gJqTxzRij5ps9+YOSBqxMXJXLxFkfMo9PVHXvLjZO66b X-Received: by 2002:a05:6402:d49:: with SMTP id ec9mr18079447edb.235.1639618213182; Wed, 15 Dec 2021 17:30:13 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hc11si2730889ejc.77.2021.12.15.17.30.12; Wed, 15 Dec 2021 17:30:13 -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=@outlook.com header.s=selector1 header.b=Aa70R+vp; 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 657B568AEA5; Thu, 16 Dec 2021 03:29:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2048.outbound.protection.outlook.com [40.92.89.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 06A4368A2EC for ; Thu, 16 Dec 2021 03:29:48 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C1Fppm319MlLuLOVRRlw6hivTZ4uJNdLLUGqnhV7k8e2GzIjpBtfTUJN7HatRpr3RQbZuytHp8pN7VFSXUTtomK3KCrl3KKOXbmWBTJMx0hjeRS3LedfIgbRGZBmpSZ3YRXhi58yuZ8a+h6Lyy0ad3XEst3m5v2J7Th/O/OKbPf2Rtb8+CFirbVILItR1Gqlr0tkds9a14DNe2vQe7xlGta8XKuofC45/K+JyXp/Z7annWfD3OYh9zhbm1CrD7o0tmzE3fNKt39qnB+tHBmLTXJsruX44+woqg3Y8Cvt1uEojCqFEQuMMH1pcPjwHNopKijJ3CKFy4MwcpDFpel//g== 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=4KsgBepOD/88YE1OToZMUmVWlwmpQf8AwT3d+Ckj/5k=; b=ORO6gM1BjWYC1/vmYT58G8AI05kaU3ZFVmG9ZKqhXDKjEvQYsF8U9LC3TsDc9mX0pXPUoKLyl2Dg/EP41mqGdIvkO49/ngLRNYnQCZ0wkr+d3z4LbZXLNgfxgvPlgzgTZBoJxE9yVjFFbxspg+1mYIbyoULwtLwi/72ykh3oiHo5pLGYIQOwRQZs2Mx8zPrDQTNmVHoW2+9wQD8POAzrTOaXi6fkjSBu7CYBHrMnGoGEcncOT7c7lkGv80+rypcxzYnqjqlTAmdDuaK6TnqvrKG60DRujhoqBET2c9DnbkdS3vu7gtUgYqBWah8IohVUg+2vUYn/jnLvgKuwDQVYVA== 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=4KsgBepOD/88YE1OToZMUmVWlwmpQf8AwT3d+Ckj/5k=; b=Aa70R+vp/R3Wg56J2xmakEq3uB8QXSQRBVDWWR9rYlMmpvS+s+vjp+LMfj3/vgU4ZjBxelzfIxkWB2MK5+Q29mGpL+mMKSg+v4mxuARPH38l8HcSYxycYS9yHFYnPZEZrg5zUr6ziGIPV8xifGbBrKFQW+nyXW5qlUKHqyWI0Xz9j16dKXjUE+LwALAp6CLR651PWJKKerKUF75h41bwsr0/rKkUAVpCJNHzEqEMF6bYm+fbE17ew7b8RV83tD3PrpEcpbjVh25oHA2CiQPIx3qE8HEhhgaGDfsRRPESSGpI4V/mLotOOzVBU+ot4ahuaLl/0LSiO7FXhEwKMsXzow== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6628.eurprd03.prod.outlook.com (2603:10a6:20b:1bf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Thu, 16 Dec 2021 01:29:44 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Thu, 16 Dec 2021 01:29:44 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Dec 2021 02:29:22 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [opkt5HsZDyvPofbgXhDAqxQqhmNE8APz] X-ClientProxiedBy: AM9P192CA0004.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211216012923.404907-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 130ff5a2-3235-46a6-0fde-08d9c0338a33 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JcIiuww9EzdDvfVodD9T5t/ifuq8zGhd8z6MyiZR+Ten+22aWXlDfW+mQAM1rnILrvlQsfAd1P+ZTiWvWjqoAA5dYJ8mGtsE5jSPDiq2f50NunoFAM4sdfvkPSwlqdN/bQpAKCBnzt4fX/bH9b1xKM4smZZKoK10DoYEvHkWLaDQ31KqaE/40QiIwgBXdOPKlo6KxOduyL+00TXJtZ0QMhkwvAuChzVduiaAtLlxl+Sy9MwKn3QhXI3p/KVgSsWNxNc/i1Hv3TEE+n12rpkSy14+VoPcCCpAuQ5kKuS82Iui6fuf09EcCSvrwEiGU6Ej5SRgIHGVtMfGdFaYLQtym/uHATqilXqQca+xk/iDdWPa9J4W3+/NDXsopcUgRujxCHBG4uiL0cFJpGdZw0PhusXgZrH/of9KTQrFY/WI/hW6uMKa4pSOaApsCLCelNRPzlN1YGtebyXywE15Du6Rr8Tr0szVc3RVDd4m9Y07JtDqu0GqseeMgtLARVIhsMUZTmtSU0Jt1OhlLHh27yb9CAeE7B95ceOuhrehBiTRIIy5aLyRUl2t+8nextp80cp4J5beQdzAI4eYdNTgdVsrwji4UaFqaIlIePLQBJmnBNF1vJeKTCbsLJsDfKJbPqIBYfLEOoByrvzKS4Xf5QZJJQJCD+mJ3hZVUei1lWGP31ZeKi1gV4KsGdOfdWSyz370w/V/1P//Ch2uFeBkdJqQxt7sKw4E2Flsv3bUli1zbqTs= X-MS-TrafficTypeDiagnostic: AM7PR03MB6628:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 966NAyKXt2oQQNsurwi04XKTP9lPSiMila5dqAxM0tZ+9a4y7kd7vyrRWfSm1eeecD/cYDONh/5lpnNs84DGND5Pm2EdGTf8wyEBlWIvgr40nPcH9+p2CnIvw3OkUu6zipHNae+HtRdSbCn8YR0pe8hWtHMntCrEKRG1EU9f7Iku5h5znOxGsJVJeBS4r3KG55x4yfj0ReJlKQt3EB7+cuE8MJpNx5CfcCbcXI4UoqeAQEvBqGhmZVyIFwVveBYTh8NetesU5Az2WAqjo2Nn5t33ycehG3jIME2XoFIUbrwAgxmuXkb5jz5SsLkp5VdXZ8bBlda9y866BOqqGF1kQlDXmxOg61y1SU8ARWDSCx0Rk3OU6Jmx0Xqb2X/pVaW8bHjM/ikSuUWYGtBBoMljaRmZd8PORUiAkDI63UyJVZa9rYax1LZOkgY5NUsFoitJq985IkxoAYLQw+YtzzmSzbuJjtc82VUVUSCqK2AZWpml5LazlJj+TuLCuKsgli0JiLSi6ME3fvj4QqZ8x33sCWSLPeehuK9G1J/mG1c54YjCdCOOJjBZFmSx3KYhwSG9J8aZvxgo+3L8jD/MwJAhpQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bkSHh4hGCFxTXxPbR6qYjpucZxubSRCaVgKi0SNEHqrwBsiz4M1D+Wts/YtYT/cfS7ogjjgFwl+DXnssLnZMFHFCRiNjyMv8v0aytsG1TFQWcsy6YvQQkpXPJ9MPtg5AKq6U5TrT5ld5wS7a3ngONhIb0aR5+IheZGpXubLEsmOR7NP3ZD1UQC43+hW2REsc9RXMsQVz85/6VE9u9VAm+eCCpiXjL2LwEFD3gUzEV0ot2z5fZHLWjQCQagMSQYz4Dipw7Zlbzkip5LbARq+EWHP07qo7xlqNKq37/zcFeY4WxLxiSEnD+A9c4u5CYJ7PkKqPvO6jAWuR8ReZZWOSuY0aPmJsJtb5tfFDMyh9MEkryt2fX0tNxFgUxRGB/0KRqoW6BoI3ipZ39cVfxZphXiwNn9m2AXo7tbDFGML0wkvEBIomYg7P/NliimGciGsV9JWBUDSmV+drrpbF8SwZXiw47ZI0aDoaMAys9GVs/6AngPPZiyMcs1XerXuAquSWzvbk1Sw/MyJKgA7rMo3EbN5AS8VOsxJAWpvrE82Q97YHzq/MASrUBgaAP//GxZPFMY1kMDFItxaT1vWja6R6/vN021R4vN+2BZH1g2XcW/CwzXyrJi5UBZsnvTuEXjMgVFQFdkYx2BTS13N74BVvVjN6Iom6ekxYwDpQwK318LE0QslRmKAV9Z3fL2KItqsOUN/EhXoDhzoZlz7UEfW2oJbLVBhPmNEv4h941wX6ul7csTE65/TXS3+XT0IfwmqEuiDPYQvE/1yOQTW/04akyz6dBLnZ7Ef6O8sgnXPZjHfweWcv9T1XPgnBhPpC7JTXfzVHAzu2R+L9T/62QiYvZM5ITz3FYK3esTUw3M5IlUlQvSiaPfN3DWhLVf84TGaV3XXD1vkJf8UvwiMHe0eMrW+gqCXjCfBSwy06Wt2230PF8IPfcNLJu3NaXNvQQ6fMXI87FFhmEoJsUCyeC5zOQw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 130ff5a2-3235-46a6-0fde-08d9c0338a33 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 01:29:44.8321 (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: AM7PR03MB6628 Subject: [FFmpeg-devel] [PATCH 14/15] avcodec/packet_internal: Add proper PacketList struct 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: GPHeN+8zgHiW Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt --- One can unavpriv these functions by using AVPacket.opaque as next pointer. Shall I do so? libavcodec/avpacket.c | 36 +++++++++++------------ libavcodec/packet_internal.h | 25 +++++++--------- libavdevice/decklink_common.h | 5 +++- libavdevice/decklink_dec.cpp | 29 +++++++++---------- libavdevice/dshow.c | 10 +++---- libavdevice/dshow_capture.h | 2 +- libavdevice/vfwcap.c | 12 ++++---- libavformat/aiffenc.c | 17 ++++++----- libavformat/demux.c | 54 ++++++++++++++++------------------- libavformat/flacenc.c | 10 +++---- libavformat/internal.h | 12 ++++---- libavformat/matroskadec.c | 19 ++++++------ libavformat/movenc.c | 8 ++---- libavformat/movenc.h | 2 +- libavformat/movenc_ttml.c | 6 ++-- libavformat/mp3enc.c | 11 ++++--- libavformat/mux.c | 38 ++++++++++++------------ libavformat/mxfenc.c | 14 ++++----- libavformat/ttaenc.c | 13 ++++----- libavformat/utils.c | 7 ++--- 20 files changed, 154 insertions(+), 176 deletions(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index a0134e405c..4f7a6b255c 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -535,13 +535,12 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb) pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb); } -int avpriv_packet_list_put(PacketList **packet_buffer, - PacketList **plast_pktl, +int avpriv_packet_list_put(PacketList *packet_buffer, AVPacket *pkt, int (*copy)(AVPacket *dst, const AVPacket *src), int flags) { - PacketList *pktl = av_malloc(sizeof(PacketList)); + PacketListEntry *pktl = av_malloc(sizeof(*pktl)); int ret; if (!pktl) @@ -565,44 +564,41 @@ int avpriv_packet_list_put(PacketList **packet_buffer, pktl->next = NULL; - if (*packet_buffer) - (*plast_pktl)->next = pktl; + if (packet_buffer->head) + packet_buffer->tail->next = pktl; else - *packet_buffer = pktl; + packet_buffer->head = pktl; /* Add the packet in the buffered packet list. */ - *plast_pktl = pktl; + packet_buffer->tail = pktl; return 0; } -int avpriv_packet_list_get(PacketList **pkt_buffer, - PacketList **pkt_buffer_end, +int avpriv_packet_list_get(PacketList *pkt_buffer, AVPacket *pkt) { - PacketList *pktl; - if (!*pkt_buffer) + PacketListEntry *pktl = pkt_buffer->head; + if (!pktl) return AVERROR(EAGAIN); - pktl = *pkt_buffer; *pkt = pktl->pkt; - *pkt_buffer = pktl->next; - if (!pktl->next) - *pkt_buffer_end = NULL; + pkt_buffer->head = pktl->next; + if (!pkt_buffer->head) + pkt_buffer->tail = NULL; av_freep(&pktl); return 0; } -void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end) +void avpriv_packet_list_free(PacketList *pkt_buf) { - PacketList *tmp = *pkt_buf; + PacketListEntry *tmp = pkt_buf->head; while (tmp) { - PacketList *pktl = tmp; + PacketListEntry *pktl = tmp; tmp = pktl->next; av_packet_unref(&pktl->pkt); av_freep(&pktl); } - *pkt_buf = NULL; - *pkt_buf_end = NULL; + pkt_buf->head = pkt_buf->tail = NULL; } int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type) diff --git a/libavcodec/packet_internal.h b/libavcodec/packet_internal.h index a10931c106..92a0d4e6d5 100644 --- a/libavcodec/packet_internal.h +++ b/libavcodec/packet_internal.h @@ -23,16 +23,19 @@ #include "packet.h" -typedef struct PacketList { - struct PacketList *next; +typedef struct PacketListEntry { + struct PacketListEntry *next; AVPacket pkt; +} PacketListEntry; + +typedef struct PacketList { + PacketListEntry *head, *tail; } PacketList; /** * Append an AVPacket to the list. * - * @param head List head element - * @param tail List tail element + * @param list A PacketList * @param pkt The packet being appended. The data described in it will * be made reference counted if it isn't already. * @param copy A callback to copy the contents of the packet to the list. @@ -41,8 +44,7 @@ typedef struct PacketList { * @return 0 on success, negative AVERROR value on failure. On failure, the packet and the list are unchanged. */ -int avpriv_packet_list_put(PacketList **head, PacketList **tail, - AVPacket *pkt, +int avpriv_packet_list_put(PacketList *list, AVPacket *pkt, int (*copy)(AVPacket *dst, const AVPacket *src), int flags); @@ -52,22 +54,17 @@ int avpriv_packet_list_put(PacketList **head, PacketList **tail, * @note The pkt will be overwritten completely on success. The caller * owns the packet and must unref it by itself. * - * @param head List head element - * @param tail List tail element + * @param head A pointer to a PacketList struct * @param pkt Pointer to an AVPacket struct * @return 0 on success, and a packet is returned. AVERROR(EAGAIN) if * the list was empty. */ -int avpriv_packet_list_get(PacketList **head, PacketList **tail, - AVPacket *pkt); +int avpriv_packet_list_get(PacketList *list, AVPacket *pkt); /** * Wipe the list and unref all the packets in it. - * - * @param head List head element - * @param tail List tail element */ -void avpriv_packet_list_free(PacketList **head, PacketList **tail); +void avpriv_packet_list_free(PacketList *list); int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type); diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h index 5b11dcd46d..79d6ac5b38 100644 --- a/libavdevice/decklink_common.h +++ b/libavdevice/decklink_common.h @@ -29,6 +29,9 @@ #define IDeckLinkProfileAttributes IDeckLinkAttributes #endif +extern "C" { +#include "libavcodec/packet_internal.h" +} #include "libavutil/thread.h" #include "decklink_common_c.h" #if CONFIG_LIBKLVANC @@ -75,7 +78,7 @@ class decklink_output_callback; class decklink_input_callback; typedef struct AVPacketQueue { - PacketList *first_pkt, *last_pkt; + PacketList pkt_list; int nb_packets; unsigned long long size; int abort_request; diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 491fe4be3d..c97a72d93d 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -483,16 +483,16 @@ static void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q) static void avpacket_queue_flush(AVPacketQueue *q) { - PacketList *pkt, *pkt1; + PacketListEntry *pkt, *pkt1; pthread_mutex_lock(&q->mutex); - for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { + for (pkt = q->pkt_list.head; pkt != NULL; pkt = pkt1) { pkt1 = pkt->next; av_packet_unref(&pkt->pkt); av_freep(&pkt); } - q->last_pkt = NULL; - q->first_pkt = NULL; + q->pkt_list.head = NULL; + q->pkt_list.tail = NULL; q->nb_packets = 0; q->size = 0; pthread_mutex_unlock(&q->mutex); @@ -516,7 +516,7 @@ static unsigned long long avpacket_queue_size(AVPacketQueue *q) static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) { - PacketList *pkt1; + PacketListEntry *pkt1; // Drop Packet if queue size is > maximum queue size if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { @@ -530,7 +530,7 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) return -1; } - pkt1 = (PacketList *)av_malloc(sizeof(PacketList)); + pkt1 = (PacketListEntry *)av_malloc(sizeof(*pkt1)); if (!pkt1) { av_packet_unref(pkt); return -1; @@ -540,13 +540,13 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) pthread_mutex_lock(&q->mutex); - if (!q->last_pkt) { - q->first_pkt = pkt1; + if (!q->pkt_list.tail) { + q->pkt_list.head = pkt1; } else { - q->last_pkt->next = pkt1; + q->pkt_list.tail->next = pkt1; } - q->last_pkt = pkt1; + q->pkt_list.tail = pkt1; q->nb_packets++; q->size += pkt1->pkt.size + sizeof(*pkt1); @@ -558,17 +558,16 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) static int avpacket_queue_get(AVPacketQueue *q, AVPacket *pkt, int block) { - PacketList *pkt1; int ret; pthread_mutex_lock(&q->mutex); for (;; ) { - pkt1 = q->first_pkt; + PacketListEntry *pkt1 = q->pkt_list.head; if (pkt1) { - q->first_pkt = pkt1->next; - if (!q->first_pkt) { - q->last_pkt = NULL; + q->pkt_list.head = pkt1->next; + if (!q->pkt_list.head) { + q->pkt_list.tail = NULL; } q->nb_packets--; q->size -= pkt1->pkt.size + sizeof(*pkt1); diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index ec1501ef8e..2baf85857d 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -58,7 +58,7 @@ static int dshow_read_close(AVFormatContext *s) { struct dshow_ctx *ctx = s->priv_data; - PacketList *pktl; + PacketListEntry *pktl; if (ctx->control) { IMediaControl_Stop(ctx->control); @@ -118,7 +118,7 @@ dshow_read_close(AVFormatContext *s) pktl = ctx->pktl; while (pktl) { - PacketList *next = pktl->next; + PacketListEntry *next = pktl->next; av_packet_unref(&pktl->pkt); av_free(pktl); pktl = next; @@ -162,7 +162,7 @@ callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e { AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; - PacketList **ppktl, *pktl_next; + PacketListEntry **ppktl, *pktl_next; // dump_videohdr(s, vdhdr); @@ -171,7 +171,7 @@ callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, e if(shall_we_drop(s, index, devtype)) goto fail; - pktl_next = av_mallocz(sizeof(PacketList)); + pktl_next = av_mallocz(sizeof(*pktl_next)); if(!pktl_next) goto fail; @@ -1254,7 +1254,7 @@ static int dshow_check_event_queue(IMediaEvent *media_event) static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) { struct dshow_ctx *ctx = s->priv_data; - PacketList *pktl = NULL; + PacketListEntry *pktl = NULL; while (!ctx->eof && !pktl) { WaitForSingleObject(ctx->mutex, INFINITE); diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h index 06ded2ba96..8f9f0b5245 100644 --- a/libavdevice/dshow_capture.h +++ b/libavdevice/dshow_capture.h @@ -321,7 +321,7 @@ struct dshow_ctx { HANDLE mutex; HANDLE event[2]; /* event[0] is set by DirectShow * event[1] is set by callback() */ - PacketList *pktl; + PacketListEntry *pktl; int eof; diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 6fad466f8a..86a40b4af4 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -45,7 +45,7 @@ struct vfw_ctx { HWND hwnd; HANDLE mutex; HANDLE event; - PacketList *pktl; + PacketListEntry *pktl; unsigned int curbufsize; unsigned int frame_num; char *video_size; /**< A string describing video size, set by a private option. */ @@ -179,7 +179,7 @@ static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr) { AVFormatContext *s; struct vfw_ctx *ctx; - PacketList **ppktl, *pktl_next; + PacketListEntry **ppktl, *pktl_next; s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA); ctx = s->priv_data; @@ -191,7 +191,7 @@ static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr) WaitForSingleObject(ctx->mutex, INFINITE); - pktl_next = av_mallocz(sizeof(PacketList)); + pktl_next = av_mallocz(sizeof(*pktl_next)); if(!pktl_next) goto fail; @@ -220,7 +220,7 @@ fail: static int vfw_read_close(AVFormatContext *s) { struct vfw_ctx *ctx = s->priv_data; - PacketList *pktl; + PacketListEntry *pktl; if(ctx->hwnd) { SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0); @@ -234,7 +234,7 @@ static int vfw_read_close(AVFormatContext *s) pktl = ctx->pktl; while (pktl) { - PacketList *next = pktl->next; + PacketListEntry *next = pktl->next; av_packet_unref(&pktl->pkt); av_free(pktl); pktl = next; @@ -440,7 +440,7 @@ fail: static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt) { struct vfw_ctx *ctx = s->priv_data; - PacketList *pktl = NULL; + PacketListEntry *pktl = NULL; while(!pktl) { WaitForSingleObject(ctx->mutex, INFINITE); diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 7bb0978a53..1fd6b8a70b 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -37,7 +37,7 @@ typedef struct AIFFOutputContext { int64_t frames; int64_t ssnd; int audio_stream_idx; - PacketList *pict_list, *pict_list_end; + PacketList pict_list; int write_id3v2; int id3v2_version; } AIFFOutputContext; @@ -48,9 +48,9 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff) uint64_t pos, end, size; ID3v2EncContext id3v2 = { 0 }; AVIOContext *pb = s->pb; - PacketList *pict_list = aiff->pict_list; + PacketListEntry *list_entry = aiff->pict_list.head; - if (!s->metadata && !s->nb_chapters && !aiff->pict_list) + if (!s->metadata && !s->nb_chapters && !list_entry) return 0; avio_wl32(pb, MKTAG('I', 'D', '3', ' ')); @@ -59,10 +59,10 @@ static int put_id3v2_tags(AVFormatContext *s, AIFFOutputContext *aiff) ff_id3v2_start(&id3v2, pb, aiff->id3v2_version, ID3v2_DEFAULT_MAGIC); ff_id3v2_write_metadata(s, &id3v2); - while (pict_list) { - if ((ret = ff_id3v2_write_apic(s, &id3v2, &pict_list->pkt)) < 0) + while (list_entry) { + if ((ret = ff_id3v2_write_apic(s, &id3v2, &list_entry->pkt)) < 0) return ret; - pict_list = pict_list->next; + list_entry = list_entry->next; } ff_id3v2_finish(&id3v2, pb, s->metadata_header_padding); @@ -218,8 +218,7 @@ static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) if (s->streams[pkt->stream_index]->nb_frames >= 1) return 0; - return avpriv_packet_list_put(&aiff->pict_list, &aiff->pict_list_end, - pkt, NULL, 0); + return avpriv_packet_list_put(&aiff->pict_list, pkt, NULL, 0); } return 0; @@ -265,7 +264,7 @@ static void aiff_deinit(AVFormatContext *s) { AIFFOutputContext *aiff = s->priv_data; - avpriv_packet_list_free(&aiff->pict_list, &aiff->pict_list_end); + avpriv_packet_list_free(&aiff->pict_list); } #define OFFSET(x) offsetof(AIFFOutputContext, x) diff --git a/libavformat/demux.c b/libavformat/demux.c index 360abd6014..4316bed9c0 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -537,7 +537,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif for (;;) { - PacketList *pktl = si->raw_packet_buffer; + PacketListEntry *pktl = si->raw_packet_buffer.head; AVStream *st; FFStream *sti; const AVPacket *pkt1; @@ -548,8 +548,7 @@ FF_ENABLE_DEPRECATION_WARNINGS if ((err = probe_codec(s, st, NULL)) < 0) return err; if (ffstream(st)->request_probe <= 0) { - avpriv_packet_list_get(&si->raw_packet_buffer, - &si->raw_packet_buffer_end, pkt); + avpriv_packet_list_get(&si->raw_packet_buffer, pkt); si->raw_packet_buffer_size -= pkt->size; return 0; } @@ -624,13 +623,12 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; err = avpriv_packet_list_put(&si->raw_packet_buffer, - &si->raw_packet_buffer_end, pkt, NULL, 0); if (err < 0) { av_packet_unref(pkt); return err; } - pkt1 = &si->raw_packet_buffer_end->pkt; + pkt1 = &si->raw_packet_buffer.tail->pkt; si->raw_packet_buffer_size += pkt1->size; if ((err = probe_codec(s, st, pkt1)) < 0) @@ -716,13 +714,14 @@ static int has_decode_delay_been_guessed(AVStream *st) return sti->nb_decoded_frames >= 20; } -static PacketList *get_next_pkt(AVFormatContext *s, AVStream *st, PacketList *pktl) +static PacketListEntry *get_next_pkt(AVFormatContext *s, AVStream *st, + PacketListEntry *pktl) { FFFormatContext *const si = ffformatcontext(s); if (pktl->next) return pktl->next; - if (pktl == si->packet_buffer_end) - return si->parse_queue; + if (pktl == si->packet_buffer.tail) + return si->parse_queue.head; return NULL; } @@ -774,7 +773,7 @@ static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t * of the packets in a window. */ static void update_dts_from_pts(AVFormatContext *s, int stream_index, - PacketList *pkt_buffer) + PacketListEntry *pkt_buffer) { AVStream *const st = s->streams[stream_index]; int delay = ffstream(st)->avctx->has_b_frames; @@ -804,7 +803,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index, FFFormatContext *const si = ffformatcontext(s); AVStream *const st = s->streams[stream_index]; FFStream *const sti = ffstream(st); - PacketList *pktl = si->packet_buffer ? si->packet_buffer : si->parse_queue; + PacketListEntry *pktl = si->packet_buffer.head ? si->packet_buffer.head : si->parse_queue.head; uint64_t shift; @@ -823,7 +822,7 @@ static void update_initial_timestamps(AVFormatContext *s, int stream_index, if (is_relative(pts)) pts += shift; - for (PacketList *pktl_it = pktl; pktl_it; pktl_it = get_next_pkt(s, st, pktl_it)) { + for (PacketListEntry *pktl_it = pktl; pktl_it; pktl_it = get_next_pkt(s, st, pktl_it)) { if (pktl_it->pkt.stream_index != stream_index) continue; if (is_relative(pktl_it->pkt.pts)) @@ -856,7 +855,7 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, { FFFormatContext *const si = ffformatcontext(s); FFStream *const sti = ffstream(st); - PacketList *pktl = si->packet_buffer ? si->packet_buffer : si->parse_queue; + PacketListEntry *pktl = si->packet_buffer.head ? si->packet_buffer.head : si->parse_queue.head; int64_t cur_dts = RELATIVE_TS_BASE; if (sti->first_dts != AV_NOPTS_VALUE) { @@ -882,7 +881,7 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(sti->first_dts)); return; } - pktl = si->packet_buffer ? si->packet_buffer : si->parse_queue; + pktl = si->packet_buffer.head ? si->packet_buffer.head : si->parse_queue.head; sti->first_dts = cur_dts; } else if (sti->cur_dts != RELATIVE_TS_BASE) return; @@ -998,7 +997,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, } } - if (pkt->duration > 0 && (si->packet_buffer || si->parse_queue)) + if (pkt->duration > 0 && (si->packet_buffer.head || si->parse_queue.head)) update_initial_durations(s, st, pkt->stream_index, pkt->duration); /* Correct timestamps with byte offset if demuxers only have timestamps @@ -1195,7 +1194,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, compute_pkt_fields(s, st, sti->parser, out_pkt, next_dts, next_pts); ret = avpriv_packet_list_put(&si->parse_queue, - &si->parse_queue_end, out_pkt, NULL, 0); if (ret < 0) goto fail; @@ -1225,7 +1223,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) int ret, got_packet = 0; AVDictionary *metadata = NULL; - while (!got_packet && !si->parse_queue) { + while (!got_packet && !si->parse_queue.head) { AVStream *st; FFStream *sti; @@ -1338,8 +1336,8 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) } } - if (!got_packet && si->parse_queue) - ret = avpriv_packet_list_get(&si->parse_queue, &si->parse_queue_end, pkt); + if (!got_packet && si->parse_queue.head) + ret = avpriv_packet_list_get(&si->parse_queue, pkt); if (ret >= 0) { AVStream *const st = s->streams[pkt->stream_index]; @@ -1420,9 +1418,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) AVStream *st; if (!genpts) { - ret = si->packet_buffer - ? avpriv_packet_list_get(&si->packet_buffer, - &si->packet_buffer_end, pkt) + ret = si->packet_buffer.head + ? avpriv_packet_list_get(&si->packet_buffer, pkt) : read_frame_internal(s, pkt); if (ret < 0) return ret; @@ -1430,7 +1427,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) } for (;;) { - PacketList *pktl = si->packet_buffer; + PacketListEntry *pktl = si->packet_buffer.head; if (pktl) { AVPacket *next_pkt = &pktl->pkt; @@ -1463,15 +1460,14 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) // 3. the packets for this stream at the end of the files had valid dts. next_pkt->pts = last_dts + next_pkt->duration; } - pktl = si->packet_buffer; + pktl = si->packet_buffer.head; } /* read packet from packet buffer, if there is data */ st = s->streams[next_pkt->stream_index]; if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL && next_pkt->dts != AV_NOPTS_VALUE && !eof)) { - ret = avpriv_packet_list_get(&si->packet_buffer, - &si->packet_buffer_end, pkt); + ret = avpriv_packet_list_get(&si->packet_buffer, pkt); goto return_packet; } } @@ -1486,7 +1482,6 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) } ret = avpriv_packet_list_put(&si->packet_buffer, - &si->packet_buffer_end, pkt, NULL, 0); if (ret < 0) { av_packet_unref(pkt); @@ -2601,12 +2596,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) if (!(ic->flags & AVFMT_FLAG_NOBUFFER)) { ret = avpriv_packet_list_put(&si->packet_buffer, - &si->packet_buffer_end, pkt1, NULL, 0); if (ret < 0) goto unref_then_goto_end; - pkt = &si->packet_buffer_end->pkt; + pkt = &si->packet_buffer.tail->pkt; } else { pkt = pkt1; } @@ -2754,8 +2748,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) // EOF already reached while reading the stream above. // So continue with reoordering DTS with whatever delay we have. - if (si->packet_buffer && !has_decode_delay_been_guessed(st)) { - update_dts_from_pts(ic, stream_index, si->packet_buffer); + if (si->packet_buffer.head && !has_decode_delay_been_guessed(st)) { + update_dts_from_pts(ic, stream_index, si->packet_buffer.head); } } } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index e8f043729e..b267197ccc 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -40,7 +40,7 @@ typedef struct FlacMuxerContext { int audio_stream_idx; int waiting_pics; /* audio packets are queued here until we get all the attached pictures */ - PacketList *queue, *queue_end; + PacketList queue; /* updated streaminfo sent by the encoder at the end */ uint8_t streaminfo[FLAC_STREAMINFO_SIZE]; @@ -306,8 +306,8 @@ static int flac_queue_flush(AVFormatContext *s) if (ret < 0) write = 0; - while (c->queue) { - avpriv_packet_list_get(&c->queue, &c->queue_end, pkt); + while (c->queue.head) { + avpriv_packet_list_get(&c->queue, pkt); if (write && (ret = flac_write_audio_packet(s, pkt)) < 0) write = 0; av_packet_unref(pkt); @@ -347,7 +347,7 @@ static void flac_deinit(struct AVFormatContext *s) { FlacMuxerContext *c = s->priv_data; - avpriv_packet_list_free(&c->queue, &c->queue_end); + avpriv_packet_list_free(&c->queue); for (unsigned i = 0; i < s->nb_streams; i++) av_packet_free((AVPacket **)&s->streams[i]->priv_data); } @@ -360,7 +360,7 @@ static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt) if (pkt->stream_index == c->audio_stream_idx) { if (c->waiting_pics) { /* buffer audio packets until we get all the pictures */ - ret = avpriv_packet_list_put(&c->queue, &c->queue_end, pkt, NULL, 0); + ret = avpriv_packet_list_put(&c->queue, pkt, NULL, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Out of memory in packet queue; skipping attached pictures\n"); c->waiting_pics = 0; diff --git a/libavformat/internal.h b/libavformat/internal.h index eb8239cd3f..f6a93408e1 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -25,6 +25,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/bsf.h" +#include "libavcodec/packet_internal.h" #include "avformat.h" #include "os_support.h" @@ -92,8 +93,7 @@ typedef struct FFFormatContext { * not decoded, for example to get the codec parameters in MPEG * streams. */ - struct PacketList *packet_buffer; - struct PacketList *packet_buffer_end; + PacketList packet_buffer; /* av_seek_frame() support */ int64_t data_offset; /**< offset of the first packet */ @@ -104,13 +104,11 @@ typedef struct FFFormatContext { * be identified, as parsing cannot be done without knowing the * codec. */ - struct PacketList *raw_packet_buffer; - struct PacketList *raw_packet_buffer_end; + PacketList raw_packet_buffer; /** * Packets split by the parser get queued here. */ - struct PacketList *parse_queue; - struct PacketList *parse_queue_end; + PacketList parse_queue; /** * The generic code uses this as a temporary packet * to parse packets or for muxing, especially flushing. @@ -393,7 +391,7 @@ typedef struct FFStream { /** * last packet in packet_buffer for this stream when muxing. */ - struct PacketList *last_in_packet_buffer; + PacketListEntry *last_in_packet_buffer; int64_t last_IP_pts; int last_IP_duration; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index f823fb96b8..4fb1ea56e9 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -387,8 +387,7 @@ typedef struct MatroskaDemuxContext { AVPacket *pkt; /* the packet queue */ - PacketList *queue; - PacketList *queue_end; + PacketList queue; int done; @@ -3058,11 +3057,11 @@ static int matroska_read_header(AVFormatContext *s) static int matroska_deliver_packet(MatroskaDemuxContext *matroska, AVPacket *pkt) { - if (matroska->queue) { + if (matroska->queue.head) { MatroskaTrack *tracks = matroska->tracks.elem; MatroskaTrack *track; - avpriv_packet_list_get(&matroska->queue, &matroska->queue_end, pkt); + avpriv_packet_list_get(&matroska->queue, pkt); track = &tracks[pkt->stream_index]; if (track->has_palette) { uint8_t *pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); @@ -3084,7 +3083,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska, */ static void matroska_clear_queue(MatroskaDemuxContext *matroska) { - avpriv_packet_list_free(&matroska->queue, &matroska->queue_end); + avpriv_packet_list_free(&matroska->queue); } static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, @@ -3250,7 +3249,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska, track->audio.buf_timecode = AV_NOPTS_VALUE; pkt->pos = pos; pkt->stream_index = st->index; - ret = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + ret = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (ret < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -3472,7 +3471,7 @@ static int matroska_parse_webvtt(MatroskaDemuxContext *matroska, pkt->duration = duration; pkt->pos = pos; - err = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + err = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (err < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -3574,7 +3573,7 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, pkt->pos = pos; pkt->duration = lace_duration; - res = avpriv_packet_list_put(&matroska->queue, &matroska->queue_end, pkt, NULL, 0); + res = avpriv_packet_list_put(&matroska->queue, pkt, NULL, 0); if (res < 0) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -3976,10 +3975,10 @@ static int webm_clusters_start_with_keyframe(AVFormatContext *s) matroska_reset_status(matroska, 0, cluster_pos); matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0 || - !matroska->queue) { + !matroska->queue.head) { break; } - pkt = &matroska->queue->pkt; + pkt = &matroska->queue.head->pkt; // 4 + read is the length of the cluster id and the cluster length field. cluster_pos += 4 + read + cluster_length; if (!(pkt->flags & AV_PKT_FLAG_KEY)) { diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 033a6a9f52..0ffc6395c3 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5349,7 +5349,7 @@ static int mov_write_squashed_packet(AVFormatContext *s, MOVTrack *track) switch (track->st->codecpar->codec_id) { case AV_CODEC_ID_TTML: { - int had_packets = !!track->squashed_packet_queue; + int had_packets = !!track->squashed_packet_queue.head; if ((ret = ff_mov_generate_squashed_ttml_packet(s, track, squashed_packet)) < 0) { goto finish_squash; @@ -6200,7 +6200,6 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* The following will reset pkt and is only allowed to be used * because we return immediately. afterwards. */ if ((ret = avpriv_packet_list_put(&trk->squashed_packet_queue, - &trk->squashed_packet_queue_end, pkt, NULL, 0)) < 0) { return ret; } @@ -6486,9 +6485,8 @@ static void mov_free(AVFormatContext *s) ff_mov_cenc_free(&mov->tracks[i].cenc); ffio_free_dyn_buf(&mov->tracks[i].mdat_buf); - if (mov->tracks[i].squashed_packet_queue) { - avpriv_packet_list_free(&(mov->tracks[i].squashed_packet_queue), - &(mov->tracks[i].squashed_packet_queue_end)); + if (mov->tracks[i].squashed_packet_queue.head) { + avpriv_packet_list_free(&mov->tracks[i].squashed_packet_queue); } } diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 40077b1afe..2ac84ed070 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -167,7 +167,7 @@ typedef struct MOVTrack { unsigned int squash_fragment_samples_to_one; //< flag to note formats where all samples for a fragment are to be squashed - PacketList *squashed_packet_queue, *squashed_packet_queue_end; + PacketList squashed_packet_queue; } MOVTrack; typedef enum { diff --git a/libavformat/movenc_ttml.c b/libavformat/movenc_ttml.c index 472572b45a..6deae49657 100644 --- a/libavformat/movenc_ttml.c +++ b/libavformat/movenc_ttml.c @@ -70,9 +70,7 @@ static int mov_write_ttml_document_from_queue(AVFormatContext *s, return ret; } - while (!avpriv_packet_list_get(&track->squashed_packet_queue, - &track->squashed_packet_queue_end, - pkt)) { + while (!avpriv_packet_list_get(&track->squashed_packet_queue, pkt)) { end_ts = FFMAX(end_ts, pkt->pts + pkt->duration); // in case of the 'dfxp' muxing mode, each written document is offset @@ -121,7 +119,7 @@ int ff_mov_generate_squashed_ttml_packet(AVFormatContext *s, goto cleanup; } - if (!track->squashed_packet_queue) { + if (!track->squashed_packet_queue.head) { // empty queue, write minimal empty document with zero duration avio_write(ttml_ctx->pb, empty_ttml_document, sizeof(empty_ttml_document) - 1); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 0ffc79c025..3ff19da274 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -132,7 +132,7 @@ typedef struct MP3Context { int pics_to_write; /* audio packets are queued here until we get all the attached pictures */ - PacketList *queue, *queue_end; + PacketList queue; } MP3Context; static const uint8_t xing_offtbl[2][2] = {{32, 17}, {17, 9}}; @@ -387,8 +387,8 @@ static int mp3_queue_flush(AVFormatContext *s) ff_id3v2_finish(&mp3->id3, s->pb, s->metadata_header_padding); mp3_write_xing(s); - while (mp3->queue) { - avpriv_packet_list_get(&mp3->queue, &mp3->queue_end, pkt); + while (mp3->queue.head) { + avpriv_packet_list_get(&mp3->queue, pkt); if (write && (ret = mp3_write_audio_packet(s, pkt)) < 0) write = 0; av_packet_unref(pkt); @@ -524,8 +524,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt) if (pkt->stream_index == mp3->audio_stream_idx) { if (mp3->pics_to_write) { /* buffer audio packets until we get all the pictures */ - int ret = avpriv_packet_list_put(&mp3->queue, &mp3->queue_end, - pkt, NULL, 0); + int ret = avpriv_packet_list_put(&mp3->queue, pkt, NULL, 0); if (ret < 0) { av_log(s, AV_LOG_WARNING, "Not enough memory to buffer audio. Skipping picture streams\n"); @@ -633,7 +632,7 @@ static void mp3_deinit(struct AVFormatContext *s) { MP3Context *mp3 = s->priv_data; - avpriv_packet_list_free(&mp3->queue, &mp3->queue_end); + avpriv_packet_list_free(&mp3->queue); av_freep(&mp3->xing_frame); } diff --git a/libavformat/mux.c b/libavformat/mux.c index 0500f636de..c387f8ec6e 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -809,12 +809,12 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, { int ret; FFFormatContext *const si = ffformatcontext(s); - PacketList **next_point, *this_pktl; + PacketListEntry **next_point, *this_pktl; AVStream *st = s->streams[pkt->stream_index]; FFStream *const sti = ffstream(st); int chunked = s->max_chunk_size || s->max_chunk_duration; - this_pktl = av_malloc(sizeof(PacketList)); + this_pktl = av_malloc(sizeof(*this_pktl)); if (!this_pktl) { av_packet_unref(pkt); return AVERROR(ENOMEM); @@ -831,7 +831,7 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, if (sti->last_in_packet_buffer) { next_point = &(sti->last_in_packet_buffer->next); } else { - next_point = &si->packet_buffer; + next_point = &si->packet_buffer.head; } if (chunked) { @@ -855,7 +855,7 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, if (chunked && !(pkt->flags & CHUNK_START)) goto next_non_null; - if (compare(s, &si->packet_buffer_end->pkt, pkt)) { + if (compare(s, &si->packet_buffer.tail->pkt, pkt)) { while ( *next_point && ((chunked && !((*next_point)->pkt.flags&CHUNK_START)) || !compare(s, &(*next_point)->pkt, pkt))) @@ -863,12 +863,12 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, if (*next_point) goto next_non_null; } else { - next_point = &(si->packet_buffer_end->next); + next_point = &(si->packet_buffer.tail->next); } } av_assert1(!*next_point); - si->packet_buffer_end = this_pktl; + si->packet_buffer.tail = this_pktl; next_non_null: this_pktl->next = *next_point; @@ -939,11 +939,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, flush = 1; if (s->max_interleave_delta > 0 && - si->packet_buffer && + si->packet_buffer.head && !flush && si->nb_interleaved_streams == stream_count+noninterleaved_count ) { - AVPacket *const top_pkt = &si->packet_buffer->pkt; + AVPacket *const top_pkt = &si->packet_buffer.head->pkt; int64_t delta_dts = INT64_MIN; int64_t top_dts = av_rescale_q(top_pkt->dts, s->streams[top_pkt->stream_index]->time_base, @@ -952,7 +952,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, for (unsigned i = 0; i < s->nb_streams; i++) { const AVStream *const st = s->streams[i]; const FFStream *const sti = cffstream(st); - const PacketList *last = sti->last_in_packet_buffer; + const PacketListEntry *const last = sti->last_in_packet_buffer; int64_t last_dts; if (!last) @@ -973,11 +973,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, } } - if (si->packet_buffer && + if (si->packet_buffer.head && eof && (s->flags & AVFMT_FLAG_SHORTEST) && si->shortest_end == AV_NOPTS_VALUE) { - AVPacket *const top_pkt = &si->packet_buffer->pkt; + AVPacket *const top_pkt = &si->packet_buffer.head->pkt; si->shortest_end = av_rescale_q(top_pkt->dts, s->streams[top_pkt->stream_index]->time_base, @@ -985,8 +985,8 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, } if (si->shortest_end != AV_NOPTS_VALUE) { - while (si->packet_buffer) { - PacketList *pktl = si->packet_buffer; + while (si->packet_buffer.head) { + PacketListEntry *pktl = si->packet_buffer.head; AVPacket *const top_pkt = &pktl->pkt; AVStream *const st = s->streams[top_pkt->stream_index]; FFStream *const sti = ffstream(st); @@ -996,9 +996,9 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, if (si->shortest_end + 1 >= top_dts) break; - si->packet_buffer = pktl->next; - if (!si->packet_buffer) - si->packet_buffer_end = NULL; + si->packet_buffer.head = pktl->next; + if (!si->packet_buffer.head) + si->packet_buffer.tail = NULL; if (sti->last_in_packet_buffer == pktl) sti->last_in_packet_buffer = NULL; @@ -1010,13 +1010,13 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt, } if (stream_count && flush) { - PacketList *pktl = si->packet_buffer; + PacketListEntry *pktl = si->packet_buffer.head; AVStream *const st = s->streams[pktl->pkt.stream_index]; FFStream *const sti = ffstream(st); if (sti->last_in_packet_buffer == pktl) sti->last_in_packet_buffer = NULL; - avpriv_packet_list_get(&si->packet_buffer, &si->packet_buffer_end, pkt); + avpriv_packet_list_get(&si->packet_buffer, pkt); return 1; } else { @@ -1049,7 +1049,7 @@ int ff_get_muxer_ts_offset(AVFormatContext *s, int stream_index, int64_t *offset const AVPacket *ff_interleaved_peek(AVFormatContext *s, int stream) { FFFormatContext *const si = ffformatcontext(s); - PacketList *pktl = si->packet_buffer; + PacketListEntry *pktl = si->packet_buffer.head; while (pktl) { if (pktl->pkt.stream_index == stream) { return &pktl->pkt; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 7635e183d0..146f8e3edc 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -3094,9 +3094,9 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, int flus stream_count += !!ffstream(s->streams[i])->last_in_packet_buffer; if (stream_count && (s->nb_streams == stream_count || flush)) { - PacketList *pktl = si->packet_buffer; + PacketListEntry *pktl = si->packet_buffer.head; if (s->nb_streams != stream_count) { - PacketList *last = NULL; + PacketListEntry *last = NULL; // find last packet in edit unit while (pktl) { if (!stream_count || pktl->pkt.stream_index == 0) @@ -3110,7 +3110,7 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, int flus } // purge packet queue while (pktl) { - PacketList *next = pktl->next; + PacketListEntry *next = pktl->next; av_packet_unref(&pktl->pkt); av_freep(&pktl); pktl = next; @@ -3118,16 +3118,16 @@ static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, int flus if (last) last->next = NULL; else { - si->packet_buffer = NULL; - si->packet_buffer_end = NULL; + si->packet_buffer.head = NULL; + si->packet_buffer.tail = NULL; goto out; } - pktl = si->packet_buffer; + pktl = si->packet_buffer.head; } if (ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer == pktl) ffstream(s->streams[pktl->pkt.stream_index])->last_in_packet_buffer = NULL; - avpriv_packet_list_get(&si->packet_buffer, &si->packet_buffer_end, out); + avpriv_packet_list_get(&si->packet_buffer, out); av_log(s, AV_LOG_TRACE, "out st:%d dts:%"PRId64"\n", out->stream_index, out->dts); return 1; } else { diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c index 5f21fdc144..486f8bdd10 100644 --- a/libavformat/ttaenc.c +++ b/libavformat/ttaenc.c @@ -30,7 +30,7 @@ typedef struct TTAMuxContext { AVIOContext *seek_table; - PacketList *queue, *queue_end; + PacketList queue; uint32_t nb_samples; int frame_size; int last_frame; @@ -94,12 +94,11 @@ static int tta_write_packet(AVFormatContext *s, AVPacket *pkt) TTAMuxContext *tta = s->priv_data; int ret; - ret = avpriv_packet_list_put(&tta->queue, &tta->queue_end, pkt, - NULL, 0); + ret = avpriv_packet_list_put(&tta->queue, pkt, NULL, 0); if (ret < 0) { return ret; } - pkt = &tta->queue_end->pkt; + pkt = &tta->queue.tail->pkt; avio_wl32(tta->seek_table, pkt->size); tta->nb_samples += pkt->duration; @@ -126,8 +125,8 @@ static void tta_queue_flush(AVFormatContext *s) TTAMuxContext *tta = s->priv_data; AVPacket *const pkt = ffformatcontext(s)->pkt; - while (tta->queue) { - avpriv_packet_list_get(&tta->queue, &tta->queue_end, pkt); + while (tta->queue.head) { + avpriv_packet_list_get(&tta->queue, pkt); avio_write(s->pb, pkt->data, pkt->size); av_packet_unref(pkt); } @@ -163,7 +162,7 @@ static void tta_deinit(AVFormatContext *s) TTAMuxContext *tta = s->priv_data; ffio_free_dyn_buf(&tta->seek_table); - avpriv_packet_list_free(&tta->queue, &tta->queue_end); + avpriv_packet_list_free(&tta->queue); } const AVOutputFormat ff_tta_muxer = { diff --git a/libavformat/utils.c b/libavformat/utils.c index bd076d532b..0105031681 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -239,7 +239,6 @@ int avformat_queue_attached_pictures(AVFormatContext *s) } ret = avpriv_packet_list_put(&si->raw_packet_buffer, - &si->raw_packet_buffer_end, &s->streams[i]->attached_pic, av_packet_ref, 0); if (ret < 0) @@ -300,9 +299,9 @@ int ff_is_intra_only(enum AVCodecID id) void ff_flush_packet_queue(AVFormatContext *s) { FFFormatContext *const si = ffformatcontext(s); - avpriv_packet_list_free(&si->parse_queue, &si->parse_queue_end); - avpriv_packet_list_free(&si->packet_buffer, &si->packet_buffer_end); - avpriv_packet_list_free(&si->raw_packet_buffer, &si->raw_packet_buffer_end); + avpriv_packet_list_free(&si->parse_queue); + avpriv_packet_list_free(&si->packet_buffer); + avpriv_packet_list_free(&si->raw_packet_buffer); si->raw_packet_buffer_size = 0; } From patchwork Thu Dec 16 01:29:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 32651 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp408048iog; Wed, 15 Dec 2021 17:30:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHC2K6kkkHObC5iYuFWKW9ImpVuJBrfAp1bn9u759ESgZT7bLnN0xEo9AWVwV8asHgl1YD X-Received: by 2002:a05:6402:1250:: with SMTP id l16mr4558605edw.0.1639618225940; Wed, 15 Dec 2021 17:30:25 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c11si2593851edy.247.2021.12.15.17.30.25; Wed, 15 Dec 2021 17:30:25 -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=@outlook.com header.s=selector1 header.b=ttIyFPjX; 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 8089768AE5A; Thu, 16 Dec 2021 03:30:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2048.outbound.protection.outlook.com [40.92.89.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34DE068AEBC for ; Thu, 16 Dec 2021 03:29:53 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZCN9kn46Am1v+0M83iVvok8kMyFZuIdCdJ77C2aMvS9pRTXCLZ5Fg0VgG85V+NqXyXtWtIopCoG6SshcmlCe/lL8UDwjh0AwXow+vkGxXXx7u/K0VJKx80OHxJB1RVtL746Wri8PDEyaQX0ZIDcLtFu8/g0GnUWM7luQRaWVYcVT9w2KnK/72agn8hIf51X+AFwHpIbNQ12gcdI4qkNOR0rDFUSIvUhwDNgX6W0jUxphlltz+JeNPLUWADvrhLV2SwPRZzlP2A7yGD7OBjocB9oR5eesrwXkaU/b4JTWCxenqmv4awEE7/uiI8cukAZqrmrnhMslagKstPM9s03XMA== 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=u5q6XZHSel6VOXsTKOgR4tV/ygPi5o/GIJ5R/Dxoo0E=; b=k4gS/fv+tmbQZ1uP7oJ7KX5YRrFBcPccG/H5Yc6/l9UIdKpjTGxrt7D00vNERGkcmNAIrQERaiYIom6Q6X3C7vt/YH/atUlAyMTNaPwJ3SyUawGygNPlhz3I322oPgAozQkc2GtTTd+em7KYExXAXtCdORA1cldX8+FRFcNSNQzppSl2Xl4ix7/94zTfyt5F/utA5d9ZKAWoU/JNl7Kk0n6RX3fawn+uQBx0Ndez4PDQxchkZWQhMMWp3HU261OIBjya24ZX1VsN5Np/+M58Jq3733ro38uq8+XrI0R1/LhoVvGKGhp/av9pBvgAc4at5/sDIix7tRQxzyp9KMU4sA== 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=u5q6XZHSel6VOXsTKOgR4tV/ygPi5o/GIJ5R/Dxoo0E=; b=ttIyFPjXfU+Up/fJD4MPamr0H3t1TjOl8esH5NOCXsmF1NAP/1g6ZQ0tJvFpyPE6V+fmm+hl575aiUDwY26eb4zENnBvd3834WglkJCn2q8GakSpnUxVXkJ+sGe/USGha+lfBEDJinhiD+nyHLsx8WVz8doe9pg8cEk6Othf2pWPKEfzAOdcJevkQxPoBpkxF82a8Buv96MrjEVA908apJJXL3A3u9uVMGH+kfC86ts6NVtS1/PXoHS6OQuhza6TUApSz0jhd/IFrrDflb8/1jjgM9H6Ac49RdppEA+HG+NEQlMYmZIYXmSAScrs8Y9HWWm4oC3rqiq8I1m3Px9unA== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM7PR03MB6628.eurprd03.prod.outlook.com (2603:10a6:20b:1bf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Thu, 16 Dec 2021 01:29:46 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::f0dc:92f5:6bc2:45ca%6]) with mapi id 15.20.4778.018; Thu, 16 Dec 2021 01:29:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Dec 2021 02:29:23 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [mkjRGwxCbTTQLvV7QpCPDHvpfwRE26Bw] X-ClientProxiedBy: AM9P192CA0004.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::9) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211216012923.404907-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76fceb86-145c-468a-dca3-08d9c0338b1c X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiR3EehW4kxQzdNcP2D/mG1JIv/JhDjmDHnP3Sz7aBkolAWITkatEl0UQM0MxQIQwuHEyz/WWX8Kl5YFWVgt6tyN/V9Z4aLURHDyWH/yqOioJf1MAWLXWThRlYXJ74QcZmcTD2dhcS0nBtkZ7C38j0ZLiEBrsl+MzzRfkAisuZYBPIoyngbWJvwtaR1pSOQmK1eHQXdQ3VjHf1whxNzCbJdJxLUCiIA4iz1FOgOTbCdrsvOQK0+5hD+DGf+ZqtaaKTA4wOqQLCbT+H+yJlpR4eCiZNhoxG4r/NbbUiE/auhku/zQBRR0Ram2z9OZtA79QQBNfFFy+jPJXHOI8qinAHe04Lr4RR05wO+OsQarDKFwGUZQT6MyKh4Ec0IIFSjZsTT9aFo7Og4vj0jGltMA640BzyeFG4ZT/EIPvQlefhg9ZCZ543Zf+oHUUWKlFJ5EJlaUl248Nfee0ZHTTV9CgbPww83vV5vYg4JWcLB7erQS+JmPqW714tAOB/y1bM5wreiww+86NpyjYZ1DWeykAVbNdcckAhIeMaSkidoAOPadiKL8fdzc8T2A/KKAP5CNzZ+pYnEhwp/K/kL+1vLsBWH+Tru+xrrYLIkaCasU6AluFPnTH/BT7v4ofwbe5iMiZgcvxJUewWzASZBAZEIHN/65eQq596G54yD1Z7ZBIglLcb55IX+drvGDPB+jEbZG36rnGZuww+SyG7LXBBY7SJdBehjGNPG4cTiMA0HTSa4mRJH09xoWNF/PyOfNOnnQnuM= X-MS-TrafficTypeDiagnostic: AM7PR03MB6628:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Y7+j1k5h7XhxTDgv5SQ5X1Nszl3H5jAbeXuk3Ytun5gdIm6zXSxM8rYctUlcTq/hvGGBS1zNb1NXTeB8A9f835+txeIKXHj+mVJZNWo/H2yIrENfpdSDuzJhq/eCortA3WL6k+vL+LDKAXGDwvZM3ryMg6e3CMdy6t8ltozkHuw14oBcoXDQRwXuB0TIkPDbWr/XBHaEmk8Yxrbg2ebioMeA6L3Vuit10WiL34jLkZoJwtbMYaoClSncNPJc4m5m4fgLsg7KNnD8pvR06SjTA9eZpkoikwN54KW+UGdGDm+QTHUITxlb7cpuZmKEfSWSuRz5ejMzXpT8XXiEsqgHZqBeDVPGe9CTFWWkdxY45PIz9Kc2bTdYm/xSRguilmB0Bd7uJs+5IZQql7odYNZqbtZ0FEOzgPkfbMh2LbEzrHhOVGQcL35nF5LhzQud9JnuHxFOZcW8gHX93bFcyhrG2GsGMojykUVBuHK8rz5Xri79Bltg8ROZVh7niQO2upykSXq2IkuszboW46IcroijD2hGQFUhExJzXw1czJ+cH9JdWmlOU9ypfQq9xuX5rDTAbPaDBNZ0u1OxrUOnLv3hg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nObE4FV9aM297mBzFtjRxumjUDo0Yb8Zz38R9UDvh4jpC8DboOsI7FNhw8CiC1tnqYuEfTrZo7xoPMQAbspm4DqL/T/iI16NTCvljDvwD7+XiZNlt7A0B0JgXBURDEezPlykoPg8I8MSNGrhEepx0SWsXxciZJZ3StdSEulrGPiJo38pqNuMDj1Z8VyL6fOIEMDsOJHvAXOVkg1mPYDqePb8nyNEyjxudAWTUIzlBDVxXrUTDs/4dP0WBwmbxblbN+74wXNLq5Q4OAGc/UBBsx+s1/6TKsiuwN2/2oRdksh90QLU7RUad1jB5DqyvSrN4MvomDZoW5dOcgMCu+aIIm/aYLaXhiowIHYqe5RZLL0yYct2TKuYsXdD7W3DOicMOLmfGkD3dgdD0bMql9J/LbIkAbdg8TOyUYcKGx/f6Cm7lblNyMF4RmJ1QkxxxxKilNkM+t0JlZh5PCjCM3ju9SzjjVAbOAuJfeK4nJXQ0+7zakZry0Frb4qzIZ6dyY8pWOBcswf5ZXBiR4C3Ka8lH/aUF9V2FNE1HAZLKsaa5FiewtW6GzwOJsqb46nNqt3qWr4xjt5rpF3LT4NKNytwlj1xrRUyyPSNWqENPTREqbOnJhTNB8TLaxYposSLvsKBsgVzAJyokf9ie2DzSVfY8/jKnOe/5wnTYjU7e1ah1EWr1Xi4PIUoicn8FOHc1JDvyqK2NTeBsd6OgCpfeYQohm1lvczvMAGKT6pnSrYW1xZDBCujavqGSnzhZmMYgy5XGl14kw8H1yTqm5V5kyfuBOI/ArjLKEs0SrxWhKHkStm+oxKZxW155gfPzS6jkA/UHVxzD4BMEVzZk3IuLuMUD+L0n1JYd6FUECBXsjO2OF0szpYnPZ2lY1OvhZoquEhccVEYNEy+QIJEMYOLpICaiSebqXPdk1WCVAwRHXUxYD3p2O5qludor20voul7NuECAOir7SmELKZQyy6vJSnIag== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76fceb86-145c-468a-dca3-08d9c0338b1c X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2021 01:29:46.1300 (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: AM7PR03MB6628 Subject: [FFmpeg-devel] [PATCH 15/15] avformat/movenc: Use dedicated pointer for access to MOVTrack 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: BN6Hkv7SWZA8 Improves readability and slightly decreases codesize. While just at it, also remove a check whether the packet list is nonempty before freeing it, as freeing an empty list is fine and basically a no-op. Signed-off-by: Andreas Rheinhardt --- libavformat/movenc.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0ffc6395c3..9f2f8414d5 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6466,28 +6466,28 @@ static void mov_free(AVFormatContext *s) } for (i = 0; i < mov->nb_streams; i++) { - if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) - ff_mov_close_hinting(&mov->tracks[i]); - else if (mov->tracks[i].tag == MKTAG('t','m','c','d') && mov->nb_meta_tmcd) - av_freep(&mov->tracks[i].par); - av_freep(&mov->tracks[i].cluster); - av_freep(&mov->tracks[i].frag_info); - av_packet_free(&mov->tracks[i].cover_image); - - if (mov->tracks[i].eac3_priv) { - struct eac3_info *info = mov->tracks[i].eac3_priv; + MOVTrack *const track = &mov->tracks[i]; + + if (track->tag == MKTAG('r','t','p',' ')) + ff_mov_close_hinting(track); + else if (track->tag == MKTAG('t','m','c','d') && mov->nb_meta_tmcd) + av_freep(&track->par); + av_freep(&track->cluster); + av_freep(&track->frag_info); + av_packet_free(&track->cover_image); + + if (track->eac3_priv) { + struct eac3_info *info = track->eac3_priv; av_packet_free(&info->pkt); - av_freep(&mov->tracks[i].eac3_priv); + av_freep(&track->eac3_priv); } - if (mov->tracks[i].vos_len) - av_freep(&mov->tracks[i].vos_data); + if (track->vos_len) + av_freep(&track->vos_data); - ff_mov_cenc_free(&mov->tracks[i].cenc); - ffio_free_dyn_buf(&mov->tracks[i].mdat_buf); + ff_mov_cenc_free(&track->cenc); + ffio_free_dyn_buf(&track->mdat_buf); - if (mov->tracks[i].squashed_packet_queue.head) { - avpriv_packet_list_free(&mov->tracks[i].squashed_packet_queue); - } + avpriv_packet_list_free(&track->squashed_packet_queue); } av_freep(&mov->tracks);