avformat/aiff: Deduplicate codec tags and codec tags list

Also saves a relocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2021-02-18 02:39:34 +01:00
parent 697066af01
commit 08b4a25ff9
5 changed files with 60 additions and 32 deletions

View 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

54
libavformat/aiff.c Normal file
View File

@ -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 };

View File

@ -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 */

View 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,
};

View 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,
};