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