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;