]> git.sesse.net Git - ffmpeg/commitdiff
avformat/aiff: Deduplicate codec tags and codec tags list
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 18 Feb 2021 01:39:34 +0000 (02:39 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 23 Feb 2021 10:30:57 +0000 (11:30 +0100)
Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/Makefile
libavformat/aiff.c [new file with mode: 0644]
libavformat/aiff.h
libavformat/aiffdec.c
libavformat/aiffenc.c

index e2d7abdc561d1f899b77d8bd588851b2651dd18b..4b15830659302aaaab5934dc4afc374118a1cb8f 100644 (file)
@@ -81,9 +81,9 @@ OBJS-$(CONFIG_ADX_DEMUXER)               += adxdec.o
 OBJS-$(CONFIG_ADX_MUXER)                 += rawenc.o
 OBJS-$(CONFIG_AEA_DEMUXER)               += aea.o pcm.o
 OBJS-$(CONFIG_AFC_DEMUXER)               += afc.o
-OBJS-$(CONFIG_AIFF_DEMUXER)              += aiffdec.o pcm.o \
+OBJS-$(CONFIG_AIFF_DEMUXER)              += aiffdec.o aiff.o pcm.o \
                                             mov_chan.o replaygain.o
-OBJS-$(CONFIG_AIFF_MUXER)                += aiffenc.o id3v2enc.o
+OBJS-$(CONFIG_AIFF_MUXER)                += aiffenc.o aiff.o id3v2enc.o
 OBJS-$(CONFIG_AIX_DEMUXER)               += aixdec.o
 OBJS-$(CONFIG_ALP_DEMUXER)               += alp.o
 OBJS-$(CONFIG_ALP_MUXER)                 += alp.o
diff --git a/libavformat/aiff.c b/libavformat/aiff.c
new file mode 100644 (file)
index 0000000..0f25b43
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * AIFF/AIFF-C muxer/demuxer common data
+ * Copyright (c) 2006  Patrick Guimond
+ *
+ * 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 <stddef.h>
+#include "libavcodec/codec_id.h"
+#include "internal.h"
+
+const AVCodecTag ff_codec_aiff_tags[] = {
+    { AV_CODEC_ID_PCM_S16BE,    MKTAG('N','O','N','E') },
+    { AV_CODEC_ID_PCM_S8,       MKTAG('N','O','N','E') },
+    { AV_CODEC_ID_PCM_U8,       MKTAG('r','a','w',' ') },
+    { AV_CODEC_ID_PCM_S24BE,    MKTAG('N','O','N','E') },
+    { AV_CODEC_ID_PCM_S32BE,    MKTAG('N','O','N','E') },
+    { AV_CODEC_ID_PCM_F32BE,    MKTAG('f','l','3','2') },
+    { AV_CODEC_ID_PCM_F64BE,    MKTAG('f','l','6','4') },
+    { AV_CODEC_ID_PCM_ALAW,     MKTAG('a','l','a','w') },
+    { AV_CODEC_ID_PCM_MULAW,    MKTAG('u','l','a','w') },
+    { AV_CODEC_ID_PCM_S24BE,    MKTAG('i','n','2','4') },
+    { AV_CODEC_ID_PCM_S32BE,    MKTAG('i','n','3','2') },
+    { AV_CODEC_ID_MACE3,        MKTAG('M','A','C','3') },
+    { AV_CODEC_ID_MACE6,        MKTAG('M','A','C','6') },
+    { AV_CODEC_ID_GSM,          MKTAG('G','S','M',' ') },
+    { AV_CODEC_ID_ADPCM_G722,   MKTAG('G','7','2','2') },
+    { AV_CODEC_ID_ADPCM_G726LE, MKTAG('G','7','2','6') },
+    { AV_CODEC_ID_PCM_S16BE,    MKTAG('t','w','o','s') },
+    { AV_CODEC_ID_PCM_S16LE,    MKTAG('s','o','w','t') },
+    { AV_CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
+    { AV_CODEC_ID_QDMC,         MKTAG('Q','D','M','C') },
+    { AV_CODEC_ID_QDM2,         MKTAG('Q','D','M','2') },
+    { AV_CODEC_ID_QCELP,        MKTAG('Q','c','l','p') },
+    { AV_CODEC_ID_SDX2_DPCM,    MKTAG('S','D','X','2') },
+    { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A','D','P','4') },
+    { AV_CODEC_ID_NONE,         0 },
+};
+
+const AVCodecTag *const ff_aiff_codec_tags_list[] = { ff_codec_aiff_tags, NULL };
index 0ed10a241ae12e6ac6991a14e88d605e18d80cf4..7c7c55cb502d8da531cac956b4737ca6d8e1750d 100644 (file)
 #ifndef AVFORMAT_AIFF_H
 #define AVFORMAT_AIFF_H
 
-#include "avformat.h"
 #include "internal.h"
 
-static const AVCodecTag ff_codec_aiff_tags[] = {
-    { AV_CODEC_ID_PCM_S16BE,    MKTAG('N','O','N','E') },
-    { AV_CODEC_ID_PCM_S8,       MKTAG('N','O','N','E') },
-    { AV_CODEC_ID_PCM_U8,       MKTAG('r','a','w',' ') },
-    { AV_CODEC_ID_PCM_S24BE,    MKTAG('N','O','N','E') },
-    { AV_CODEC_ID_PCM_S32BE,    MKTAG('N','O','N','E') },
-    { AV_CODEC_ID_PCM_F32BE,    MKTAG('f','l','3','2') },
-    { AV_CODEC_ID_PCM_F64BE,    MKTAG('f','l','6','4') },
-    { AV_CODEC_ID_PCM_ALAW,     MKTAG('a','l','a','w') },
-    { AV_CODEC_ID_PCM_MULAW,    MKTAG('u','l','a','w') },
-    { AV_CODEC_ID_PCM_S24BE,    MKTAG('i','n','2','4') },
-    { AV_CODEC_ID_PCM_S32BE,    MKTAG('i','n','3','2') },
-    { AV_CODEC_ID_MACE3,        MKTAG('M','A','C','3') },
-    { AV_CODEC_ID_MACE6,        MKTAG('M','A','C','6') },
-    { AV_CODEC_ID_GSM,          MKTAG('G','S','M',' ') },
-    { AV_CODEC_ID_ADPCM_G722,   MKTAG('G','7','2','2') },
-    { AV_CODEC_ID_ADPCM_G726LE, MKTAG('G','7','2','6') },
-    { AV_CODEC_ID_PCM_S16BE,    MKTAG('t','w','o','s') },
-    { AV_CODEC_ID_PCM_S16LE,    MKTAG('s','o','w','t') },
-    { AV_CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
-    { AV_CODEC_ID_QDMC,         MKTAG('Q','D','M','C') },
-    { AV_CODEC_ID_QDM2,         MKTAG('Q','D','M','2') },
-    { AV_CODEC_ID_QCELP,        MKTAG('Q','c','l','p') },
-    { AV_CODEC_ID_SDX2_DPCM,    MKTAG('S','D','X','2') },
-    { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A','D','P','4') },
-    { AV_CODEC_ID_NONE,         0 },
-};
+extern const AVCodecTag ff_codec_aiff_tags[];
+extern const AVCodecTag *const ff_aiff_codec_tags_list[];
 
 #endif /* AVFORMAT_AIFF_H */
index 81189316ff8c3153758185bd47698ebd328eadc9..5abc0c9643dbb7e9fb1f58f4c48cc81d19d0d5fd 100644 (file)
@@ -430,5 +430,5 @@ AVInputFormat ff_aiff_demuxer = {
     .read_header    = aiff_read_header,
     .read_packet    = aiff_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .codec_tag      = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
+    .codec_tag      = ff_aiff_codec_tags_list,
 };
index c4ffe9f6d021a8f8f2dc9adca36d5e7ab512e8de..53a2f97e227f6a23f1292962479022ebc4a0920d 100644 (file)
@@ -305,6 +305,6 @@ AVOutputFormat ff_aiff_muxer = {
     .write_packet      = aiff_write_packet,
     .write_trailer     = aiff_write_trailer,
     .deinit            = aiff_deinit,
-    .codec_tag         = (const AVCodecTag* const []){ ff_codec_aiff_tags, 0 },
+    .codec_tag         = ff_aiff_codec_tags_list,
     .priv_class        = &aiff_muxer_class,
 };