[FFmpeg-cvslog] avformat/aiff: Deduplicate codec tags and codec tags list

Andreas Rheinhardt git at videolan.org
Tue Feb 23 12:36:59 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Feb 18 02:39:34 2021 +0100| [08b4a25ff9b325fd5f9866e9db22e55e61558305] | committer: Andreas Rheinhardt

avformat/aiff: Deduplicate codec tags and codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08b4a25ff9b325fd5f9866e9db22e55e61558305
---

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

diff --git a/libavformat/Makefile b/libavformat/Makefile
index e2d7abdc56..4b15830659 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,
 };



More information about the ffmpeg-cvslog mailing list