libav: switch from CODEC_ID to AV_CODEC_ID
[mplayer.git] / libmpdemux / mp_taglists.c
blob3c5534328f56b529bde87dd0f213030dd4b89254
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <libavformat/avformat.h>
21 #include "config.h"
22 #include "mp_taglists.h"
24 struct tag {
25 enum AVCodecID id;
26 unsigned int tag;
29 static const struct tag mp_wav_tags[] = {
30 { AV_CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')},
31 { AV_CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')},
32 { AV_CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')},
33 { AV_CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')},
34 { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')},
35 { AV_CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')},
36 { AV_CODEC_ID_ADPCM_XA, MKTAG('P', 'S', 'X', 'A')},
37 { AV_CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0)},
38 { AV_CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')},
39 { AV_CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')},
40 { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')},
41 { AV_CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')},
42 { AV_CODEC_ID_MLP, MKTAG('M', 'L', 'P', ' ')},
43 { AV_CODEC_ID_MP1, 0x50},
44 { AV_CODEC_ID_MP4ALS, MKTAG('A', 'L', 'S', ' ')},
45 { AV_CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')},
46 { AV_CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')},
47 { AV_CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')},
48 { AV_CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F')},
49 { AV_CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p')},
50 { AV_CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')},
51 { AV_CODEC_ID_RA_144, MKTAG('1', '4', '_', '4')},
52 { AV_CODEC_ID_RA_288, MKTAG('2', '8', '_', '8')},
53 { AV_CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')},
54 { AV_CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')},
55 { AV_CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')},
56 { AV_CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')},
57 { AV_CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2')},
58 { AV_CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')},
59 { AV_CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')},
60 { AV_CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')},
61 { 0, 0 },
64 static const struct tag mp_codecid_override_tags[] = {
65 { AV_CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A')},
66 { AV_CODEC_ID_AAC_LATM, MKTAG('M', 'P', '4', 'L')},
67 { AV_CODEC_ID_AC3, 0x2000},
68 { AV_CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')},
69 { AV_CODEC_ID_BINKAUDIO_DCT, MKTAG('B', 'A', 'U', '1')},
70 { AV_CODEC_ID_BINKAUDIO_RDFT, MKTAG('B', 'A', 'U', '2')},
71 { AV_CODEC_ID_DTS, 0x2001},
72 { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')},
73 { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')},
74 { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4')},
75 { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'V')},
76 { AV_CODEC_ID_PCM_BLURAY, MKTAG('B', 'P', 'C', 'M')},
77 { AV_CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')},
78 { AV_CODEC_ID_PCM_U8, 1},
79 { AV_CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')},
80 { AV_CODEC_ID_PCM_S16LE, 1},
81 { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')},
82 { AV_CODEC_ID_PCM_S24LE, 1},
83 { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2')},
84 { AV_CODEC_ID_PCM_S32LE, 1},
85 { AV_CODEC_ID_MP2, 0x50},
86 { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'G', '2')},
87 { AV_CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D')},
88 { 0, 0 },
91 static const struct tag mp_bmp_tags[] = {
92 { AV_CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')},
93 { AV_CODEC_ID_ANM, MKTAG('A', 'N', 'M', ' ')},
94 { AV_CODEC_ID_AVS, MKTAG('A', 'V', 'S', ' ')},
95 { AV_CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')},
96 { AV_CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')},
97 { AV_CODEC_ID_C93, MKTAG('C', '9', '3', 'V')},
98 { AV_CODEC_ID_CDGRAPHICS, MKTAG('C', 'D', 'G', 'R')},
99 { AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')},
100 { AV_CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')},
101 { AV_CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')},
102 { AV_CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')},
103 { AV_CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')},
104 { AV_CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')},
105 { AV_CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V')},
106 { AV_CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C')},
107 { AV_CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1')},
108 { AV_CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')},
109 { AV_CODEC_ID_RL2, MKTAG('R', 'L', '2', 'V')},
110 { AV_CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V')},
111 { AV_CODEC_ID_RV10, MKTAG('R', 'V', '1', '0')},
112 { AV_CODEC_ID_RV20, MKTAG('R', 'V', '2', '0')},
113 { AV_CODEC_ID_RV30, MKTAG('R', 'V', '3', '0')},
114 { AV_CODEC_ID_RV40, MKTAG('R', 'V', '4', '0')},
115 { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3')},
116 { AV_CODEC_ID_TGV, MKTAG('f', 'V', 'G', 'T')},
117 { AV_CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')},
118 { AV_CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')},
119 { AV_CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V')},
120 { AV_CODEC_ID_VP6A, MKTAG('V', 'P', '6', 'A')},
121 { AV_CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V')},
122 { AV_CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V')},
123 { AV_CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')},
124 { 0, 0 },
127 static unsigned int codec_get_tag(const struct tag *tags, enum AVCodecID id)
129 while (tags->id != AV_CODEC_ID_NONE) {
130 if (tags->id == id)
131 return tags->tag;
132 tags++;
134 return 0;
137 unsigned int mp_taglist_override(enum AVCodecID id)
139 return codec_get_tag(mp_codecid_override_tags, id);
142 unsigned int mp_taglist_video(enum AVCodecID id)
144 const struct AVCodecTag *tags[] = {avformat_get_riff_video_tags(), NULL };
145 unsigned int tag = av_codec_get_tag(tags, id);
146 if (tag)
147 return tag;
148 return codec_get_tag(mp_bmp_tags, id);
151 unsigned int mp_taglist_audio(enum AVCodecID id)
153 const struct AVCodecTag *tags[] = {avformat_get_riff_audio_tags(), NULL };
154 unsigned int tag = av_codec_get_tag(tags, id);
155 if (tag)
156 return tag;
157 return codec_get_tag(mp_wav_tags, id);