FFmpeg
Loading...
Searching...
No Matches
libfdk-aacdec.c
Go to the documentation of this file.
1/*
2 * AAC decoder wrapper
3 * Copyright (c) 2012 Martin Storsjo
4 *
5 * This file is part of FFmpeg.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include <fdk-aac/aacdecoder_lib.h>
21
23#include "libavutil/common.h"
24#include "libavutil/mem.h"
25#include "libavutil/opt.h"
26#include "avcodec.h"
27#include "codec_internal.h"
28#include "decode.h"
29
30#ifdef AACDECODER_LIB_VL0
31#define FDKDEC_VER_AT_LEAST(vl0, vl1) \
32 ((AACDECODER_LIB_VL0 > vl0) || \
33 (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
34#else
35#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
36#endif
37
38#if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
39#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
40#endif
41
48
49typedef struct FDKAACDecContext {
50 const AVClass *class;
51 HANDLE_AACDECODER handle;
54 uint8_t *anc_buffer;
63#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
64 int output_delay_set;
65 int flush_samples;
66 int delay_samples;
67#endif
70
71
72#define DMX_ANC_BUFFSIZE 128
73#define DECODER_MAX_CHANNELS 8
74#define DECODER_BUFFSIZE 2048 * sizeof(INT_PCM)
75
76#define OFFSET(x) offsetof(FDKAACDecContext, x)
77#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
78static const AVOption fdk_aac_dec_options[] = {
79 { "conceal", "Error concealment method", OFFSET(conceal_method), AV_OPT_TYPE_INT, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, CONCEAL_METHOD_SPECTRAL_MUTING, CONCEAL_METHOD_NB - 1, AD, .unit = "conceal" },
80 { "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
81 { "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
82 { "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
83 { "drc_boost", "Dynamic Range Control: boost, where [0] is none and [127] is max boost",
84 OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, .unit = NULL },
85 { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression",
86 OFFSET(drc_cut), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, .unit = NULL },
87 { "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB, -1 for auto, and -2 for disabled",
88 OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -2, 127, AD, .unit = NULL },
89 { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off",
90 OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, .unit = NULL },
91#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
92 { "level_limit", "Signal level limiting",
93 OFFSET(level_limit), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, AD },
94#endif
95#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
96 { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general",
97 OFFSET(drc_effect), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 8, AD, .unit = NULL },
98#endif
99#if FDKDEC_VER_AT_LEAST(3, 1) // 3.1.0
100 { "album_mode","Dynamic Range Control: album mode, where [0] is off and [1] is on",
101 OFFSET(album_mode), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, .unit = NULL },
102#endif
103 { "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = AD },
104 { NULL }
105};
106
108 .class_name = "libfdk-aac decoder",
109 .item_name = av_default_item_name,
110 .option = fdk_aac_dec_options,
111 .version = LIBAVUTIL_VERSION_INT,
112};
113
115{
116 FDKAACDecContext *s = avctx->priv_data;
117 CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle);
118 int channel_counts[0x24] = { 0 };
119 int i, ch_error = 0;
120 uint64_t ch_layout = 0;
121
122 if (!info) {
123 av_log(avctx, AV_LOG_ERROR, "Unable to get stream info\n");
124 return AVERROR_UNKNOWN;
125 }
126
127 if (info->sampleRate <= 0) {
128 av_log(avctx, AV_LOG_ERROR, "Stream info not initialized\n");
129 return AVERROR_UNKNOWN;
130 }
131 avctx->sample_rate = info->sampleRate;
132 avctx->frame_size = info->frameSize;
133 avctx->profile = info->aot - 1;
134
135 frame->flags |= AV_FRAME_FLAG_KEY * !!(info->flags & AC_INDEP);
136#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
137 if (!s->output_delay_set && info->outputDelay) {
138 // Set this only once.
139 s->flush_samples = info->outputDelay;
140 s->delay_samples = info->outputDelay;
141 s->output_delay_set = 1;
142 }
143#endif
144
145 for (i = 0; i < info->numChannels; i++) {
146 AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
147 if (ctype <= ACT_NONE || ctype >= FF_ARRAY_ELEMS(channel_counts)) {
148 av_log(avctx, AV_LOG_WARNING, "unknown channel type\n");
149 break;
150 }
151 channel_counts[ctype]++;
152 }
153 av_log(avctx, AV_LOG_DEBUG,
154 "%d channels - front:%d side:%d back:%d lfe:%d top:%d\n",
155 info->numChannels,
156 channel_counts[ACT_FRONT], channel_counts[ACT_SIDE],
157 channel_counts[ACT_BACK], channel_counts[ACT_LFE],
158 channel_counts[ACT_FRONT_TOP] + channel_counts[ACT_SIDE_TOP] +
159 channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP]);
160
161 switch (channel_counts[ACT_FRONT]) {
162 case 5:
163 case 4:
164 ch_layout |= AV_CH_FRONT_LEFT_OF_CENTER |
167 case 3:
168 case 2:
169 ch_layout |= AV_CH_LAYOUT_STEREO;
171 case 1:
172 if (channel_counts[ACT_FRONT] & 1)
173 ch_layout |= AV_CH_FRONT_CENTER;
174 break;
175 default:
176 av_log(avctx, AV_LOG_WARNING,
177 "unsupported number of front channels: %d\n",
178 channel_counts[ACT_FRONT]);
179 ch_error = 1;
180 break;
181 }
182
183 if (channel_counts[ACT_SIDE] > 0) {
184 if (channel_counts[ACT_SIDE] == 2) {
185 ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
186 } else {
187 av_log(avctx, AV_LOG_WARNING,
188 "unsupported number of side channels: %d\n",
189 channel_counts[ACT_SIDE]);
190 ch_error = 1;
191 }
192 }
193 if (channel_counts[ACT_BACK] > 0) {
194 switch (channel_counts[ACT_BACK]) {
195 case 4:
196 ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
198 case 3:
199 case 2:
200 ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
202 case 1:
203 if (channel_counts[ACT_BACK] & 1)
204 ch_layout |= AV_CH_BACK_CENTER;
205 break;
206 default:
207 av_log(avctx, AV_LOG_WARNING,
208 "unsupported number of back channels: %d\n",
209 channel_counts[ACT_BACK]);
210 ch_error = 1;
211 break;
212 }
213 }
214 if (channel_counts[ACT_LFE] > 0) {
215 if (channel_counts[ACT_LFE] == 1) {
216 ch_layout |= AV_CH_LOW_FREQUENCY;
217 } else {
218 av_log(avctx, AV_LOG_WARNING,
219 "unsupported number of LFE channels: %d\n",
220 channel_counts[ACT_LFE]);
221 ch_error = 1;
222 }
223 }
224 if (channel_counts[ACT_FRONT_TOP] > 0) {
225 switch (channel_counts[ACT_FRONT_TOP]) {
226 case 3:
227 case 2:
230 case 1:
231 if (channel_counts[ACT_FRONT_TOP] & 1)
232 ch_layout |= AV_CH_TOP_FRONT_CENTER;
233 break;
234 default:
235 av_log(avctx, AV_LOG_WARNING,
236 "unsupported number of top front channels: %d\n",
237 channel_counts[ACT_FRONT_TOP]);
238 ch_error = 1;
239 break;
240 }
241 }
242
244 av_channel_layout_from_mask(&avctx->ch_layout, ch_layout);
245 if (!ch_error && avctx->ch_layout.nb_channels != info->numChannels) {
246 av_log(avctx, AV_LOG_WARNING, "unsupported channel configuration\n");
247 ch_error = 1;
248 }
249 if (ch_error)
251
252 return 0;
253}
254
256{
257 FDKAACDecContext *s = avctx->priv_data;
258
259 if (s->handle)
260 aacDecoder_Close(s->handle);
261 av_freep(&s->decoder_buffer);
262 av_freep(&s->anc_buffer);
263
264 return 0;
265}
266
268{
269 FDKAACDecContext *s = avctx->priv_data;
270 AAC_DECODER_ERROR err;
271
272 s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
273 if (!s->handle) {
274 av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
275 return AVERROR_UNKNOWN;
276 }
277
278 if (avctx->extradata_size) {
279 if ((err = aacDecoder_ConfigRaw(s->handle, &avctx->extradata,
280 &avctx->extradata_size)) != AAC_DEC_OK) {
281 av_log(avctx, AV_LOG_ERROR, "Unable to set extradata\n");
282 return AVERROR_INVALIDDATA;
283 }
284 }
285
286 if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
287 s->conceal_method)) != AAC_DEC_OK) {
288 av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
289 return AVERROR_UNKNOWN;
290 }
291
292 if (s->downmix_layout.nb_channels > 0 &&
293 s->downmix_layout.order == AV_CHANNEL_ORDER_NATIVE) {
294 int downmix_channels = -1;
295
296 switch (s->downmix_layout.u.mask) {
299 downmix_channels = 2;
300 break;
302 downmix_channels = 1;
303 break;
304 default:
305 av_log(avctx, AV_LOG_WARNING, "Invalid downmix option\n");
306 break;
307 }
308
309 if (downmix_channels != -1) {
310 if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS,
311 downmix_channels) != AAC_DEC_OK) {
312 av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
313 } else {
314 s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE);
315 if (!s->anc_buffer) {
316 av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n");
317 return AVERROR(ENOMEM);
318 }
319 if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) {
320 av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n");
321 return AVERROR_UNKNOWN;
322 }
323 }
324 }
325#if FDKDEC_VER_AT_LEAST(2, 5)
326 } else {
327 // AAC_PCM_MAX_OUTPUT_CHANNELS == 0 means outputting all the coded channels
328 if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS, 0) != AAC_DEC_OK)
329 av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
330#endif
331 }
332
333 if (s->drc_boost != -1) {
334 if (aacDecoder_SetParam(s->handle, AAC_DRC_BOOST_FACTOR, s->drc_boost) != AAC_DEC_OK) {
335 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC boost factor in the decoder\n");
336 return AVERROR_UNKNOWN;
337 }
338 }
339
340 if (s->drc_cut != -1) {
341 if (aacDecoder_SetParam(s->handle, AAC_DRC_ATTENUATION_FACTOR, s->drc_cut) != AAC_DEC_OK) {
342 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC attenuation factor in the decoder\n");
343 return AVERROR_UNKNOWN;
344 }
345 }
346
347 if (s->drc_level != -1) {
348 // This option defaults to -1, i.e. not calling
349 // aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults
350 // to the level from DRC metadata, if available. The user can set
351 // -drc_level -2, which calls aacDecoder_SetParam(
352 // AAC_DRC_REFERENCE_LEVEL) with a negative value, which then
353 // explicitly disables the feature.
354 if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) {
355 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n");
356 return AVERROR_UNKNOWN;
357 }
358 }
359
360 if (s->drc_heavy != -1) {
361 if (aacDecoder_SetParam(s->handle, AAC_DRC_HEAVY_COMPRESSION, s->drc_heavy) != AAC_DEC_OK) {
362 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC heavy compression in the decoder\n");
363 return AVERROR_UNKNOWN;
364 }
365 }
366
367#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
368 // Setting this parameter to -1 enables the auto behaviour in the library.
369 if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
370 av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
371 return AVERROR_UNKNOWN;
372 }
373#endif
374
375#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
376 if (s->drc_effect != -1) {
377 if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) {
378 av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n");
379 return AVERROR_UNKNOWN;
380 }
381 }
382#endif
383
384#if FDKDEC_VER_AT_LEAST(3, 1) // 3.1.0
385 if (s->album_mode != -1) {
386 if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_ALBUM_MODE, s->album_mode) != AAC_DEC_OK) {
387 av_log(avctx, AV_LOG_ERROR, "Unable to set album mode in the decoder\n");
388 return AVERROR_UNKNOWN;
389 }
390 }
391#endif
392
394
395 s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
396 s->decoder_buffer = av_malloc(s->decoder_buffer_size);
397 if (!s->decoder_buffer)
398 return AVERROR(ENOMEM);
399
400 return 0;
401}
402
404 int *got_frame_ptr, AVPacket *avpkt)
405{
406 FDKAACDecContext *s = avctx->priv_data;
407 int ret;
408 AAC_DECODER_ERROR err;
409 UINT valid = avpkt->size;
410 UINT flags = 0;
411 int input_offset = 0;
412
413 if (avpkt->size) {
414 err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid);
415 if (err != AAC_DEC_OK) {
416 av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err);
417 return AVERROR_INVALIDDATA;
418 }
419 } else {
420#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
421 /* Handle decoder draining */
422 if (s->flush_samples > 0) {
423 flags |= AACDEC_FLUSH;
424 } else {
425 return AVERROR_EOF;
426 }
427#else
428 return AVERROR_EOF;
429#endif
430 }
431
432 err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer,
433 s->decoder_buffer_size / sizeof(INT_PCM),
434 flags);
435 if (err == AAC_DEC_NOT_ENOUGH_BITS) {
436 ret = avpkt->size - valid;
437 goto end;
438 }
439 if (err != AAC_DEC_OK) {
440 av_log(avctx, AV_LOG_ERROR,
441 "aacDecoder_DecodeFrame() failed: %x\n", err);
442 ret = AVERROR_UNKNOWN;
443 goto end;
444 }
445
446 if ((ret = get_stream_info(avctx, frame)) < 0)
447 goto end;
448 frame->nb_samples = avctx->frame_size;
449
450#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
451 if (flags & AACDEC_FLUSH) {
452 // Only return the right amount of samples at the end; if calling the
453 // decoder with AACDEC_FLUSH, it will keep returning frames indefinitely.
454 frame->nb_samples = FFMIN(s->flush_samples, frame->nb_samples);
455 av_log(s, AV_LOG_DEBUG, "Returning %d/%d delayed samples.\n",
456 frame->nb_samples, s->flush_samples);
457 s->flush_samples -= frame->nb_samples;
458 } else {
459 // Trim off samples from the start to compensate for extra decoder
460 // delay. We could also just adjust the pts, but this avoids
461 // including the extra samples in the output altogether.
462 if (s->delay_samples) {
463 int drop_samples = FFMIN(s->delay_samples, frame->nb_samples);
464 av_log(s, AV_LOG_DEBUG, "Dropping %d/%d delayed samples.\n",
465 drop_samples, s->delay_samples);
466 s->delay_samples -= drop_samples;
467 frame->nb_samples -= drop_samples;
468 input_offset = drop_samples * avctx->ch_layout.nb_channels;
469 if (frame->nb_samples <= 0)
470 return 0;
471 }
472 }
473#endif
474
475 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
476 goto end;
477
478 memcpy(frame->extended_data[0], s->decoder_buffer + input_offset,
479 avctx->ch_layout.nb_channels * frame->nb_samples *
481
482 *got_frame_ptr = 1;
483 ret = avpkt->size - valid;
484
485end:
486 return ret;
487}
488
490{
491 FDKAACDecContext *s = avctx->priv_data;
492 AAC_DECODER_ERROR err;
493
494 if (!s->handle)
495 return;
496
497 if ((err = aacDecoder_SetParam(s->handle,
498 AAC_TPDEC_CLEAR_BUFFER, 1)) != AAC_DEC_OK)
499 av_log(avctx, AV_LOG_WARNING, "failed to clear buffer when flushing\n");
500}
501
503 .p.name = "libfdk_aac",
504 CODEC_LONG_NAME("Fraunhofer FDK AAC"),
505 .p.type = AVMEDIA_TYPE_AUDIO,
506 .p.id = AV_CODEC_ID_AAC,
507 .priv_data_size = sizeof(FDKAACDecContext),
510 .close = fdk_aac_decode_close,
511 .flush = fdk_aac_decode_flush,
513#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
515#endif
516 ,
517 .p.priv_class = &fdk_aac_dec_class,
518 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
519 .p.wrapper_name = "libfdk",
520};
#define ctype
const FFCodec ff_libfdk_aac_decoder
Libavcodec external API header.
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
common internal and external API header
#define NULL
Definition coverity.c:32
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition decode.c:1777
static AVFrame * frame
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AD
Definition evrcdec.c:920
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition opt.h:330
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_STEREO
#define AV_CH_SIDE_LEFT
#define AV_CH_TOP_FRONT_LEFT
#define AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_BACK_CENTER
#define AV_CH_TOP_FRONT_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_BACK_RIGHT
#define AV_CH_FRONT_CENTER
#define AV_CH_SIDE_RIGHT
#define AV_CH_BACK_LEFT
#define AV_CH_LOW_FREQUENCY
#define AV_CH_TOP_FRONT_RIGHT
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition codec.h:79
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition codec.h:94
@ AV_CODEC_ID_AAC
Definition codec_id.h:455
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition error.h:73
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AVERROR_EOF
End of file.
Definition error.h:57
#define AVERROR(e)
Definition error.h:45
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition frame.h:687
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition samplefmt.c:108
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
#define av_fallthrough
Definition attributes.h:67
#define av_cold
Definition attributes.h:117
static av_cold void fdk_aac_decode_flush(AVCodecContext *avctx)
static const AVOption fdk_aac_dec_options[]
static int get_stream_info(AVCodecContext *avctx, AVFrame *frame)
static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
#define DECODER_BUFFSIZE
#define AAC_PCM_MAX_OUTPUT_CHANNELS
static av_cold int fdk_aac_decode_close(AVCodecContext *avctx)
#define OFFSET(x)
ConcealMethod
@ CONCEAL_METHOD_NB
@ CONCEAL_METHOD_SPECTRAL_MUTING
@ CONCEAL_METHOD_ENERGY_INTERPOLATION
@ CONCEAL_METHOD_NOISE_SUBSTITUTION
static const AVClass fdk_aac_dec_class
#define DMX_ANC_BUFFSIZE
static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
#define DECODER_MAX_CHANNELS
#define FFMIN(a, b)
Definition macros.h:49
Memory handling functions.
#define av_malloc(s)
Definition ops_static.c:52
AVOptions.
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
Definition log.h:76
main external API structure.
Definition avcodec.h:443
AVChannelLayout ch_layout
Audio channel layout.
Definition avcodec.h:1055
enum AVSampleFormat sample_fmt
audio sample format
Definition avcodec.h:1047
int profile
profile
Definition avcodec.h:1636
int sample_rate
samples per second
Definition avcodec.h:1040
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition avcodec.h:526
int extradata_size
Definition avcodec.h:527
int frame_size
Number of samples per channel in an audio frame.
Definition avcodec.h:1068
void * priv_data
Definition avcodec.h:470
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVOption.
Definition opt.h:428
This structure stores compressed data.
Definition packet.h:580
int size
Definition packet.h:604
uint8_t * data
Definition packet.h:603
uint8_t * anc_buffer
uint8_t * decoder_buffer
HANDLE_AACDECODER handle
AVChannelLayout downmix_layout
#define av_freep(p)
#define av_log(a,...)