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.

630 lines
21KB

  1. /*
  2. * ALAC (Apple Lossless Audio Codec) decoder
  3. * Copyright (c) 2005 David Hammerton
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * ALAC (Apple Lossless Audio Codec) decoder
  24. * @author 2005 David Hammerton
  25. * @see http://crazney.net/programs/itunes/alac.html
  26. *
  27. * Note: This decoder expects a 36-byte QuickTime atom to be
  28. * passed through the extradata[_size] fields. This atom is tacked onto
  29. * the end of an 'alac' stsd atom and has the following format:
  30. *
  31. * 32 bits atom size
  32. * 32 bits tag ("alac")
  33. * 32 bits tag version (0)
  34. * 32 bits samples per frame (used when not set explicitly in the frames)
  35. * 8 bits compatible version (0)
  36. * 8 bits sample size
  37. * 8 bits history mult (40)
  38. * 8 bits initial history (10)
  39. * 8 bits rice param limit (14)
  40. * 8 bits channels
  41. * 16 bits maxRun (255)
  42. * 32 bits max coded frame size (0 means unknown)
  43. * 32 bits average bitrate (0 means unknown)
  44. * 32 bits samplerate
  45. */
  46. #include <inttypes.h>
  47. #include "libavutil/channel_layout.h"
  48. #include "libavutil/opt.h"
  49. #include "avcodec.h"
  50. #include "get_bits.h"
  51. #include "bytestream.h"
  52. #include "internal.h"
  53. #include "thread.h"
  54. #include "unary.h"
  55. #include "mathops.h"
  56. #include "alac_data.h"
  57. #include "alacdsp.h"
  58. #define ALAC_EXTRADATA_SIZE 36
  59. typedef struct ALACContext {
  60. AVClass *class;
  61. AVCodecContext *avctx;
  62. GetBitContext gb;
  63. int channels;
  64. int32_t *predict_error_buffer[2];
  65. int32_t *output_samples_buffer[2];
  66. int32_t *extra_bits_buffer[2];
  67. uint32_t max_samples_per_frame;
  68. uint8_t sample_size;
  69. uint8_t rice_history_mult;
  70. uint8_t rice_initial_history;
  71. uint8_t rice_limit;
  72. int sample_rate;
  73. int extra_bits; /**< number of extra bits beyond 16-bit */
  74. int nb_samples; /**< number of samples in the current frame */
  75. int direct_output;
  76. int extra_bit_bug;
  77. ALACDSPContext dsp;
  78. } ALACContext;
  79. static inline unsigned int decode_scalar(GetBitContext *gb, int k, int bps)
  80. {
  81. unsigned int x = get_unary_0_9(gb);
  82. if (x > 8) { /* RICE THRESHOLD */
  83. /* use alternative encoding */
  84. x = get_bits_long(gb, bps);
  85. } else if (k != 1) {
  86. int extrabits = show_bits(gb, k);
  87. /* multiply x by 2^k - 1, as part of their strange algorithm */
  88. x = (x << k) - x;
  89. if (extrabits > 1) {
  90. x += extrabits - 1;
  91. skip_bits(gb, k);
  92. } else
  93. skip_bits(gb, k - 1);
  94. }
  95. return x;
  96. }
  97. static int rice_decompress(ALACContext *alac, int32_t *output_buffer,
  98. int nb_samples, int bps, int rice_history_mult)
  99. {
  100. int i;
  101. unsigned int history = alac->rice_initial_history;
  102. int sign_modifier = 0;
  103. for (i = 0; i < nb_samples; i++) {
  104. int k;
  105. unsigned int x;
  106. if(get_bits_left(&alac->gb) <= 0)
  107. return AVERROR_INVALIDDATA;
  108. /* calculate rice param and decode next value */
  109. k = av_log2((history >> 9) + 3);
  110. k = FFMIN(k, alac->rice_limit);
  111. x = decode_scalar(&alac->gb, k, bps);
  112. x += sign_modifier;
  113. sign_modifier = 0;
  114. output_buffer[i] = (x >> 1) ^ -(x & 1);
  115. /* update the history */
  116. if (x > 0xffff)
  117. history = 0xffff;
  118. else
  119. history += x * rice_history_mult -
  120. ((history * rice_history_mult) >> 9);
  121. /* special case: there may be compressed blocks of 0 */
  122. if ((history < 128) && (i + 1 < nb_samples)) {
  123. int block_size;
  124. /* calculate rice param and decode block size */
  125. k = 7 - av_log2(history) + ((history + 16) >> 6);
  126. k = FFMIN(k, alac->rice_limit);
  127. block_size = decode_scalar(&alac->gb, k, 16);
  128. if (block_size > 0) {
  129. if (block_size >= nb_samples - i) {
  130. av_log(alac->avctx, AV_LOG_ERROR,
  131. "invalid zero block size of %d %d %d\n", block_size,
  132. nb_samples, i);
  133. block_size = nb_samples - i - 1;
  134. }
  135. memset(&output_buffer[i + 1], 0,
  136. block_size * sizeof(*output_buffer));
  137. i += block_size;
  138. }
  139. if (block_size <= 0xffff)
  140. sign_modifier = 1;
  141. history = 0;
  142. }
  143. }
  144. return 0;
  145. }
  146. static inline int sign_only(int v)
  147. {
  148. return v ? FFSIGN(v) : 0;
  149. }
  150. static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out,
  151. int nb_samples, int bps, int16_t *lpc_coefs,
  152. int lpc_order, int lpc_quant)
  153. {
  154. int i;
  155. uint32_t *pred = buffer_out;
  156. /* first sample always copies */
  157. *buffer_out = *error_buffer;
  158. if (nb_samples <= 1)
  159. return;
  160. if (!lpc_order) {
  161. memcpy(&buffer_out[1], &error_buffer[1],
  162. (nb_samples - 1) * sizeof(*buffer_out));
  163. return;
  164. }
  165. if (lpc_order == 31) {
  166. /* simple 1st-order prediction */
  167. for (i = 1; i < nb_samples; i++) {
  168. buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i],
  169. bps);
  170. }
  171. return;
  172. }
  173. /* read warm-up samples */
  174. for (i = 1; i <= lpc_order && i < nb_samples; i++)
  175. buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i], bps);
  176. /* NOTE: 4 and 8 are very common cases that could be optimized. */
  177. for (; i < nb_samples; i++) {
  178. int j;
  179. int val = 0;
  180. unsigned error_val = error_buffer[i];
  181. int error_sign;
  182. int d = *pred++;
  183. /* LPC prediction */
  184. for (j = 0; j < lpc_order; j++)
  185. val += (pred[j] - d) * lpc_coefs[j];
  186. val = (val + (1LL << (lpc_quant - 1))) >> lpc_quant;
  187. val += d + error_val;
  188. buffer_out[i] = sign_extend(val, bps);
  189. /* adapt LPC coefficients */
  190. error_sign = sign_only(error_val);
  191. if (error_sign) {
  192. for (j = 0; j < lpc_order && (int)(error_val * error_sign) > 0; j++) {
  193. int sign;
  194. val = d - pred[j];
  195. sign = sign_only(val) * error_sign;
  196. lpc_coefs[j] -= sign;
  197. val *= (unsigned)sign;
  198. error_val -= (val >> lpc_quant) * (j + 1U);
  199. }
  200. }
  201. }
  202. }
  203. static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
  204. int channels)
  205. {
  206. ALACContext *alac = avctx->priv_data;
  207. int has_size, bps, is_compressed, decorr_shift, decorr_left_weight, ret;
  208. uint32_t output_samples;
  209. int i, ch;
  210. skip_bits(&alac->gb, 4); /* element instance tag */
  211. skip_bits(&alac->gb, 12); /* unused header bits */
  212. /* the number of output samples is stored in the frame */
  213. has_size = get_bits1(&alac->gb);
  214. alac->extra_bits = get_bits(&alac->gb, 2) << 3;
  215. bps = alac->sample_size - alac->extra_bits + channels - 1;
  216. if (bps > 32) {
  217. avpriv_report_missing_feature(avctx, "bps %d", bps);
  218. return AVERROR_PATCHWELCOME;
  219. }
  220. if (bps < 1)
  221. return AVERROR_INVALIDDATA;
  222. /* whether the frame is compressed */
  223. is_compressed = !get_bits1(&alac->gb);
  224. if (has_size)
  225. output_samples = get_bits_long(&alac->gb, 32);
  226. else
  227. output_samples = alac->max_samples_per_frame;
  228. if (!output_samples || output_samples > alac->max_samples_per_frame) {
  229. av_log(avctx, AV_LOG_ERROR, "invalid samples per frame: %"PRIu32"\n",
  230. output_samples);
  231. return AVERROR_INVALIDDATA;
  232. }
  233. if (!alac->nb_samples) {
  234. ThreadFrame tframe = { .f = frame };
  235. /* get output buffer */
  236. frame->nb_samples = output_samples;
  237. if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
  238. return ret;
  239. } else if (output_samples != alac->nb_samples) {
  240. av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %"PRIu32" != %d\n",
  241. output_samples, alac->nb_samples);
  242. return AVERROR_INVALIDDATA;
  243. }
  244. alac->nb_samples = output_samples;
  245. if (alac->direct_output) {
  246. for (ch = 0; ch < channels; ch++)
  247. alac->output_samples_buffer[ch] = (int32_t *)frame->extended_data[ch_index + ch];
  248. }
  249. if (is_compressed) {
  250. int16_t lpc_coefs[2][32];
  251. int lpc_order[2];
  252. int prediction_type[2];
  253. int lpc_quant[2];
  254. int rice_history_mult[2];
  255. if (!alac->rice_limit) {
  256. avpriv_request_sample(alac->avctx,
  257. "Compression with rice limit 0");
  258. return AVERROR(ENOSYS);
  259. }
  260. decorr_shift = get_bits(&alac->gb, 8);
  261. decorr_left_weight = get_bits(&alac->gb, 8);
  262. for (ch = 0; ch < channels; ch++) {
  263. prediction_type[ch] = get_bits(&alac->gb, 4);
  264. lpc_quant[ch] = get_bits(&alac->gb, 4);
  265. rice_history_mult[ch] = get_bits(&alac->gb, 3);
  266. lpc_order[ch] = get_bits(&alac->gb, 5);
  267. if (lpc_order[ch] >= alac->max_samples_per_frame || !lpc_quant[ch])
  268. return AVERROR_INVALIDDATA;
  269. /* read the predictor table */
  270. for (i = lpc_order[ch] - 1; i >= 0; i--)
  271. lpc_coefs[ch][i] = get_sbits(&alac->gb, 16);
  272. }
  273. if (alac->extra_bits) {
  274. for (i = 0; i < alac->nb_samples; i++) {
  275. if(get_bits_left(&alac->gb) <= 0)
  276. return AVERROR_INVALIDDATA;
  277. for (ch = 0; ch < channels; ch++)
  278. alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);
  279. }
  280. }
  281. for (ch = 0; ch < channels; ch++) {
  282. int ret=rice_decompress(alac, alac->predict_error_buffer[ch],
  283. alac->nb_samples, bps,
  284. rice_history_mult[ch] * alac->rice_history_mult / 4);
  285. if(ret<0)
  286. return ret;
  287. /* adaptive FIR filter */
  288. if (prediction_type[ch] == 15) {
  289. /* Prediction type 15 runs the adaptive FIR twice.
  290. * The first pass uses the special-case coef_num = 31, while
  291. * the second pass uses the coefs from the bitstream.
  292. *
  293. * However, this prediction type is not currently used by the
  294. * reference encoder.
  295. */
  296. lpc_prediction(alac->predict_error_buffer[ch],
  297. alac->predict_error_buffer[ch],
  298. alac->nb_samples, bps, NULL, 31, 0);
  299. } else if (prediction_type[ch] > 0) {
  300. av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",
  301. prediction_type[ch]);
  302. }
  303. lpc_prediction(alac->predict_error_buffer[ch],
  304. alac->output_samples_buffer[ch], alac->nb_samples,
  305. bps, lpc_coefs[ch], lpc_order[ch], lpc_quant[ch]);
  306. }
  307. } else {
  308. /* not compressed, easy case */
  309. for (i = 0; i < alac->nb_samples; i++) {
  310. if(get_bits_left(&alac->gb) <= 0)
  311. return AVERROR_INVALIDDATA;
  312. for (ch = 0; ch < channels; ch++) {
  313. alac->output_samples_buffer[ch][i] =
  314. get_sbits_long(&alac->gb, alac->sample_size);
  315. }
  316. }
  317. alac->extra_bits = 0;
  318. decorr_shift = 0;
  319. decorr_left_weight = 0;
  320. }
  321. if (channels == 2) {
  322. if (alac->extra_bits && alac->extra_bit_bug) {
  323. alac->dsp.append_extra_bits[1](alac->output_samples_buffer, alac->extra_bits_buffer,
  324. alac->extra_bits, channels, alac->nb_samples);
  325. }
  326. if (decorr_left_weight) {
  327. alac->dsp.decorrelate_stereo(alac->output_samples_buffer, alac->nb_samples,
  328. decorr_shift, decorr_left_weight);
  329. }
  330. if (alac->extra_bits && !alac->extra_bit_bug) {
  331. alac->dsp.append_extra_bits[1](alac->output_samples_buffer, alac->extra_bits_buffer,
  332. alac->extra_bits, channels, alac->nb_samples);
  333. }
  334. } else if (alac->extra_bits) {
  335. alac->dsp.append_extra_bits[0](alac->output_samples_buffer, alac->extra_bits_buffer,
  336. alac->extra_bits, channels, alac->nb_samples);
  337. }
  338. switch(alac->sample_size) {
  339. case 16: {
  340. for (ch = 0; ch < channels; ch++) {
  341. int16_t *outbuffer = (int16_t *)frame->extended_data[ch_index + ch];
  342. for (i = 0; i < alac->nb_samples; i++)
  343. *outbuffer++ = alac->output_samples_buffer[ch][i];
  344. }}
  345. break;
  346. case 20: {
  347. for (ch = 0; ch < channels; ch++) {
  348. for (i = 0; i < alac->nb_samples; i++)
  349. alac->output_samples_buffer[ch][i] *= 1U << 12;
  350. }}
  351. break;
  352. case 24: {
  353. for (ch = 0; ch < channels; ch++) {
  354. for (i = 0; i < alac->nb_samples; i++)
  355. alac->output_samples_buffer[ch][i] *= 1U << 8;
  356. }}
  357. break;
  358. }
  359. return 0;
  360. }
  361. static int alac_decode_frame(AVCodecContext *avctx, void *data,
  362. int *got_frame_ptr, AVPacket *avpkt)
  363. {
  364. ALACContext *alac = avctx->priv_data;
  365. AVFrame *frame = data;
  366. enum AlacRawDataBlockType element;
  367. int channels;
  368. int ch, ret, got_end;
  369. if ((ret = init_get_bits8(&alac->gb, avpkt->data, avpkt->size)) < 0)
  370. return ret;
  371. got_end = 0;
  372. alac->nb_samples = 0;
  373. ch = 0;
  374. while (get_bits_left(&alac->gb) >= 3) {
  375. element = get_bits(&alac->gb, 3);
  376. if (element == TYPE_END) {
  377. got_end = 1;
  378. break;
  379. }
  380. if (element > TYPE_CPE && element != TYPE_LFE) {
  381. avpriv_report_missing_feature(avctx, "Syntax element %d", element);
  382. return AVERROR_PATCHWELCOME;
  383. }
  384. channels = (element == TYPE_CPE) ? 2 : 1;
  385. if (ch + channels > alac->channels ||
  386. ff_alac_channel_layout_offsets[alac->channels - 1][ch] + channels > alac->channels) {
  387. av_log(avctx, AV_LOG_ERROR, "invalid element channel count\n");
  388. return AVERROR_INVALIDDATA;
  389. }
  390. ret = decode_element(avctx, frame,
  391. ff_alac_channel_layout_offsets[alac->channels - 1][ch],
  392. channels);
  393. if (ret < 0 && get_bits_left(&alac->gb))
  394. return ret;
  395. ch += channels;
  396. }
  397. if (!got_end) {
  398. av_log(avctx, AV_LOG_ERROR, "no end tag found. incomplete packet.\n");
  399. return AVERROR_INVALIDDATA;
  400. }
  401. if (avpkt->size * 8 - get_bits_count(&alac->gb) > 8) {
  402. av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",
  403. avpkt->size * 8 - get_bits_count(&alac->gb));
  404. }
  405. if (alac->channels == ch && alac->nb_samples)
  406. *got_frame_ptr = 1;
  407. else
  408. av_log(avctx, AV_LOG_WARNING, "Failed to decode all channels\n");
  409. return avpkt->size;
  410. }
  411. static av_cold int alac_decode_close(AVCodecContext *avctx)
  412. {
  413. ALACContext *alac = avctx->priv_data;
  414. int ch;
  415. for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
  416. av_freep(&alac->predict_error_buffer[ch]);
  417. if (!alac->direct_output)
  418. av_freep(&alac->output_samples_buffer[ch]);
  419. av_freep(&alac->extra_bits_buffer[ch]);
  420. }
  421. return 0;
  422. }
  423. static int allocate_buffers(ALACContext *alac)
  424. {
  425. int ch;
  426. unsigned buf_size = alac->max_samples_per_frame * sizeof(int32_t);
  427. for (ch = 0; ch < 2; ch++) {
  428. alac->predict_error_buffer[ch] = NULL;
  429. alac->output_samples_buffer[ch] = NULL;
  430. alac->extra_bits_buffer[ch] = NULL;
  431. }
  432. for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) {
  433. FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
  434. buf_size, buf_alloc_fail);
  435. alac->direct_output = alac->sample_size > 16;
  436. if (!alac->direct_output) {
  437. FF_ALLOC_OR_GOTO(alac->avctx, alac->output_samples_buffer[ch],
  438. buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail);
  439. }
  440. FF_ALLOC_OR_GOTO(alac->avctx, alac->extra_bits_buffer[ch],
  441. buf_size + AV_INPUT_BUFFER_PADDING_SIZE, buf_alloc_fail);
  442. }
  443. return 0;
  444. buf_alloc_fail:
  445. return AVERROR(ENOMEM);
  446. }
  447. static int alac_set_info(ALACContext *alac)
  448. {
  449. GetByteContext gb;
  450. bytestream2_init(&gb, alac->avctx->extradata,
  451. alac->avctx->extradata_size);
  452. bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
  453. alac->max_samples_per_frame = bytestream2_get_be32u(&gb);
  454. if (!alac->max_samples_per_frame ||
  455. alac->max_samples_per_frame > 4096 * 4096) {
  456. av_log(alac->avctx, AV_LOG_ERROR,
  457. "max samples per frame invalid: %"PRIu32"\n",
  458. alac->max_samples_per_frame);
  459. return AVERROR_INVALIDDATA;
  460. }
  461. bytestream2_skipu(&gb, 1); // compatible version
  462. alac->sample_size = bytestream2_get_byteu(&gb);
  463. alac->rice_history_mult = bytestream2_get_byteu(&gb);
  464. alac->rice_initial_history = bytestream2_get_byteu(&gb);
  465. alac->rice_limit = bytestream2_get_byteu(&gb);
  466. alac->channels = bytestream2_get_byteu(&gb);
  467. bytestream2_get_be16u(&gb); // maxRun
  468. bytestream2_get_be32u(&gb); // max coded frame size
  469. bytestream2_get_be32u(&gb); // average bitrate
  470. alac->sample_rate = bytestream2_get_be32u(&gb);
  471. return 0;
  472. }
  473. static av_cold int alac_decode_init(AVCodecContext * avctx)
  474. {
  475. int ret;
  476. ALACContext *alac = avctx->priv_data;
  477. alac->avctx = avctx;
  478. /* initialize from the extradata */
  479. if (alac->avctx->extradata_size < ALAC_EXTRADATA_SIZE) {
  480. av_log(avctx, AV_LOG_ERROR, "extradata is too small\n");
  481. return AVERROR_INVALIDDATA;
  482. }
  483. if ((ret = alac_set_info(alac)) < 0) {
  484. av_log(avctx, AV_LOG_ERROR, "set_info failed\n");
  485. return ret;
  486. }
  487. switch (alac->sample_size) {
  488. case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
  489. break;
  490. case 20:
  491. case 24:
  492. case 32: avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
  493. break;
  494. default: avpriv_request_sample(avctx, "Sample depth %d", alac->sample_size);
  495. return AVERROR_PATCHWELCOME;
  496. }
  497. avctx->bits_per_raw_sample = alac->sample_size;
  498. avctx->sample_rate = alac->sample_rate;
  499. if (alac->channels < 1) {
  500. av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n");
  501. alac->channels = avctx->channels;
  502. } else {
  503. if (alac->channels > ALAC_MAX_CHANNELS)
  504. alac->channels = avctx->channels;
  505. else
  506. avctx->channels = alac->channels;
  507. }
  508. if (avctx->channels > ALAC_MAX_CHANNELS || avctx->channels <= 0 ) {
  509. avpriv_report_missing_feature(avctx, "Channel count %d",
  510. avctx->channels);
  511. return AVERROR_PATCHWELCOME;
  512. }
  513. avctx->channel_layout = ff_alac_channel_layouts[alac->channels - 1];
  514. if ((ret = allocate_buffers(alac)) < 0) {
  515. av_log(avctx, AV_LOG_ERROR, "Error allocating buffers\n");
  516. return ret;
  517. }
  518. ff_alacdsp_init(&alac->dsp);
  519. return 0;
  520. }
  521. static const AVOption options[] = {
  522. { "extra_bits_bug", "Force non-standard decoding process",
  523. offsetof(ALACContext, extra_bit_bug), AV_OPT_TYPE_BOOL, { .i64 = 0 },
  524. 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM },
  525. { NULL },
  526. };
  527. static const AVClass alac_class = {
  528. .class_name = "alac",
  529. .item_name = av_default_item_name,
  530. .option = options,
  531. .version = LIBAVUTIL_VERSION_INT,
  532. };
  533. AVCodec ff_alac_decoder = {
  534. .name = "alac",
  535. .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
  536. .type = AVMEDIA_TYPE_AUDIO,
  537. .id = AV_CODEC_ID_ALAC,
  538. .priv_data_size = sizeof(ALACContext),
  539. .init = alac_decode_init,
  540. .close = alac_decode_close,
  541. .decode = alac_decode_frame,
  542. .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
  543. .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
  544. .priv_class = &alac_class
  545. };