add QDMC decoding support
[vlc.git] / modules / codec / avcodec / fourcc.c
blob5fc027f85d3fd57b82a187ca400c1f9d5cd1c270
1 /*****************************************************************************
2 * fourcc.c: libavcodec <-> libvlc conversion routines
3 *****************************************************************************
4 * Copyright (C) 1999-2009 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Gildas Bazin <gbazin@videolan.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifdef HAVE_CONFIG_H
26 # include <config.h>
27 #endif
29 #include <vlc_common.h>
30 #include <vlc_codec.h>
32 #include <libavcodec/avcodec.h>
33 #include "avcodec.h"
35 /*****************************************************************************
36 * Codec fourcc -> libavcodec Codec_id mapping
37 * Sorted by AVCodecID enumeration order
38 *****************************************************************************/
39 static const struct
41 vlc_fourcc_t i_fourcc;
42 unsigned i_codec;
43 int i_cat;
44 } codecs_table[] =
46 { 0, AV_CODEC_ID_NONE, UNKNOWN_ES },
49 * Video Codecs
52 { VLC_CODEC_MP2V, AV_CODEC_ID_MPEG2VIDEO, VIDEO_ES }, /* prefer MPEG2 over MPEG1 */
53 { VLC_CODEC_MPGV, AV_CODEC_ID_MPEG2VIDEO, VIDEO_ES }, /* prefer MPEG2 over MPEG1 */
54 { VLC_CODEC_MP1V, AV_CODEC_ID_MPEG1VIDEO, VIDEO_ES },
55 /* AV_CODEC_ID_MPEG2VIDEO_XVMC */
56 { VLC_CODEC_H261, AV_CODEC_ID_H261, VIDEO_ES },
57 { VLC_CODEC_H263, AV_CODEC_ID_H263, VIDEO_ES },
58 { VLC_CODEC_RV10, AV_CODEC_ID_RV10, VIDEO_ES },
59 { VLC_CODEC_RV13, AV_CODEC_ID_RV10, VIDEO_ES },
60 { VLC_CODEC_RV20, AV_CODEC_ID_RV20, VIDEO_ES },
61 { VLC_CODEC_MJPG, AV_CODEC_ID_MJPEG, VIDEO_ES },
62 { VLC_CODEC_MJPGB, AV_CODEC_ID_MJPEGB,VIDEO_ES },
63 { VLC_CODEC_LJPG, AV_CODEC_ID_LJPEG, VIDEO_ES },
64 { VLC_CODEC_SP5X, AV_CODEC_ID_SP5X, VIDEO_ES },
65 { VLC_CODEC_JPEGLS, AV_CODEC_ID_JPEGLS, VIDEO_ES },
66 { VLC_CODEC_MP4V, AV_CODEC_ID_MPEG4, VIDEO_ES },
67 /* AV_CODEC_ID_RAWVIDEO */
68 { VLC_CODEC_DIV1, AV_CODEC_ID_MSMPEG4V1, VIDEO_ES },
69 { VLC_CODEC_DIV2, AV_CODEC_ID_MSMPEG4V2, VIDEO_ES },
70 { VLC_CODEC_DIV3, AV_CODEC_ID_MSMPEG4V3, VIDEO_ES },
71 { VLC_CODEC_WMV1, AV_CODEC_ID_WMV1, VIDEO_ES },
72 { VLC_CODEC_WMV2, AV_CODEC_ID_WMV2, VIDEO_ES },
73 { VLC_CODEC_H263P, AV_CODEC_ID_H263P, VIDEO_ES },
74 { VLC_CODEC_H263I, AV_CODEC_ID_H263I, VIDEO_ES },
75 { VLC_CODEC_FLV1, AV_CODEC_ID_FLV1, VIDEO_ES },
76 { VLC_CODEC_SVQ1, AV_CODEC_ID_SVQ1, VIDEO_ES },
77 { VLC_CODEC_SVQ3, AV_CODEC_ID_SVQ3, VIDEO_ES },
78 { VLC_CODEC_DV, AV_CODEC_ID_DVVIDEO, VIDEO_ES },
79 { VLC_CODEC_HUFFYUV, AV_CODEC_ID_HUFFYUV, VIDEO_ES },
80 { VLC_CODEC_CYUV, AV_CODEC_ID_CYUV, VIDEO_ES },
81 { VLC_CODEC_H264, AV_CODEC_ID_H264, VIDEO_ES },
82 { VLC_CODEC_INDEO3, AV_CODEC_ID_INDEO3, VIDEO_ES },
83 { VLC_CODEC_VP3, AV_CODEC_ID_VP3, VIDEO_ES },
84 { VLC_CODEC_THEORA, AV_CODEC_ID_THEORA, VIDEO_ES },
85 #if ( !defined( WORDS_BIGENDIAN ) )
86 /* Asus Video (Another thing that doesn't work on PPC) */
87 { VLC_CODEC_ASV1, AV_CODEC_ID_ASV1, VIDEO_ES },
88 { VLC_CODEC_ASV2, AV_CODEC_ID_ASV2, VIDEO_ES },
89 #endif
90 { VLC_CODEC_FFV1, AV_CODEC_ID_FFV1, VIDEO_ES },
91 { VLC_CODEC_4XM, AV_CODEC_ID_4XM, VIDEO_ES },
92 { VLC_CODEC_VCR1, AV_CODEC_ID_VCR1, VIDEO_ES },
93 { VLC_CODEC_CLJR, AV_CODEC_ID_CLJR, VIDEO_ES },
94 { VLC_CODEC_MDEC, AV_CODEC_ID_MDEC, VIDEO_ES },
95 { VLC_CODEC_ROQ, AV_CODEC_ID_ROQ, VIDEO_ES },
96 { VLC_CODEC_INTERPLAY, AV_CODEC_ID_INTERPLAY_VIDEO, VIDEO_ES },
97 { VLC_CODEC_XAN_WC3, AV_CODEC_ID_XAN_WC3, VIDEO_ES },
98 { VLC_CODEC_XAN_WC4, AV_CODEC_ID_XAN_WC4, VIDEO_ES },
99 { VLC_CODEC_RPZA, AV_CODEC_ID_RPZA, VIDEO_ES },
100 { VLC_CODEC_CINEPAK, AV_CODEC_ID_CINEPAK, VIDEO_ES },
101 { VLC_CODEC_WS_VQA, AV_CODEC_ID_WS_VQA, VIDEO_ES },
102 { VLC_CODEC_MSRLE, AV_CODEC_ID_MSRLE, VIDEO_ES },
103 { VLC_CODEC_MSVIDEO1, AV_CODEC_ID_MSVIDEO1, VIDEO_ES },
104 { VLC_CODEC_IDCIN, AV_CODEC_ID_IDCIN, VIDEO_ES },
105 { VLC_CODEC_8BPS, AV_CODEC_ID_8BPS, VIDEO_ES },
106 { VLC_CODEC_SMC, AV_CODEC_ID_SMC, VIDEO_ES },
107 { VLC_CODEC_FLIC, AV_CODEC_ID_FLIC, VIDEO_ES },
108 { VLC_CODEC_TRUEMOTION1, AV_CODEC_ID_TRUEMOTION1, VIDEO_ES },
109 { VLC_CODEC_VMDVIDEO, AV_CODEC_ID_VMDVIDEO, VIDEO_ES },
110 { VLC_CODEC_LCL_MSZH, AV_CODEC_ID_MSZH, VIDEO_ES },
111 { VLC_CODEC_LCL_ZLIB, AV_CODEC_ID_ZLIB, VIDEO_ES },
112 { VLC_CODEC_QTRLE, AV_CODEC_ID_QTRLE, VIDEO_ES },
113 { VLC_CODEC_TSCC, AV_CODEC_ID_TSCC, VIDEO_ES },
114 { VLC_CODEC_ULTI, AV_CODEC_ID_ULTI, VIDEO_ES },
115 { VLC_CODEC_QDRAW, AV_CODEC_ID_QDRAW, VIDEO_ES },
116 { VLC_CODEC_VIXL, AV_CODEC_ID_VIXL, VIDEO_ES },
117 { VLC_CODEC_QPEG, AV_CODEC_ID_QPEG, VIDEO_ES },
118 { VLC_CODEC_PNG, AV_CODEC_ID_PNG, VIDEO_ES },
119 { VLC_CODEC_PPM, AV_CODEC_ID_PPM, VIDEO_ES },
120 /* AV_CODEC_ID_PBM */
121 { VLC_CODEC_PGM, AV_CODEC_ID_PGM, VIDEO_ES },
122 { VLC_CODEC_PGMYUV, AV_CODEC_ID_PGMYUV, VIDEO_ES },
123 { VLC_CODEC_PAM, AV_CODEC_ID_PAM, VIDEO_ES },
124 { VLC_CODEC_FFVHUFF, AV_CODEC_ID_FFVHUFF, VIDEO_ES },
125 { VLC_CODEC_RV30, AV_CODEC_ID_RV30, VIDEO_ES },
126 { VLC_CODEC_RV40, AV_CODEC_ID_RV40, VIDEO_ES },
127 { VLC_CODEC_VC1, AV_CODEC_ID_VC1, VIDEO_ES },
128 { VLC_CODEC_WMVA, AV_CODEC_ID_VC1, VIDEO_ES },
129 { VLC_CODEC_WMV3, AV_CODEC_ID_WMV3, VIDEO_ES },
130 { VLC_CODEC_WMVP, AV_CODEC_ID_WMV3, VIDEO_ES },
131 { VLC_CODEC_LOCO, AV_CODEC_ID_LOCO, VIDEO_ES },
132 { VLC_CODEC_WNV1, AV_CODEC_ID_WNV1, VIDEO_ES },
133 { VLC_CODEC_AASC, AV_CODEC_ID_AASC, VIDEO_ES },
134 { VLC_CODEC_INDEO2, AV_CODEC_ID_INDEO2, VIDEO_ES },
135 { VLC_CODEC_FRAPS, AV_CODEC_ID_FRAPS, VIDEO_ES },
136 { VLC_CODEC_TRUEMOTION2, AV_CODEC_ID_TRUEMOTION2, VIDEO_ES },
137 { VLC_CODEC_BMP, AV_CODEC_ID_BMP, VIDEO_ES },
138 { VLC_CODEC_CSCD, AV_CODEC_ID_CSCD, VIDEO_ES },
139 { VLC_CODEC_MMVIDEO, AV_CODEC_ID_MMVIDEO, VIDEO_ES },
140 { VLC_CODEC_ZMBV, AV_CODEC_ID_ZMBV, VIDEO_ES },
141 { VLC_CODEC_AVS, AV_CODEC_ID_AVS, VIDEO_ES },
142 { VLC_CODEC_SMACKVIDEO, AV_CODEC_ID_SMACKVIDEO, VIDEO_ES },
143 { VLC_CODEC_NUV, AV_CODEC_ID_NUV, VIDEO_ES },
144 { VLC_CODEC_KMVC, AV_CODEC_ID_KMVC, VIDEO_ES },
145 { VLC_CODEC_FLASHSV, AV_CODEC_ID_FLASHSV, VIDEO_ES },
146 { VLC_CODEC_CAVS, AV_CODEC_ID_CAVS, VIDEO_ES },
147 { VLC_CODEC_JPEG2000, AV_CODEC_ID_JPEG2000, VIDEO_ES },
148 { VLC_CODEC_VMNC, AV_CODEC_ID_VMNC, VIDEO_ES },
149 { VLC_CODEC_VP5, AV_CODEC_ID_VP5, VIDEO_ES },
150 { VLC_CODEC_VP6, AV_CODEC_ID_VP6, VIDEO_ES },
151 { VLC_CODEC_VP6F, AV_CODEC_ID_VP6F, VIDEO_ES },
152 { VLC_CODEC_TARGA, AV_CODEC_ID_TARGA, VIDEO_ES },
153 { VLC_CODEC_DSICINVIDEO, AV_CODEC_ID_DSICINVIDEO, VIDEO_ES },
154 { VLC_CODEC_TIERTEXSEQVIDEO, AV_CODEC_ID_TIERTEXSEQVIDEO, VIDEO_ES },
155 { VLC_CODEC_TIFF, AV_CODEC_ID_TIFF, VIDEO_ES },
156 { VLC_CODEC_GIF, AV_CODEC_ID_GIF, VIDEO_ES },
157 { VLC_CODEC_DXA, AV_CODEC_ID_DXA, VIDEO_ES },
158 { VLC_CODEC_DNXHD, AV_CODEC_ID_DNXHD, VIDEO_ES },
159 { VLC_CODEC_THP, AV_CODEC_ID_THP, VIDEO_ES },
160 { VLC_CODEC_SGI, AV_CODEC_ID_SGI, VIDEO_ES },
161 { VLC_CODEC_C93, AV_CODEC_ID_C93, VIDEO_ES },
162 { VLC_CODEC_BETHSOFTVID, AV_CODEC_ID_BETHSOFTVID, VIDEO_ES },
163 /* AV_CODEC_ID_PTX */
164 { VLC_CODEC_TXD, AV_CODEC_ID_TXD, VIDEO_ES },
165 { VLC_CODEC_VP6A, AV_CODEC_ID_VP6A, VIDEO_ES },
166 { VLC_CODEC_AMV, AV_CODEC_ID_AMV, VIDEO_ES },
167 { VLC_CODEC_VB, AV_CODEC_ID_VB, VIDEO_ES },
168 { VLC_CODEC_PCX, AV_CODEC_ID_PCX, VIDEO_ES },
169 /* AV_CODEC_ID_SUNRAST */
170 { VLC_CODEC_INDEO4, AV_CODEC_ID_INDEO4, VIDEO_ES },
171 { VLC_CODEC_INDEO5, AV_CODEC_ID_INDEO5, VIDEO_ES },
172 { VLC_CODEC_MIMIC, AV_CODEC_ID_MIMIC, VIDEO_ES },
173 { VLC_CODEC_RL2, AV_CODEC_ID_RL2, VIDEO_ES },
174 { VLC_CODEC_ESCAPE124, AV_CODEC_ID_ESCAPE124, VIDEO_ES },
175 { VLC_CODEC_DIRAC, AV_CODEC_ID_DIRAC, VIDEO_ES },
176 { VLC_CODEC_BFI, AV_CODEC_ID_BFI, VIDEO_ES },
177 { VLC_CODEC_CMV, AV_CODEC_ID_CMV, VIDEO_ES },
178 { VLC_CODEC_MOTIONPIXELS, AV_CODEC_ID_MOTIONPIXELS, VIDEO_ES },
179 { VLC_CODEC_TGV, AV_CODEC_ID_TGV, VIDEO_ES },
180 { VLC_CODEC_TGQ, AV_CODEC_ID_TGQ, VIDEO_ES },
181 { VLC_CODEC_TQI, AV_CODEC_ID_TQI, VIDEO_ES },
182 { VLC_CODEC_AURA, AV_CODEC_ID_AURA, VIDEO_ES },
183 /* AV_CODEC_ID_AURA2 */
184 /* AV_CODEC_ID_V210X */
185 { VLC_CODEC_TMV, AV_CODEC_ID_TMV, VIDEO_ES },
186 { VLC_CODEC_V210, AV_CODEC_ID_V210, VIDEO_ES },
187 /* AV_CODEC_ID_DPX */
188 { VLC_CODEC_MAD, AV_CODEC_ID_MAD, VIDEO_ES },
189 { VLC_CODEC_FRWU, AV_CODEC_ID_FRWU, VIDEO_ES },
190 { VLC_CODEC_FLASHSV2, AV_CODEC_ID_FLASHSV2, VIDEO_ES },
191 /* AV_CODEC_ID_CDGRAPHICS */
192 /* AV_CODEC_ID_R210 */
193 { VLC_CODEC_ANM, AV_CODEC_ID_ANM, VIDEO_ES },
194 { VLC_CODEC_BINKVIDEO, AV_CODEC_ID_BINKVIDEO, VIDEO_ES },
195 /* AV_CODEC_ID_IFF_ILBM */
196 /* AV_CODEC_ID_IFF_BYTERUN1 */
197 { VLC_CODEC_KGV1, AV_CODEC_ID_KGV1, VIDEO_ES },
198 { VLC_CODEC_YOP, AV_CODEC_ID_YOP, VIDEO_ES },
199 { VLC_CODEC_VP8, AV_CODEC_ID_VP8, VIDEO_ES },
200 /* AV_CODEC_ID_PICTOR */
201 /* AV_CODEC_ID_ANSI */
202 /* AV_CODEC_ID_A64_MULTI */
203 /* AV_CODEC_ID_A64_MULTI5 */
204 /* AV_CODEC_ID_R10K */
205 { VLC_CODEC_MXPEG, AV_CODEC_ID_MXPEG, VIDEO_ES },
206 { VLC_CODEC_LAGARITH, AV_CODEC_ID_LAGARITH, VIDEO_ES },
207 { VLC_CODEC_PRORES, AV_CODEC_ID_PRORES, VIDEO_ES },
208 { VLC_CODEC_JV, AV_CODEC_ID_JV, VIDEO_ES },
209 { VLC_CODEC_DFA, AV_CODEC_ID_DFA, VIDEO_ES },
210 { VLC_CODEC_WMVP, AV_CODEC_ID_WMV3IMAGE, VIDEO_ES },
211 { VLC_CODEC_WMVP2, AV_CODEC_ID_VC1IMAGE, VIDEO_ES },
212 { VLC_CODEC_UTVIDEO, AV_CODEC_ID_UTVIDEO, VIDEO_ES },
213 { VLC_CODEC_BMVVIDEO, AV_CODEC_ID_BMV_VIDEO, VIDEO_ES },
214 { VLC_CODEC_VBLE, AV_CODEC_ID_VBLE, VIDEO_ES },
215 { VLC_CODEC_DXTORY, AV_CODEC_ID_DXTORY, VIDEO_ES },
216 /* AV_CODEC_ID_V410 */
217 /* AV_CODEC_ID_XWD */
218 { VLC_CODEC_CDXL, AV_CODEC_ID_CDXL, VIDEO_ES },
219 /* AV_CODEC_ID_XBM */
220 /* AV_CODEC_ID_ZEROCODEC */
221 { VLC_CODEC_MSS1, AV_CODEC_ID_MSS1, VIDEO_ES },
222 { VLC_CODEC_MSA1, AV_CODEC_ID_MSA1, VIDEO_ES },
223 { VLC_CODEC_TSC2, AV_CODEC_ID_TSCC2, VIDEO_ES },
224 { VLC_CODEC_MTS2, AV_CODEC_ID_MTS2, VIDEO_ES },
225 { VLC_CODEC_CLLC, AV_CODEC_ID_CLLC, VIDEO_ES },
226 { VLC_CODEC_MSS2, AV_CODEC_ID_MSS2, VIDEO_ES },
227 { VLC_CODEC_VP9, AV_CODEC_ID_VP9, VIDEO_ES },
228 { VLC_CODEC_ICOD, AV_CODEC_ID_AIC, VIDEO_ES },
229 /* AV_CODEC_ID_ESCAPE130 */
230 { VLC_CODEC_G2M4, AV_CODEC_ID_G2M, VIDEO_ES },
231 /* AV_CODEC_ID_WEBP */
232 { VLC_CODEC_HNM4_VIDEO, AV_CODEC_ID_HNM4_VIDEO, VIDEO_ES },
233 { VLC_CODEC_HEVC, AV_CODEC_ID_HEVC, VIDEO_ES },
235 { VLC_CODEC_FIC , AV_CODEC_ID_FIC, VIDEO_ES },
236 /* AV_CODEC_ID_ALIAS_PIX */
237 /* AV_CODEC_ID_BRENDER_PIX */
238 /* AV_CODEC_ID_PAF_VIDEO */
239 /* AV_CODEC_ID_EXR */
241 { VLC_CODEC_VP7 , AV_CODEC_ID_VP7, VIDEO_ES },
242 /* AV_CODEC_ID_SANM */
243 /* AV_CODEC_ID_SGIRLE */
244 /* AV_CODEC_ID_MVC1 */
245 /* AV_CODEC_ID_MVC2 */
246 { VLC_CODEC_HQX, AV_CODEC_ID_HQX, VIDEO_ES },
248 { VLC_CODEC_TDSC, AV_CODEC_ID_TDSC, VIDEO_ES },
250 { VLC_CODEC_HQ_HQA, AV_CODEC_ID_HQ_HQA, VIDEO_ES },
252 { VLC_CODEC_HAP, AV_CODEC_ID_HAP, VIDEO_ES },
253 /* AV_CODEC_ID_DDS */
255 { VLC_CODEC_DXV, AV_CODEC_ID_DXV, VIDEO_ES },
257 { VLC_CODEC_G2M2, AV_CODEC_ID_G2M, VIDEO_ES },
258 { VLC_CODEC_G2M3, AV_CODEC_ID_G2M, VIDEO_ES },
260 /* ffmpeg only: AV_CODEC_ID_BRENDER_PIX */
261 /* ffmpeg only: AV_CODEC_ID_Y41P */
262 /* ffmpeg only: AV_CODEC_ID_EXR */
263 /* ffmpeg only: AV_CODEC_ID_AVRP */
264 /* ffmpeg only: AV_CODEC_ID_012V */
265 /* ffmpeg only: AV_CODEC_ID_AVUI */
266 /* ffmpeg only: AV_CODEC_ID_AYUV */
267 /* ffmpeg only: AV_CODEC_ID_TARGA_Y216 */
268 /* ffmpeg only: AV_CODEC_ID_V308 */
269 /* ffmpeg only: AV_CODEC_ID_V408 */
270 /* ffmpeg only: AV_CODEC_ID_YUV4 */
271 /* ffmpeg only: AV_CODEC_ID_SANM */
272 /* ffmpeg only: AV_CODEC_ID_PAF_VIDEO */
273 /* ffmpeg only: AV_CODEC_ID_AVRN */
274 /* ffmpeg only: AV_CODEC_ID_CPIA */
275 /* ffmpeg only: AV_CODEC_ID_XFACE */
276 /* ffmpeg only: AV_CODEC_ID_SGIRLE */
277 /* ffmpeg only: AV_CODEC_ID_MVC1 */
278 /* ffmpeg only: AV_CODEC_ID_MVC2 */
279 /* ffmpeg only: AV_CODEC_ID_SNOW */
280 /* ffmpeg only: AV_CODEC_ID_SMVJPEG */
282 #if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 70, 100 )
283 { VLC_CODEC_PIXLET, AV_CODEC_ID_PIXLET, VIDEO_ES },
284 #endif
286 #if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 101 )
287 { VLC_CODEC_SPEEDHQ, AV_CODEC_ID_SPEEDHQ, VIDEO_ES },
288 #endif
291 * Audio Codecs
294 /* PCM */
295 { VLC_CODEC_S16L, AV_CODEC_ID_PCM_S16LE, AUDIO_ES },
296 { VLC_CODEC_S16B, AV_CODEC_ID_PCM_S16BE, AUDIO_ES },
297 { VLC_CODEC_U16L, AV_CODEC_ID_PCM_U16LE, AUDIO_ES },
298 { VLC_CODEC_U16B, AV_CODEC_ID_PCM_U16BE, AUDIO_ES },
299 { VLC_CODEC_S8, AV_CODEC_ID_PCM_S8, AUDIO_ES },
300 { VLC_CODEC_U8, AV_CODEC_ID_PCM_U8, AUDIO_ES },
301 { VLC_CODEC_MULAW, AV_CODEC_ID_PCM_MULAW, AUDIO_ES },
302 { VLC_CODEC_ALAW, AV_CODEC_ID_PCM_ALAW, AUDIO_ES },
303 { VLC_CODEC_S32L, AV_CODEC_ID_PCM_S32LE, AUDIO_ES },
304 { VLC_CODEC_S32B, AV_CODEC_ID_PCM_S32BE, AUDIO_ES },
305 { VLC_CODEC_U32L, AV_CODEC_ID_PCM_U32LE, AUDIO_ES },
306 { VLC_CODEC_U32B, AV_CODEC_ID_PCM_U32BE, AUDIO_ES },
307 { VLC_CODEC_S24L, AV_CODEC_ID_PCM_S24LE, AUDIO_ES },
308 { VLC_CODEC_S24B, AV_CODEC_ID_PCM_S24BE, AUDIO_ES },
309 { VLC_CODEC_U24L, AV_CODEC_ID_PCM_U24LE, AUDIO_ES },
310 { VLC_CODEC_U24B, AV_CODEC_ID_PCM_U24BE, AUDIO_ES },
311 { VLC_CODEC_S24DAUD, AV_CODEC_ID_PCM_S24DAUD, AUDIO_ES },
312 /* AV_CODEC_ID_PCM_ZORK */
313 { VLC_CODEC_S16L_PLANAR, AV_CODEC_ID_PCM_S16LE_PLANAR, AUDIO_ES },
314 /* AV_CODEC_ID_PCM_DVD */
315 { VLC_CODEC_F32B, AV_CODEC_ID_PCM_F32BE, AUDIO_ES },
316 { VLC_CODEC_F32L, AV_CODEC_ID_PCM_F32LE, AUDIO_ES },
317 { VLC_CODEC_F64B, AV_CODEC_ID_PCM_F64BE, AUDIO_ES },
318 { VLC_CODEC_F64L, AV_CODEC_ID_PCM_F64LE, AUDIO_ES },
319 { VLC_CODEC_BD_LPCM, AV_CODEC_ID_PCM_BLURAY, AUDIO_ES },
320 /* AV_CODEC_ID_PCM_LXF */
321 /* AV_CODEC_ID_S302M */
322 /* AV_CODEC_ID_PCM_S8_PLANAR */
323 /* AV_CODEC_ID_PCM_S24LE_PLANAR */
324 /* AV_CODEC_ID_PCM_S32LE_PLANAR */
325 /* ffmpeg only: AV_CODEC_ID_PCM_S16BE_PLANAR */
327 /* ADPCM */
328 { VLC_CODEC_ADPCM_IMA_QT, AV_CODEC_ID_ADPCM_IMA_QT, AUDIO_ES },
329 { VLC_CODEC_ADPCM_IMA_WAV, AV_CODEC_ID_ADPCM_IMA_WAV, AUDIO_ES },
330 /* AV_CODEC_ID_ADPCM_IMA_DK3 */
331 /* AV_CODEC_ID_ADPCM_IMA_DK4 */
332 { VLC_CODEC_ADPCM_IMA_WS, AV_CODEC_ID_ADPCM_IMA_WS, AUDIO_ES },
333 /* AV_CODEC_ID_ADPCM_IMA_SMJPEG */
334 { VLC_CODEC_ADPCM_MS, AV_CODEC_ID_ADPCM_MS, AUDIO_ES },
335 { VLC_CODEC_ADPCM_4XM, AV_CODEC_ID_ADPCM_4XM, AUDIO_ES },
336 { VLC_CODEC_ADPCM_XA, AV_CODEC_ID_ADPCM_XA, AUDIO_ES },
337 { VLC_CODEC_ADPCM_ADX, AV_CODEC_ID_ADPCM_ADX, AUDIO_ES },
338 { VLC_CODEC_ADPCM_EA, AV_CODEC_ID_ADPCM_EA, AUDIO_ES },
339 { VLC_CODEC_ADPCM_G726, AV_CODEC_ID_ADPCM_G726, AUDIO_ES },
340 { VLC_CODEC_ADPCM_CREATIVE, AV_CODEC_ID_ADPCM_CT, AUDIO_ES },
341 { VLC_CODEC_ADPCM_SWF, AV_CODEC_ID_ADPCM_SWF, AUDIO_ES },
342 { VLC_CODEC_ADPCM_YAMAHA, AV_CODEC_ID_ADPCM_YAMAHA, AUDIO_ES },
343 { VLC_CODEC_ADPCM_SBPRO_4, AV_CODEC_ID_ADPCM_SBPRO_4, AUDIO_ES },
344 { VLC_CODEC_ADPCM_SBPRO_3, AV_CODEC_ID_ADPCM_SBPRO_3, AUDIO_ES },
345 { VLC_CODEC_ADPCM_SBPRO_2, AV_CODEC_ID_ADPCM_SBPRO_2, AUDIO_ES },
346 { VLC_CODEC_ADPCM_THP, AV_CODEC_ID_ADPCM_THP, AUDIO_ES },
347 { VLC_CODEC_ADPCM_IMA_AMV, AV_CODEC_ID_ADPCM_IMA_AMV, AUDIO_ES },
348 { VLC_CODEC_ADPCM_EA_R1, AV_CODEC_ID_ADPCM_EA_R1, AUDIO_ES },
349 /* AV_CODEC_ID_ADPCM_EA_R3 */
350 /* AV_CODEC_ID_ADPCM_EA_R2 */
351 { VLC_CODEC_ADPCM_IMA_EA_SEAD, AV_CODEC_ID_ADPCM_IMA_EA_SEAD, AUDIO_ES },
352 /* AV_CODEC_ID_ADPCM_IMA_EA_EACS */
353 /* AV_CODEC_ID_ADPCM_EA_XAS */
354 /* AV_CODEC_ID_ADPCM_EA_MAXIS_XA */
355 /* AV_CODEC_ID_ADPCM_IMA_ISS */
356 { VLC_CODEC_ADPCM_G722, AV_CODEC_ID_ADPCM_G722, AUDIO_ES },
357 { VLC_CODEC_ADPCM_IMA_APC, AV_CODEC_ID_ADPCM_IMA_APC, AUDIO_ES },
358 /* ffmpeg only: AV_CODEC_ID_VIMA */
359 /* ffmpeg only: AV_CODEC_ID_ADPCM_AFC */
360 /* ffmpeg only: AV_CODEC_ID_ADPCM_IMA_OKI */
361 /* ffmpeg only: AV_CODEC_ID_ADPCM_DTK */
362 /* ffmpeg only: AV_CODEC_ID_ADPCM_IMA_RAD */
363 /* ffmpeg only: AV_CODEC_ID_ADPCM_G726LE */
365 /* AMR */
366 { VLC_CODEC_AMR_NB, AV_CODEC_ID_AMR_NB, AUDIO_ES },
367 { VLC_CODEC_AMR_WB, AV_CODEC_ID_AMR_WB, AUDIO_ES },
369 /* RealAudio */
370 { VLC_CODEC_RA_144, AV_CODEC_ID_RA_144, AUDIO_ES },
371 { VLC_CODEC_RA_288, AV_CODEC_ID_RA_288, AUDIO_ES },
373 /* DPCM */
374 { VLC_CODEC_ROQ_DPCM, AV_CODEC_ID_ROQ_DPCM, AUDIO_ES },
375 { VLC_CODEC_INTERPLAY_DPCM, AV_CODEC_ID_INTERPLAY_DPCM, AUDIO_ES },
376 /* AV_CODEC_ID_XAN_DPCM */
377 /* AV_CODEC_ID_SOL_DPCM */
379 /* audio codecs */
380 { VLC_CODEC_MP3, AV_CODEC_ID_MP3, AUDIO_ES },
381 { VLC_CODEC_MPGA, AV_CODEC_ID_MP2, AUDIO_ES },
382 { VLC_CODEC_MP2, AV_CODEC_ID_MP2, AUDIO_ES },
383 { VLC_CODEC_MP4A, AV_CODEC_ID_AAC, AUDIO_ES },
384 { VLC_CODEC_A52, AV_CODEC_ID_AC3, AUDIO_ES },
385 { VLC_CODEC_DTS, AV_CODEC_ID_DTS, AUDIO_ES },
386 { VLC_CODEC_VORBIS, AV_CODEC_ID_VORBIS, AUDIO_ES },
387 { VLC_CODEC_DVAUDIO, AV_CODEC_ID_DVAUDIO, AUDIO_ES },
388 { VLC_CODEC_WMA1, AV_CODEC_ID_WMAV1, AUDIO_ES },
389 { VLC_CODEC_WMA2, AV_CODEC_ID_WMAV2, AUDIO_ES },
390 { VLC_CODEC_MACE3, AV_CODEC_ID_MACE3, AUDIO_ES },
391 { VLC_CODEC_MACE6, AV_CODEC_ID_MACE6, AUDIO_ES },
392 { VLC_CODEC_VMDAUDIO, AV_CODEC_ID_VMDAUDIO, AUDIO_ES },
393 { VLC_CODEC_FLAC, AV_CODEC_ID_FLAC, AUDIO_ES },
394 /* AV_CODEC_ID_MP3ADU */
395 /* AV_CODEC_ID_MP3ON4 */
396 { VLC_CODEC_SHORTEN, AV_CODEC_ID_SHORTEN, AUDIO_ES },
397 { VLC_CODEC_ALAC, AV_CODEC_ID_ALAC, AUDIO_ES },
398 /* AV_CODEC_ID_WESTWOOD_SND1 */
399 { VLC_CODEC_GSM, AV_CODEC_ID_GSM, AUDIO_ES },
400 { VLC_CODEC_QDM2, AV_CODEC_ID_QDM2, AUDIO_ES },
401 #if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
402 { VLC_CODEC_QDMC, AV_CODEC_ID_QDMC, AUDIO_ES },
403 #endif
404 { VLC_CODEC_COOK, AV_CODEC_ID_COOK, AUDIO_ES },
405 { VLC_CODEC_TRUESPEECH, AV_CODEC_ID_TRUESPEECH, AUDIO_ES },
406 { VLC_CODEC_TTA, AV_CODEC_ID_TTA, AUDIO_ES },
407 { VLC_CODEC_SMACKAUDIO, AV_CODEC_ID_SMACKAUDIO, AUDIO_ES },
408 { VLC_CODEC_QCELP, AV_CODEC_ID_QCELP, AUDIO_ES },
409 { VLC_CODEC_WAVPACK, AV_CODEC_ID_WAVPACK, AUDIO_ES },
410 { VLC_CODEC_DSICINAUDIO, AV_CODEC_ID_DSICINAUDIO, AUDIO_ES },
411 { VLC_CODEC_IMC, AV_CODEC_ID_IMC, AUDIO_ES },
412 { VLC_CODEC_MUSEPACK7, AV_CODEC_ID_MUSEPACK7, AUDIO_ES },
413 { VLC_CODEC_MLP, AV_CODEC_ID_MLP, AUDIO_ES },
414 { VLC_CODEC_GSM_MS, AV_CODEC_ID_GSM_MS, AUDIO_ES },
415 { VLC_CODEC_ATRAC3, AV_CODEC_ID_ATRAC3, AUDIO_ES },
416 { VLC_CODEC_APE, AV_CODEC_ID_APE, AUDIO_ES },
417 { VLC_CODEC_NELLYMOSER, AV_CODEC_ID_NELLYMOSER, AUDIO_ES },
418 { VLC_CODEC_MUSEPACK8, AV_CODEC_ID_MUSEPACK8, AUDIO_ES },
419 { VLC_CODEC_SPEEX, AV_CODEC_ID_SPEEX, AUDIO_ES },
420 { VLC_CODEC_WMAS, AV_CODEC_ID_WMAVOICE, AUDIO_ES },
421 { VLC_CODEC_WMAP, AV_CODEC_ID_WMAPRO, AUDIO_ES },
422 { VLC_CODEC_WMAL, AV_CODEC_ID_WMALOSSLESS, AUDIO_ES },
423 { VLC_CODEC_ATRAC3P, AV_CODEC_ID_ATRAC3P, AUDIO_ES },
424 { VLC_CODEC_EAC3, AV_CODEC_ID_EAC3, AUDIO_ES },
425 { VLC_CODEC_SIPR, AV_CODEC_ID_SIPR, AUDIO_ES },
426 /* AV_CODEC_ID_MP1 */
427 { VLC_CODEC_TWINVQ, AV_CODEC_ID_TWINVQ, AUDIO_ES },
428 { VLC_CODEC_TRUEHD, AV_CODEC_ID_TRUEHD, AUDIO_ES },
429 { VLC_CODEC_ALS, AV_CODEC_ID_MP4ALS, AUDIO_ES },
430 { VLC_CODEC_ATRAC1, AV_CODEC_ID_ATRAC1, AUDIO_ES },
431 { VLC_CODEC_BINKAUDIO_DCT, AV_CODEC_ID_BINKAUDIO_DCT, AUDIO_ES },
432 { VLC_CODEC_BINKAUDIO_RDFT, AV_CODEC_ID_BINKAUDIO_RDFT, AUDIO_ES },
433 { VLC_CODEC_MP4A, AV_CODEC_ID_AAC_LATM, AUDIO_ES },
434 /* AV_CODEC_ID_QDMC */
435 /* AV_CODEC_ID_CELT */
436 { VLC_CODEC_G723_1, AV_CODEC_ID_G723_1, AUDIO_ES },
437 /* AV_CODEC_ID_G729 */
438 /* AV_CODEC_ID_8SVX_EXP */
439 /* AV_CODEC_ID_8SVX_FIB */
440 { VLC_CODEC_BMVAUDIO, AV_CODEC_ID_BMV_AUDIO, AUDIO_ES },
441 { VLC_CODEC_RALF, AV_CODEC_ID_RALF, AUDIO_ES },
442 { VLC_CODEC_INDEO_AUDIO, AV_CODEC_ID_IAC, AUDIO_ES },
443 /* AV_CODEC_ID_ILBC */
444 { VLC_CODEC_OPUS, AV_CODEC_ID_OPUS, AUDIO_ES },
445 /* AV_CODEC_ID_COMFORT_NOISE */
446 { VLC_CODEC_TAK, AV_CODEC_ID_TAK, AUDIO_ES },
447 { VLC_CODEC_METASOUND, AV_CODEC_ID_METASOUND, AUDIO_ES },
448 /* AV_CODEC_ID_PAF_AUDIO */
449 { VLC_CODEC_ON2AVC, AV_CODEC_ID_ON2AVC, AUDIO_ES },
451 /* ffmpeg only: AV_CODEC_ID_FFWAVESYNTH */
452 /* ffmpeg only: AV_CODEC_ID_SONIC */
453 /* ffmpeg only: AV_CODEC_ID_SONIC_LS */
454 /* ffmpeg only: AV_CODEC_ID_PAF_AUDIO */
455 /* ffmpeg only: AV_CODEC_ID_EVRC */
456 /* ffmpeg only: AV_CODEC_ID_SMV */
458 /* Subtitle streams */
459 { VLC_CODEC_SPU, AV_CODEC_ID_DVD_SUBTITLE, SPU_ES },
460 { VLC_CODEC_DVBS, AV_CODEC_ID_DVB_SUBTITLE, SPU_ES },
461 { VLC_CODEC_SUBT, AV_CODEC_ID_TEXT, SPU_ES },
462 { VLC_CODEC_XSUB, AV_CODEC_ID_XSUB, SPU_ES },
463 { VLC_CODEC_SSA, AV_CODEC_ID_SSA, SPU_ES },
464 /* AV_CODEC_ID_MOV_TEXT */
465 { VLC_CODEC_BD_PG, AV_CODEC_ID_HDMV_PGS_SUBTITLE, SPU_ES },
466 { VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT, SPU_ES },
467 /* AV_CODEC_ID_SRT */
468 /* ffmpeg only: AV_CODEC_ID_MICRODVD */
469 /* ffmpeg only: AV_CODEC_ID_EIA_608 */
470 /* ffmpeg only: AV_CODEC_ID_JACOSUB */
471 /* ffmpeg only: AV_CODEC_ID_SAMI */
472 /* ffmpeg only: AV_CODEC_ID_REALTEXT */
473 /* ffmpeg only: AV_CODEC_ID_SUBVIEWER1 */
474 /* ffmpeg only: AV_CODEC_ID_SUBVIEWER */
475 /* ffmpeg only: AV_CODEC_ID_SUBRIP */
476 /* ffmpeg only: AV_CODEC_ID_WEBVTT */
477 /* ffmpeg only: AV_CODEC_ID_MPL2 */
478 /* ffmpeg only: AV_CODEC_ID_VPLAYER */
479 /* ffmpeg only: AV_CODEC_ID_PJS */
480 /* ffmpeg only: AV_CODEC_ID_ASS */
483 static const size_t codecs_count = sizeof (codecs_table)
484 / sizeof (codecs_table[0]);
486 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
487 unsigned *pi_ffmpeg_codec, const char **ppsz_name )
489 i_fourcc = vlc_fourcc_GetCodec( UNKNOWN_ES, i_fourcc );
490 for( unsigned i = 0; i < codecs_count; i++ )
492 if( codecs_table[i].i_fourcc == i_fourcc )
494 if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
495 if( pi_ffmpeg_codec ) *pi_ffmpeg_codec = codecs_table[i].i_codec;
496 if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( UNKNOWN_ES, i_fourcc );//char *)codecs_table[i].psz_name;
498 return true;
501 return false;
504 int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat,
505 vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
507 for( unsigned i = 0; i < codecs_count; i++ )
509 if( codecs_table[i].i_codec == i_ffmpeg_codec )
511 if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
512 if( pi_fourcc ) *pi_fourcc = codecs_table[i].i_fourcc;
513 if( ppsz_name ) *ppsz_name = vlc_fourcc_GetDescription( codecs_table[i].i_cat, codecs_table[i].i_fourcc );
515 return true;
518 return false;