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.

700 lines
23KB

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