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.

666 lines
22KB

  1. /*
  2. * ALAC (Apple Lossless Audio Codec) decoder
  3. * Copyright (c) 2005 David Hammerton
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav 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. * Libav 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 Libav; 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. * 32bit atom size
  32. * 32bit tag ("alac")
  33. * 32bit tag version (0)
  34. * 32bit samples per frame (used when not set explicitly in the frames)
  35. * 8bit compatible version (0)
  36. * 8bit sample size
  37. * 8bit history mult (40)
  38. * 8bit initial history (14)
  39. * 8bit kmodifier (10)
  40. * 8bit channels
  41. * 16bit maxRun (255)
  42. * 32bit max coded frame size (0 means unknown)
  43. * 32bit average bitrate (0 means unknown)
  44. * 32bit samplerate
  45. */
  46. #include "avcodec.h"
  47. #include "get_bits.h"
  48. #include "bytestream.h"
  49. #include "unary.h"
  50. #include "mathops.h"
  51. #define ALAC_EXTRADATA_SIZE 36
  52. #define MAX_CHANNELS 2
  53. typedef struct {
  54. AVCodecContext *avctx;
  55. AVFrame frame;
  56. GetBitContext gb;
  57. int numchannels;
  58. /* buffers */
  59. int32_t *predicterror_buffer[MAX_CHANNELS];
  60. int32_t *outputsamples_buffer[MAX_CHANNELS];
  61. int32_t *extra_bits_buffer[MAX_CHANNELS];
  62. /* stuff from setinfo */
  63. uint32_t setinfo_max_samples_per_frame; /* 0x1000 = 4096 */ /* max samples per frame? */
  64. uint8_t setinfo_sample_size; /* 0x10 */
  65. uint8_t setinfo_rice_historymult; /* 0x28 */
  66. uint8_t setinfo_rice_initialhistory; /* 0x0a */
  67. uint8_t setinfo_rice_kmodifier; /* 0x0e */
  68. /* end setinfo stuff */
  69. int extra_bits; /**< number of extra bits beyond 16-bit */
  70. } ALACContext;
  71. static inline int decode_scalar(GetBitContext *gb, int k, int limit, int readsamplesize){
  72. /* read x - number of 1s before 0 represent the rice */
  73. int x = get_unary_0_9(gb);
  74. if (x > 8) { /* RICE THRESHOLD */
  75. /* use alternative encoding */
  76. x = get_bits(gb, readsamplesize);
  77. } else {
  78. if (k >= limit)
  79. k = limit;
  80. if (k != 1) {
  81. int extrabits = show_bits(gb, k);
  82. /* multiply x by 2^k - 1, as part of their strange algorithm */
  83. x = (x << k) - x;
  84. if (extrabits > 1) {
  85. x += extrabits - 1;
  86. skip_bits(gb, k);
  87. } else
  88. skip_bits(gb, k - 1);
  89. }
  90. }
  91. return x;
  92. }
  93. static void bastardized_rice_decompress(ALACContext *alac,
  94. int32_t *output_buffer,
  95. int output_size,
  96. int readsamplesize, /* arg_10 */
  97. int rice_initialhistory, /* arg424->b */
  98. int rice_kmodifier, /* arg424->d */
  99. int rice_historymult, /* arg424->c */
  100. int rice_kmodifier_mask /* arg424->e */
  101. )
  102. {
  103. int output_count;
  104. unsigned int history = rice_initialhistory;
  105. int sign_modifier = 0;
  106. for (output_count = 0; output_count < output_size; output_count++) {
  107. int32_t x;
  108. int32_t x_modified;
  109. int32_t final_val;
  110. /* standard rice encoding */
  111. int k; /* size of extra bits */
  112. /* read k, that is bits as is */
  113. k = av_log2((history >> 9) + 3);
  114. x= decode_scalar(&alac->gb, k, rice_kmodifier, readsamplesize);
  115. x_modified = sign_modifier + x;
  116. final_val = (x_modified + 1) / 2;
  117. if (x_modified & 1) final_val *= -1;
  118. output_buffer[output_count] = final_val;
  119. sign_modifier = 0;
  120. /* now update the history */
  121. history += x_modified * rice_historymult
  122. - ((history * rice_historymult) >> 9);
  123. if (x_modified > 0xffff)
  124. history = 0xffff;
  125. /* special case: there may be compressed blocks of 0 */
  126. if ((history < 128) && (output_count+1 < output_size)) {
  127. int k;
  128. unsigned int block_size;
  129. sign_modifier = 1;
  130. k = 7 - av_log2(history) + ((history + 16) >> 6 /* / 64 */);
  131. block_size= decode_scalar(&alac->gb, k, rice_kmodifier, 16);
  132. if (block_size > 0) {
  133. if(block_size >= output_size - output_count){
  134. av_log(alac->avctx, AV_LOG_ERROR, "invalid zero block size of %d %d %d\n", block_size, output_size, output_count);
  135. block_size= output_size - output_count - 1;
  136. }
  137. memset(&output_buffer[output_count+1], 0, block_size * 4);
  138. output_count += block_size;
  139. }
  140. if (block_size > 0xffff)
  141. sign_modifier = 0;
  142. history = 0;
  143. }
  144. }
  145. }
  146. static inline int sign_only(int v)
  147. {
  148. return v ? FFSIGN(v) : 0;
  149. }
  150. static void predictor_decompress_fir_adapt(int32_t *error_buffer,
  151. int32_t *buffer_out,
  152. int output_size,
  153. int readsamplesize,
  154. int16_t *predictor_coef_table,
  155. int predictor_coef_num,
  156. int predictor_quantitization)
  157. {
  158. int i;
  159. /* first sample always copies */
  160. *buffer_out = *error_buffer;
  161. if (!predictor_coef_num) {
  162. if (output_size <= 1)
  163. return;
  164. memcpy(buffer_out+1, error_buffer+1, (output_size-1) * 4);
  165. return;
  166. }
  167. if (predictor_coef_num == 0x1f) { /* 11111 - max value of predictor_coef_num */
  168. /* second-best case scenario for fir decompression,
  169. * error describes a small difference from the previous sample only
  170. */
  171. if (output_size <= 1)
  172. return;
  173. for (i = 0; i < output_size - 1; i++) {
  174. int32_t prev_value;
  175. int32_t error_value;
  176. prev_value = buffer_out[i];
  177. error_value = error_buffer[i+1];
  178. buffer_out[i+1] =
  179. sign_extend((prev_value + error_value), readsamplesize);
  180. }
  181. return;
  182. }
  183. /* read warm-up samples */
  184. if (predictor_coef_num > 0)
  185. for (i = 0; i < predictor_coef_num; i++) {
  186. int32_t val;
  187. val = buffer_out[i] + error_buffer[i+1];
  188. val = sign_extend(val, readsamplesize);
  189. buffer_out[i+1] = val;
  190. }
  191. /* 4 and 8 are very common cases (the only ones i've seen). these
  192. * should be unrolled and optimized
  193. */
  194. /* general case */
  195. if (predictor_coef_num > 0) {
  196. for (i = predictor_coef_num + 1; i < output_size; i++) {
  197. int j;
  198. int sum = 0;
  199. int outval;
  200. int error_val = error_buffer[i];
  201. for (j = 0; j < predictor_coef_num; j++) {
  202. sum += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
  203. predictor_coef_table[j];
  204. }
  205. outval = (1 << (predictor_quantitization-1)) + sum;
  206. outval = outval >> predictor_quantitization;
  207. outval = outval + buffer_out[0] + error_val;
  208. outval = sign_extend(outval, readsamplesize);
  209. buffer_out[predictor_coef_num+1] = outval;
  210. if (error_val > 0) {
  211. int predictor_num = predictor_coef_num - 1;
  212. while (predictor_num >= 0 && error_val > 0) {
  213. int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
  214. int sign = sign_only(val);
  215. predictor_coef_table[predictor_num] -= sign;
  216. val *= sign; /* absolute value */
  217. error_val -= ((val >> predictor_quantitization) *
  218. (predictor_coef_num - predictor_num));
  219. predictor_num--;
  220. }
  221. } else if (error_val < 0) {
  222. int predictor_num = predictor_coef_num - 1;
  223. while (predictor_num >= 0 && error_val < 0) {
  224. int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
  225. int sign = - sign_only(val);
  226. predictor_coef_table[predictor_num] -= sign;
  227. val *= sign; /* neg value */
  228. error_val -= ((val >> predictor_quantitization) *
  229. (predictor_coef_num - predictor_num));
  230. predictor_num--;
  231. }
  232. }
  233. buffer_out++;
  234. }
  235. }
  236. }
  237. static void decorrelate_stereo(int32_t *buffer[MAX_CHANNELS],
  238. int numsamples, uint8_t interlacing_shift,
  239. uint8_t interlacing_leftweight)
  240. {
  241. int i;
  242. for (i = 0; i < numsamples; i++) {
  243. int32_t a, b;
  244. a = buffer[0][i];
  245. b = buffer[1][i];
  246. a -= (b * interlacing_leftweight) >> interlacing_shift;
  247. b += a;
  248. buffer[0][i] = b;
  249. buffer[1][i] = a;
  250. }
  251. }
  252. static void append_extra_bits(int32_t *buffer[MAX_CHANNELS],
  253. int32_t *extra_bits_buffer[MAX_CHANNELS],
  254. int extra_bits, int numchannels, int numsamples)
  255. {
  256. int i, ch;
  257. for (ch = 0; ch < numchannels; ch++)
  258. for (i = 0; i < numsamples; i++)
  259. buffer[ch][i] = (buffer[ch][i] << extra_bits) | extra_bits_buffer[ch][i];
  260. }
  261. static void interleave_stereo_16(int32_t *buffer[MAX_CHANNELS],
  262. int16_t *buffer_out, int numsamples)
  263. {
  264. int i;
  265. for (i = 0; i < numsamples; i++) {
  266. *buffer_out++ = buffer[0][i];
  267. *buffer_out++ = buffer[1][i];
  268. }
  269. }
  270. static void interleave_stereo_24(int32_t *buffer[MAX_CHANNELS],
  271. int32_t *buffer_out, int numsamples)
  272. {
  273. int i;
  274. for (i = 0; i < numsamples; i++) {
  275. *buffer_out++ = buffer[0][i] << 8;
  276. *buffer_out++ = buffer[1][i] << 8;
  277. }
  278. }
  279. static int alac_decode_frame(AVCodecContext *avctx, void *data,
  280. int *got_frame_ptr, AVPacket *avpkt)
  281. {
  282. const uint8_t *inbuffer = avpkt->data;
  283. int input_buffer_size = avpkt->size;
  284. ALACContext *alac = avctx->priv_data;
  285. int channels;
  286. unsigned int outputsamples;
  287. int hassize;
  288. unsigned int readsamplesize;
  289. int isnotcompressed;
  290. uint8_t interlacing_shift;
  291. uint8_t interlacing_leftweight;
  292. int i, ch, ret;
  293. init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
  294. channels = get_bits(&alac->gb, 3) + 1;
  295. if (channels != avctx->channels) {
  296. av_log(avctx, AV_LOG_ERROR, "frame header channel count mismatch\n");
  297. return AVERROR_INVALIDDATA;
  298. }
  299. /* 2^result = something to do with output waiting.
  300. * perhaps matters if we read > 1 frame in a pass?
  301. */
  302. skip_bits(&alac->gb, 4);
  303. skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */
  304. /* the output sample size is stored soon */
  305. hassize = get_bits1(&alac->gb);
  306. alac->extra_bits = get_bits(&alac->gb, 2) << 3;
  307. /* whether the frame is compressed */
  308. isnotcompressed = get_bits1(&alac->gb);
  309. if (hassize) {
  310. /* now read the number of samples as a 32bit integer */
  311. outputsamples = get_bits_long(&alac->gb, 32);
  312. if(outputsamples > alac->setinfo_max_samples_per_frame){
  313. av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame);
  314. return -1;
  315. }
  316. } else
  317. outputsamples = alac->setinfo_max_samples_per_frame;
  318. /* get output buffer */
  319. if (outputsamples > INT32_MAX) {
  320. av_log(avctx, AV_LOG_ERROR, "unsupported block size: %u\n", outputsamples);
  321. return AVERROR_INVALIDDATA;
  322. }
  323. alac->frame.nb_samples = outputsamples;
  324. if ((ret = avctx->get_buffer(avctx, &alac->frame)) < 0) {
  325. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
  326. return ret;
  327. }
  328. readsamplesize = alac->setinfo_sample_size - alac->extra_bits + channels - 1;
  329. if (readsamplesize > MIN_CACHE_BITS) {
  330. av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
  331. return -1;
  332. }
  333. if (!isnotcompressed) {
  334. /* so it is compressed */
  335. int16_t predictor_coef_table[MAX_CHANNELS][32];
  336. int predictor_coef_num[MAX_CHANNELS];
  337. int prediction_type[MAX_CHANNELS];
  338. int prediction_quantitization[MAX_CHANNELS];
  339. int ricemodifier[MAX_CHANNELS];
  340. interlacing_shift = get_bits(&alac->gb, 8);
  341. interlacing_leftweight = get_bits(&alac->gb, 8);
  342. for (ch = 0; ch < channels; ch++) {
  343. prediction_type[ch] = get_bits(&alac->gb, 4);
  344. prediction_quantitization[ch] = get_bits(&alac->gb, 4);
  345. ricemodifier[ch] = get_bits(&alac->gb, 3);
  346. predictor_coef_num[ch] = get_bits(&alac->gb, 5);
  347. /* read the predictor table */
  348. for (i = 0; i < predictor_coef_num[ch]; i++)
  349. predictor_coef_table[ch][i] = (int16_t)get_bits(&alac->gb, 16);
  350. }
  351. if (alac->extra_bits) {
  352. for (i = 0; i < outputsamples; i++) {
  353. for (ch = 0; ch < channels; ch++)
  354. alac->extra_bits_buffer[ch][i] = get_bits(&alac->gb, alac->extra_bits);
  355. }
  356. }
  357. for (ch = 0; ch < channels; ch++) {
  358. bastardized_rice_decompress(alac,
  359. alac->predicterror_buffer[ch],
  360. outputsamples,
  361. readsamplesize,
  362. alac->setinfo_rice_initialhistory,
  363. alac->setinfo_rice_kmodifier,
  364. ricemodifier[ch] * alac->setinfo_rice_historymult / 4,
  365. (1 << alac->setinfo_rice_kmodifier) - 1);
  366. /* adaptive FIR filter */
  367. if (prediction_type[ch] == 15) {
  368. /* Prediction type 15 runs the adaptive FIR twice.
  369. * The first pass uses the special-case coef_num = 31, while
  370. * the second pass uses the coefs from the bitstream.
  371. *
  372. * However, this prediction type is not currently used by the
  373. * reference encoder.
  374. */
  375. predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
  376. alac->predicterror_buffer[ch],
  377. outputsamples, readsamplesize,
  378. NULL, 31, 0);
  379. } else if (prediction_type[ch] > 0) {
  380. av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",
  381. prediction_type[ch]);
  382. }
  383. predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
  384. alac->outputsamples_buffer[ch],
  385. outputsamples, readsamplesize,
  386. predictor_coef_table[ch],
  387. predictor_coef_num[ch],
  388. prediction_quantitization[ch]);
  389. }
  390. } else {
  391. /* not compressed, easy case */
  392. for (i = 0; i < outputsamples; i++) {
  393. for (ch = 0; ch < channels; ch++) {
  394. alac->outputsamples_buffer[ch][i] = get_sbits_long(&alac->gb,
  395. alac->setinfo_sample_size);
  396. }
  397. }
  398. alac->extra_bits = 0;
  399. interlacing_shift = 0;
  400. interlacing_leftweight = 0;
  401. }
  402. if (get_bits(&alac->gb, 3) != 7)
  403. av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n");
  404. if (channels == 2 && interlacing_leftweight) {
  405. decorrelate_stereo(alac->outputsamples_buffer, outputsamples,
  406. interlacing_shift, interlacing_leftweight);
  407. }
  408. if (alac->extra_bits) {
  409. append_extra_bits(alac->outputsamples_buffer, alac->extra_bits_buffer,
  410. alac->extra_bits, alac->numchannels, outputsamples);
  411. }
  412. switch(alac->setinfo_sample_size) {
  413. case 16:
  414. if (channels == 2) {
  415. interleave_stereo_16(alac->outputsamples_buffer,
  416. (int16_t *)alac->frame.data[0], outputsamples);
  417. } else {
  418. int16_t *outbuffer = (int16_t *)alac->frame.data[0];
  419. for (i = 0; i < outputsamples; i++) {
  420. outbuffer[i] = alac->outputsamples_buffer[0][i];
  421. }
  422. }
  423. break;
  424. case 24:
  425. if (channels == 2) {
  426. interleave_stereo_24(alac->outputsamples_buffer,
  427. (int32_t *)alac->frame.data[0], outputsamples);
  428. } else {
  429. int32_t *outbuffer = (int32_t *)alac->frame.data[0];
  430. for (i = 0; i < outputsamples; i++)
  431. outbuffer[i] = alac->outputsamples_buffer[0][i] << 8;
  432. }
  433. break;
  434. }
  435. if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
  436. av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb));
  437. *got_frame_ptr = 1;
  438. *(AVFrame *)data = alac->frame;
  439. return input_buffer_size;
  440. }
  441. static av_cold int alac_decode_close(AVCodecContext *avctx)
  442. {
  443. ALACContext *alac = avctx->priv_data;
  444. int ch;
  445. for (ch = 0; ch < alac->numchannels; ch++) {
  446. av_freep(&alac->predicterror_buffer[ch]);
  447. av_freep(&alac->outputsamples_buffer[ch]);
  448. av_freep(&alac->extra_bits_buffer[ch]);
  449. }
  450. return 0;
  451. }
  452. static int allocate_buffers(ALACContext *alac)
  453. {
  454. int ch;
  455. for (ch = 0; ch < alac->numchannels; ch++) {
  456. int buf_size = alac->setinfo_max_samples_per_frame * sizeof(int32_t);
  457. FF_ALLOC_OR_GOTO(alac->avctx, alac->predicterror_buffer[ch],
  458. buf_size, buf_alloc_fail);
  459. FF_ALLOC_OR_GOTO(alac->avctx, alac->outputsamples_buffer[ch],
  460. buf_size, buf_alloc_fail);
  461. FF_ALLOC_OR_GOTO(alac->avctx, alac->extra_bits_buffer[ch],
  462. buf_size, buf_alloc_fail);
  463. }
  464. return 0;
  465. buf_alloc_fail:
  466. alac_decode_close(alac->avctx);
  467. return AVERROR(ENOMEM);
  468. }
  469. static int alac_set_info(ALACContext *alac)
  470. {
  471. GetByteContext gb;
  472. bytestream2_init(&gb, alac->avctx->extradata,
  473. alac->avctx->extradata_size);
  474. bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4
  475. /* buffer size / 2 ? */
  476. alac->setinfo_max_samples_per_frame = bytestream2_get_be32u(&gb);
  477. if (alac->setinfo_max_samples_per_frame >= UINT_MAX/4){
  478. av_log(alac->avctx, AV_LOG_ERROR,
  479. "setinfo_max_samples_per_frame too large\n");
  480. return AVERROR_INVALIDDATA;
  481. }
  482. bytestream2_skipu(&gb, 1); // compatible version
  483. alac->setinfo_sample_size = bytestream2_get_byteu(&gb);
  484. alac->setinfo_rice_historymult = bytestream2_get_byteu(&gb);
  485. alac->setinfo_rice_initialhistory = bytestream2_get_byteu(&gb);
  486. alac->setinfo_rice_kmodifier = bytestream2_get_byteu(&gb);
  487. alac->numchannels = bytestream2_get_byteu(&gb);
  488. bytestream2_get_be16u(&gb); // maxRun
  489. bytestream2_get_be32u(&gb); // max coded frame size
  490. bytestream2_get_be32u(&gb); // average bitrate
  491. bytestream2_get_be32u(&gb); // samplerate
  492. return 0;
  493. }
  494. static av_cold int alac_decode_init(AVCodecContext * avctx)
  495. {
  496. int ret;
  497. ALACContext *alac = avctx->priv_data;
  498. alac->avctx = avctx;
  499. /* initialize from the extradata */
  500. if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
  501. av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
  502. ALAC_EXTRADATA_SIZE);
  503. return -1;
  504. }
  505. if (alac_set_info(alac)) {
  506. av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");
  507. return -1;
  508. }
  509. switch (alac->setinfo_sample_size) {
  510. case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16;
  511. break;
  512. case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32;
  513. break;
  514. default: av_log_ask_for_sample(avctx, "Sample depth %d is not supported.\n",
  515. alac->setinfo_sample_size);
  516. return AVERROR_PATCHWELCOME;
  517. }
  518. if (alac->numchannels < 1) {
  519. av_log(avctx, AV_LOG_WARNING, "Invalid channel count\n");
  520. alac->numchannels = avctx->channels;
  521. } else {
  522. if (alac->numchannels > MAX_CHANNELS)
  523. alac->numchannels = avctx->channels;
  524. else
  525. avctx->channels = alac->numchannels;
  526. }
  527. if (avctx->channels > MAX_CHANNELS) {
  528. av_log(avctx, AV_LOG_ERROR, "Unsupported channel count: %d\n",
  529. avctx->channels);
  530. return AVERROR_PATCHWELCOME;
  531. }
  532. if ((ret = allocate_buffers(alac)) < 0) {
  533. av_log(avctx, AV_LOG_ERROR, "Error allocating buffers\n");
  534. return ret;
  535. }
  536. avcodec_get_frame_defaults(&alac->frame);
  537. avctx->coded_frame = &alac->frame;
  538. return 0;
  539. }
  540. AVCodec ff_alac_decoder = {
  541. .name = "alac",
  542. .type = AVMEDIA_TYPE_AUDIO,
  543. .id = CODEC_ID_ALAC,
  544. .priv_data_size = sizeof(ALACContext),
  545. .init = alac_decode_init,
  546. .close = alac_decode_close,
  547. .decode = alac_decode_frame,
  548. .capabilities = CODEC_CAP_DR1,
  549. .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
  550. };