You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

597 lines
20KB

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