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);