aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-02-09 18:25:13 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-04 13:16:49 +0100
commitd7a75d21635eab4f4a1efea22945933059c2e36f (patch)
tree936c16681a38f85298f1b45201ac79686ecb14d4 /libavformat
parent3d53cefb49289e5e27b652e13623017b05ace452 (diff)
downloadffmpeg-d7a75d21635eab4f4a1efea22945933059c2e36f.tar.gz
avcodec/ac3tab: Unavpriv ac3_channel_layout_tab
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 <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile2
-rw-r--r--libavformat/ac3_channel_layout_tab.c22
-rw-r--r--libavformat/hls_sample_encryption.c4
-rw-r--r--libavformat/mov.c4
4 files changed, 29 insertions, 3 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 37281d5ca8..df95c34046 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -681,6 +681,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 ad5ab6b491..e401cd39b5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -813,7 +813,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;
@@ -846,7 +846,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);