]> git.sesse.net Git - ffmpeg/blob - libavcodec/audiotoolboxdec.c
9db1ad975294911dc7962932709ee3db5021ea16
[ffmpeg] / libavcodec / audiotoolboxdec.c
1 /*
2  * Audio Toolbox system codecs
3  *
4  * copyright (c) 2016 Rodger Combs
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 #include <AudioToolbox/AudioToolbox.h>
24
25 #include "config.h"
26 #include "avcodec.h"
27 #include "ac3_parser.h"
28 #include "bytestream.h"
29 #include "internal.h"
30 #include "mpegaudiodecheader.h"
31 #include "libavutil/avassert.h"
32 #include "libavutil/opt.h"
33 #include "libavutil/log.h"
34
35 #ifndef __MAC_10_11
36 #define kAudioFormatEnhancedAC3 'ec-3'
37 #endif
38
39 typedef struct ATDecodeContext {
40     AVClass *av_class;
41
42     AudioConverterRef converter;
43     AudioStreamPacketDescription pkt_desc;
44     AVPacket in_pkt;
45     AVPacket new_in_pkt;
46     AVBitStreamFilterContext *bsf;
47     char *decoded_data;
48     int channel_map[64];
49
50     int64_t last_pts;
51     int eof;
52 } ATDecodeContext;
53
54 static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
55 {
56     switch (codec) {
57     case AV_CODEC_ID_AAC:
58         return kAudioFormatMPEG4AAC;
59     case AV_CODEC_ID_AC3:
60         return kAudioFormatAC3;
61     case AV_CODEC_ID_ADPCM_IMA_QT:
62         return kAudioFormatAppleIMA4;
63     case AV_CODEC_ID_ALAC:
64         return kAudioFormatAppleLossless;
65     case AV_CODEC_ID_AMR_NB:
66         return kAudioFormatAMR;
67     case AV_CODEC_ID_EAC3:
68         return kAudioFormatEnhancedAC3;
69     case AV_CODEC_ID_GSM_MS:
70         return kAudioFormatMicrosoftGSM;
71     case AV_CODEC_ID_ILBC:
72         return kAudioFormatiLBC;
73     case AV_CODEC_ID_MP1:
74         return kAudioFormatMPEGLayer1;
75     case AV_CODEC_ID_MP2:
76         return kAudioFormatMPEGLayer2;
77     case AV_CODEC_ID_MP3:
78         return kAudioFormatMPEGLayer3;
79     case AV_CODEC_ID_PCM_ALAW:
80         return kAudioFormatALaw;
81     case AV_CODEC_ID_PCM_MULAW:
82         return kAudioFormatULaw;
83     case AV_CODEC_ID_QDMC:
84         return kAudioFormatQDesign;
85     case AV_CODEC_ID_QDM2:
86         return kAudioFormatQDesign2;
87     default:
88         av_assert0(!"Invalid codec ID!");
89         return 0;
90     }
91 }
92
93 static int ffat_get_channel_id(AudioChannelLabel label)
94 {
95     if (label == 0)
96         return -1;
97     else if (label <= kAudioChannelLabel_LFEScreen)
98         return label - 1;
99     else if (label <= kAudioChannelLabel_RightSurround)
100         return label + 4;
101     else if (label <= kAudioChannelLabel_CenterSurround)
102         return label + 1;
103     else if (label <= kAudioChannelLabel_RightSurroundDirect)
104         return label + 23;
105     else if (label <= kAudioChannelLabel_TopBackRight)
106         return label - 1;
107     else if (label < kAudioChannelLabel_RearSurroundLeft)
108         return -1;
109     else if (label <= kAudioChannelLabel_RearSurroundRight)
110         return label - 29;
111     else if (label <= kAudioChannelLabel_RightWide)
112         return label - 4;
113     else if (label == kAudioChannelLabel_LFE2)
114         return ff_ctzll(AV_CH_LOW_FREQUENCY_2);
115     else if (label == kAudioChannelLabel_Mono)
116         return ff_ctzll(AV_CH_FRONT_CENTER);
117     else
118         return -1;
119 }
120
121 static int ffat_compare_channel_descriptions(const void* a, const void* b)
122 {
123     const AudioChannelDescription* da = a;
124     const AudioChannelDescription* db = b;
125     return ffat_get_channel_id(da->mChannelLabel) - ffat_get_channel_id(db->mChannelLabel);
126 }
127
128 static AudioChannelLayout *ffat_convert_layout(AudioChannelLayout *layout, UInt32* size)
129 {
130     AudioChannelLayoutTag tag = layout->mChannelLayoutTag;
131     AudioChannelLayout *new_layout;
132     if (tag == kAudioChannelLayoutTag_UseChannelDescriptions)
133         return layout;
134     else if (tag == kAudioChannelLayoutTag_UseChannelBitmap)
135         AudioFormatGetPropertyInfo(kAudioFormatProperty_ChannelLayoutForBitmap,
136                                    sizeof(UInt32), &layout->mChannelBitmap, size);
137     else
138         AudioFormatGetPropertyInfo(kAudioFormatProperty_ChannelLayoutForTag,
139                                    sizeof(AudioChannelLayoutTag), &tag, size);
140     new_layout = av_malloc(*size);
141     if (!new_layout) {
142         av_free(layout);
143         return NULL;
144     }
145     if (tag == kAudioChannelLayoutTag_UseChannelBitmap)
146         AudioFormatGetProperty(kAudioFormatProperty_ChannelLayoutForBitmap,
147                                sizeof(UInt32), &layout->mChannelBitmap, size, new_layout);
148     else
149         AudioFormatGetProperty(kAudioFormatProperty_ChannelLayoutForTag,
150                                sizeof(AudioChannelLayoutTag), &tag, size, new_layout);
151     new_layout->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions;
152     av_free(layout);
153     return new_layout;
154 }
155
156 static int ffat_update_ctx(AVCodecContext *avctx)
157 {
158     ATDecodeContext *at = avctx->priv_data;
159     AudioStreamBasicDescription format;
160     UInt32 size = sizeof(format);
161     if (!AudioConverterGetProperty(at->converter,
162                                    kAudioConverterCurrentInputStreamDescription,
163                                    &size, &format)) {
164         if (format.mSampleRate)
165             avctx->sample_rate = format.mSampleRate;
166         avctx->channels = format.mChannelsPerFrame;
167         avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
168         avctx->frame_size = format.mFramesPerPacket;
169     }
170
171     if (!AudioConverterGetProperty(at->converter,
172                                    kAudioConverterCurrentOutputStreamDescription,
173                                    &size, &format)) {
174         format.mSampleRate = avctx->sample_rate;
175         format.mChannelsPerFrame = avctx->channels;
176         AudioConverterSetProperty(at->converter,
177                                   kAudioConverterCurrentOutputStreamDescription,
178                                   size, &format);
179     }
180
181     if (!AudioConverterGetPropertyInfo(at->converter, kAudioConverterOutputChannelLayout,
182                                        &size, NULL) && size) {
183         AudioChannelLayout *layout = av_malloc(size);
184         uint64_t layout_mask = 0;
185         int i;
186         if (!layout)
187             return AVERROR(ENOMEM);
188         AudioConverterGetProperty(at->converter, kAudioConverterOutputChannelLayout,
189                                   &size, layout);
190         if (!(layout = ffat_convert_layout(layout, &size)))
191             return AVERROR(ENOMEM);
192         for (i = 0; i < layout->mNumberChannelDescriptions; i++) {
193             int id = ffat_get_channel_id(layout->mChannelDescriptions[i].mChannelLabel);
194             if (id < 0)
195                 goto done;
196             if (layout_mask & (1 << id))
197                 goto done;
198             layout_mask |= 1 << id;
199             layout->mChannelDescriptions[i].mChannelFlags = i; // Abusing flags as index
200         }
201         avctx->channel_layout = layout_mask;
202         qsort(layout->mChannelDescriptions, layout->mNumberChannelDescriptions,
203               sizeof(AudioChannelDescription), &ffat_compare_channel_descriptions);
204         for (i = 0; i < layout->mNumberChannelDescriptions; i++)
205             at->channel_map[i] = layout->mChannelDescriptions[i].mChannelFlags;
206 done:
207         av_free(layout);
208     }
209
210     if (!avctx->frame_size)
211         avctx->frame_size = 2048;
212
213     return 0;
214 }
215
216 static void put_descr(PutByteContext *pb, int tag, unsigned int size)
217 {
218     int i = 3;
219     bytestream2_put_byte(pb, tag);
220     for (; i > 0; i--)
221         bytestream2_put_byte(pb, (size >> (7 * i)) | 0x80);
222     bytestream2_put_byte(pb, size & 0x7F);
223 }
224
225 static uint8_t* ffat_get_magic_cookie(AVCodecContext *avctx, UInt32 *cookie_size)
226 {
227         if (avctx->codec_id == AV_CODEC_ID_AAC) {
228             char *extradata;
229             PutByteContext pb;
230             *cookie_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
231             if (!(extradata = av_malloc(*cookie_size)))
232                 return NULL;
233
234             bytestream2_init_writer(&pb, extradata, *cookie_size);
235
236             // ES descriptor
237             put_descr(&pb, 0x03, 3 + 5+13 + 5+avctx->extradata_size);
238             bytestream2_put_be16(&pb, 0);
239             bytestream2_put_byte(&pb, 0x00); // flags (= no flags)
240
241             // DecoderConfig descriptor
242             put_descr(&pb, 0x04, 13 + 5+avctx->extradata_size);
243
244             // Object type indication
245             bytestream2_put_byte(&pb, 0x40);
246
247             bytestream2_put_byte(&pb, 0x15); // flags (= Audiostream)
248
249             bytestream2_put_be24(&pb, 0); // Buffersize DB
250
251             bytestream2_put_be32(&pb, 0); // maxbitrate
252             bytestream2_put_be32(&pb, 0); // avgbitrate
253
254             // DecoderSpecific info descriptor
255             put_descr(&pb, 0x05, avctx->extradata_size);
256             bytestream2_put_buffer(&pb, avctx->extradata, avctx->extradata_size);
257             return extradata;
258     } else {
259         *cookie_size = avctx->extradata_size;
260         return avctx->extradata;
261     }
262 }
263
264 static int ffat_set_extradata(AVCodecContext *avctx)
265 {
266     ATDecodeContext *at = avctx->priv_data;
267     if (avctx->extradata_size) {
268         OSStatus status;
269         UInt32 cookie_size;
270         uint8_t *cookie = ffat_get_magic_cookie(avctx, &cookie_size);
271         if (!cookie)
272             return AVERROR(ENOMEM);
273
274         status = AudioConverterSetProperty(at->converter,
275                                            kAudioConverterDecompressionMagicCookie,
276                                            cookie_size, cookie);
277         if (status != 0)
278             av_log(avctx, AV_LOG_WARNING, "AudioToolbox cookie error: %i\n", (int)status);
279
280         if (cookie != avctx->extradata)
281             av_free(cookie);
282     }
283     return 0;
284 }
285
286 static av_cold int ffat_create_decoder(AVCodecContext *avctx, AVPacket *pkt)
287 {
288     ATDecodeContext *at = avctx->priv_data;
289     OSStatus status;
290     int i;
291
292     enum AVSampleFormat sample_fmt = (avctx->bits_per_raw_sample == 32) ?
293                                      AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16;
294
295     AudioStreamBasicDescription in_format = {
296         .mFormatID = ffat_get_format_id(avctx->codec_id, avctx->profile),
297         .mBytesPerPacket = avctx->block_align,
298     };
299     AudioStreamBasicDescription out_format = {
300         .mFormatID = kAudioFormatLinearPCM,
301         .mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked,
302         .mFramesPerPacket = 1,
303         .mBitsPerChannel = av_get_bytes_per_sample(sample_fmt) * 8,
304     };
305
306     avctx->sample_fmt = sample_fmt;
307
308     if (avctx->extradata) {
309         UInt32 format_size = sizeof(in_format);
310         UInt32 cookie_size;
311         uint8_t *cookie = ffat_get_magic_cookie(avctx, &cookie_size);
312         if (!cookie)
313             return AVERROR(ENOMEM);
314         status = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
315                                         cookie_size, cookie, &format_size, &in_format);
316         if (cookie != avctx->extradata)
317             av_free(cookie);
318         if (status != 0) {
319             av_log(avctx, AV_LOG_ERROR, "AudioToolbox header-parse error: %i\n", (int)status);
320             return AVERROR_UNKNOWN;
321         }
322 #if CONFIG_MP1_AT_DECODER || CONFIG_MP2_AT_DECODER || CONFIG_MP3_AT_DECODER
323     } else if (pkt && pkt->size >= 4 &&
324                (avctx->codec_id == AV_CODEC_ID_MP1 ||
325                 avctx->codec_id == AV_CODEC_ID_MP2 ||
326                 avctx->codec_id == AV_CODEC_ID_MP3)) {
327         enum AVCodecID codec_id;
328         int bit_rate;
329         if (ff_mpa_decode_header(AV_RB32(pkt->data), &avctx->sample_rate,
330                                  &in_format.mChannelsPerFrame, &avctx->frame_size,
331                                  &bit_rate, &codec_id) < 0)
332             return AVERROR_INVALIDDATA;
333         avctx->bit_rate = bit_rate;
334         in_format.mSampleRate = avctx->sample_rate;
335 #endif
336 #if CONFIG_AC3_AT_DECODER || CONFIG_EAC3_AT_DECODER
337     } else if (pkt && pkt->size >= 7 &&
338                (avctx->codec_id == AV_CODEC_ID_AC3 ||
339                 avctx->codec_id == AV_CODEC_ID_EAC3)) {
340         AC3HeaderInfo hdr, *phdr = &hdr;
341         GetBitContext gbc;
342         init_get_bits(&gbc, pkt->data, pkt->size);
343         if (avpriv_ac3_parse_header(&gbc, &phdr) < 0)
344             return AVERROR_INVALIDDATA;
345         in_format.mSampleRate = hdr.sample_rate;
346         in_format.mChannelsPerFrame = hdr.channels;
347         avctx->frame_size = hdr.num_blocks * 256;
348         avctx->bit_rate = hdr.bit_rate;
349 #endif
350     } else {
351         in_format.mSampleRate = avctx->sample_rate ? avctx->sample_rate : 44100;
352         in_format.mChannelsPerFrame = avctx->channels ? avctx->channels : 1;
353     }
354
355     avctx->sample_rate = out_format.mSampleRate = in_format.mSampleRate;
356     avctx->channels = out_format.mChannelsPerFrame = in_format.mChannelsPerFrame;
357
358     if (avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_QT)
359         in_format.mFramesPerPacket = 64;
360
361     status = AudioConverterNew(&in_format, &out_format, &at->converter);
362
363     if (status != 0) {
364         av_log(avctx, AV_LOG_ERROR, "AudioToolbox init error: %i\n", (int)status);
365         return AVERROR_UNKNOWN;
366     }
367
368     if ((status = ffat_set_extradata(avctx)) < 0)
369         return status;
370
371     for (i = 0; i < (sizeof(at->channel_map) / sizeof(at->channel_map[0])); i++)
372         at->channel_map[i] = i;
373
374     ffat_update_ctx(avctx);
375
376     if(!(at->decoded_data = av_malloc(av_get_bytes_per_sample(avctx->sample_fmt)
377                                       * avctx->frame_size * avctx->channels)))
378         return AVERROR(ENOMEM);
379
380     at->last_pts = AV_NOPTS_VALUE;
381
382     return 0;
383 }
384
385 static av_cold int ffat_init_decoder(AVCodecContext *avctx)
386 {
387     if ((avctx->channels && avctx->sample_rate) || avctx->extradata_size)
388         return ffat_create_decoder(avctx, NULL);
389     else
390         return 0;
391 }
392
393 static OSStatus ffat_decode_callback(AudioConverterRef converter, UInt32 *nb_packets,
394                                      AudioBufferList *data,
395                                      AudioStreamPacketDescription **packets,
396                                      void *inctx)
397 {
398     AVCodecContext *avctx = inctx;
399     ATDecodeContext *at = avctx->priv_data;
400
401     if (at->eof) {
402         *nb_packets = 0;
403         if (packets) {
404             *packets = &at->pkt_desc;
405             at->pkt_desc.mDataByteSize = 0;
406         }
407         return 0;
408     }
409
410     av_packet_move_ref(&at->in_pkt, &at->new_in_pkt);
411     at->new_in_pkt.data = 0;
412     at->new_in_pkt.size = 0;
413
414     if (!at->in_pkt.data) {
415         *nb_packets = 0;
416         return 1;
417     }
418
419     data->mNumberBuffers              = 1;
420     data->mBuffers[0].mNumberChannels = 0;
421     data->mBuffers[0].mDataByteSize   = at->in_pkt.size;
422     data->mBuffers[0].mData           = at->in_pkt.data;
423     *nb_packets = 1;
424
425     if (packets) {
426         *packets = &at->pkt_desc;
427         at->pkt_desc.mDataByteSize = at->in_pkt.size;
428     }
429
430     return 0;
431 }
432
433 #define COPY_SAMPLES(type) \
434     type *in_ptr = (type*)at->decoded_data; \
435     type *end_ptr = in_ptr + frame->nb_samples * avctx->channels; \
436     type *out_ptr = (type*)frame->data[0]; \
437     for (; in_ptr < end_ptr; in_ptr += avctx->channels, out_ptr += avctx->channels) { \
438         int c; \
439         for (c = 0; c < avctx->channels; c++) \
440             out_ptr[c] = in_ptr[at->channel_map[c]]; \
441     }
442
443 static void ffat_copy_samples(AVCodecContext *avctx, AVFrame *frame)
444 {
445     ATDecodeContext *at = avctx->priv_data;
446     if (avctx->sample_fmt == AV_SAMPLE_FMT_S32) {
447         COPY_SAMPLES(int32_t);
448     } else {
449         COPY_SAMPLES(int16_t);
450     }
451 }
452
453 static int ffat_decode(AVCodecContext *avctx, void *data,
454                        int *got_frame_ptr, AVPacket *avpkt)
455 {
456     ATDecodeContext *at = avctx->priv_data;
457     AVFrame *frame = data;
458     int pkt_size = avpkt->size;
459     AVPacket filtered_packet;
460     OSStatus ret;
461     AudioBufferList out_buffers;
462
463     if (avctx->codec_id == AV_CODEC_ID_AAC && avpkt->size > 2 &&
464         (AV_RB16(avpkt->data) & 0xfff0) == 0xfff0) {
465         uint8_t *p_filtered = NULL;
466         int      n_filtered = 0;
467         if (!at->bsf) {
468             if(!(at->bsf = av_bitstream_filter_init("aac_adtstoasc")))
469                 return AVERROR(ENOMEM);
470         }
471
472         ret = av_bitstream_filter_filter(at->bsf, avctx, NULL, &p_filtered, &n_filtered,
473                                          avpkt->data, avpkt->size, 0);
474         if (ret >= 0 && p_filtered != avpkt->data) {
475             filtered_packet = *avpkt;
476             avpkt = &filtered_packet;
477             avpkt->data = p_filtered;
478             avpkt->size = n_filtered;
479         }
480     }
481
482     if (!at->converter) {
483         if ((ret = ffat_create_decoder(avctx, avpkt)) < 0)
484             return ret;
485     }
486
487     out_buffers = (AudioBufferList){
488         .mNumberBuffers = 1,
489         .mBuffers = {
490             {
491                 .mNumberChannels = avctx->channels,
492                 .mDataByteSize = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->frame_size
493                                  * avctx->channels,
494             }
495         }
496     };
497
498     av_packet_unref(&at->new_in_pkt);
499
500     if (avpkt->size) {
501         if ((ret = av_packet_ref(&at->new_in_pkt, avpkt)) < 0)
502             return ret;
503         at->new_in_pkt.data = avpkt->data;
504     } else {
505         at->eof = 1;
506     }
507
508     frame->sample_rate = avctx->sample_rate;
509
510     frame->nb_samples = avctx->frame_size;
511
512     out_buffers.mBuffers[0].mData = at->decoded_data;
513
514     ret = AudioConverterFillComplexBuffer(at->converter, ffat_decode_callback, avctx,
515                                           &frame->nb_samples, &out_buffers, NULL);
516     if ((!ret || ret == 1) && frame->nb_samples) {
517         if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
518             return ret;
519         ffat_copy_samples(avctx, frame);
520         *got_frame_ptr = 1;
521         if (at->last_pts != AV_NOPTS_VALUE) {
522             frame->pkt_pts = at->last_pts;
523             at->last_pts = avpkt->pts;
524         }
525     } else if (ret && ret != 1) {
526         av_log(avctx, AV_LOG_WARNING, "Decode error: %i\n", ret);
527     } else {
528         at->last_pts = avpkt->pts;
529     }
530
531     return pkt_size;
532 }
533
534 static av_cold void ffat_decode_flush(AVCodecContext *avctx)
535 {
536     ATDecodeContext *at = avctx->priv_data;
537     AudioConverterReset(at->converter);
538     av_packet_unref(&at->new_in_pkt);
539     av_packet_unref(&at->in_pkt);
540 }
541
542 static av_cold int ffat_close_decoder(AVCodecContext *avctx)
543 {
544     ATDecodeContext *at = avctx->priv_data;
545     AudioConverterDispose(at->converter);
546     av_packet_unref(&at->new_in_pkt);
547     av_packet_unref(&at->in_pkt);
548     av_free(at->decoded_data);
549     return 0;
550 }
551
552 #define FFAT_DEC_CLASS(NAME) \
553     static const AVClass ffat_##NAME##_dec_class = { \
554         .class_name = "at_" #NAME "_dec", \
555         .version    = LIBAVUTIL_VERSION_INT, \
556     };
557
558 #define FFAT_DEC(NAME, ID) \
559     FFAT_DEC_CLASS(NAME) \
560     AVCodec ff_##NAME##_at_decoder = { \
561         .name           = #NAME "_at", \
562         .long_name      = NULL_IF_CONFIG_SMALL(#NAME " (AudioToolbox)"), \
563         .type           = AVMEDIA_TYPE_AUDIO, \
564         .id             = ID, \
565         .priv_data_size = sizeof(ATDecodeContext), \
566         .init           = ffat_init_decoder, \
567         .close          = ffat_close_decoder, \
568         .decode         = ffat_decode, \
569         .flush          = ffat_decode_flush, \
570         .priv_class     = &ffat_##NAME##_dec_class, \
571         .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, \
572         .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE, \
573     };
574
575 FFAT_DEC(aac,          AV_CODEC_ID_AAC)
576 FFAT_DEC(ac3,          AV_CODEC_ID_AC3)
577 FFAT_DEC(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT)
578 FFAT_DEC(alac,         AV_CODEC_ID_ALAC)
579 FFAT_DEC(amr_nb,       AV_CODEC_ID_AMR_NB)
580 FFAT_DEC(eac3,         AV_CODEC_ID_EAC3)
581 FFAT_DEC(gsm_ms,       AV_CODEC_ID_GSM_MS)
582 FFAT_DEC(ilbc,         AV_CODEC_ID_ILBC)
583 FFAT_DEC(mp1,          AV_CODEC_ID_MP1)
584 FFAT_DEC(mp2,          AV_CODEC_ID_MP2)
585 FFAT_DEC(mp3,          AV_CODEC_ID_MP3)
586 FFAT_DEC(pcm_alaw,     AV_CODEC_ID_PCM_ALAW)
587 FFAT_DEC(pcm_mulaw,    AV_CODEC_ID_PCM_MULAW)
588 FFAT_DEC(qdmc,         AV_CODEC_ID_QDMC)
589 FFAT_DEC(qdm2,         AV_CODEC_ID_QDM2)