diff mbox series

[FFmpeg-devel,26/29] avformat/aiff: Deduplicate codec tags and codec tags list

Message ID 20210218034214.2090223-26-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,01/29] configure, libavcodec/Makefile: Remove spurious CAF demuxer dependencies
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 18, 2021, 3:42 a.m. UTC
Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/Makefile  |  4 ++--
 libavformat/aiff.c    | 54 +++++++++++++++++++++++++++++++++++++++++++
 libavformat/aiff.h    | 30 ++----------------------
 libavformat/aiffdec.c |  2 +-
 libavformat/aiffenc.c |  2 +-
 5 files changed, 60 insertions(+), 32 deletions(-)
 create mode 100644 libavformat/aiff.c
diff mbox series

Patch

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 890c7592e7..d6c62f3014 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -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
index 0000000000..0f25b436bd
--- /dev/null
+++ b/libavformat/aiff.c
@@ -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 };
diff --git a/libavformat/aiff.h b/libavformat/aiff.h
index 0ed10a241a..7c7c55cb50 100644
--- a/libavformat/aiff.h
+++ b/libavformat/aiff.h
@@ -27,35 +27,9 @@ 
 #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 */
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 81189316ff..5abc0c9643 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -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,
 };
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index c4ffe9f6d0..53a2f97e22 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -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,
 };