FFmpeg
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/opt.h"
25 #include "avcodec.h"
26 #include "codec_internal.h"
27 #include "decode.h"
28 
29 #ifdef AACDECODER_LIB_VL0
30 #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
31  ((AACDECODER_LIB_VL0 > vl0) || \
32  (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
33 #else
34 #define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
35 #endif
36 
37 #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
38 #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
39 #endif
40 
46 };
47 
48 typedef struct FDKAACDecContext {
49  const AVClass *class;
50  HANDLE_AACDECODER handle;
51  uint8_t *decoder_buffer;
53  uint8_t *anc_buffer;
55  int drc_level;
56  int drc_boost;
57  int drc_heavy;
59  int drc_cut;
62 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
63  int output_delay_set;
64  int flush_samples;
65  int delay_samples;
66 #endif
69 
70 
71 #define DMX_ANC_BUFFSIZE 128
72 #define DECODER_MAX_CHANNELS 8
73 #define DECODER_BUFFSIZE 2048 * sizeof(INT_PCM)
74 
75 #define OFFSET(x) offsetof(FDKAACDecContext, x)
76 #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
77 static const AVOption fdk_aac_dec_options[] = {
78  { "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" },
79  { "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
80  { "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
81  { "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, .unit = "conceal" },
82  { "drc_boost", "Dynamic Range Control: boost, where [0] is none and [127] is max boost",
83  OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, .unit = NULL },
84  { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression",
85  OFFSET(drc_cut), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, .unit = NULL },
86  { "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",
87  OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -2, 127, AD, .unit = NULL },
88  { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off",
89  OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, .unit = NULL },
90 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
91  { "level_limit", "Signal level limiting",
92  OFFSET(level_limit), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, AD },
93 #endif
94 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
95  { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general",
96  OFFSET(drc_effect), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 8, AD, .unit = NULL },
97 #endif
98 #if FDKDEC_VER_AT_LEAST(3, 1) // 3.1.0
99  { "album_mode","Dynamic Range Control: album mode, where [0] is off and [1] is on",
100  OFFSET(album_mode), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, .unit = NULL },
101 #endif
102  { "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = AD },
103  { NULL }
104 };
105 
106 static const AVClass fdk_aac_dec_class = {
107  .class_name = "libfdk-aac decoder",
108  .item_name = av_default_item_name,
109  .option = fdk_aac_dec_options,
110  .version = LIBAVUTIL_VERSION_INT,
111 };
112 
113 static int get_stream_info(AVCodecContext *avctx)
114 {
115  FDKAACDecContext *s = avctx->priv_data;
116  CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle);
117  int channel_counts[0x24] = { 0 };
118  int i, ch_error = 0;
119  uint64_t ch_layout = 0;
120 
121  if (!info) {
122  av_log(avctx, AV_LOG_ERROR, "Unable to get stream info\n");
123  return AVERROR_UNKNOWN;
124  }
125 
126  if (info->sampleRate <= 0) {
127  av_log(avctx, AV_LOG_ERROR, "Stream info not initialized\n");
128  return AVERROR_UNKNOWN;
129  }
130  avctx->sample_rate = info->sampleRate;
131  avctx->frame_size = info->frameSize;
132 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
133  if (!s->output_delay_set && info->outputDelay) {
134  // Set this only once.
135  s->flush_samples = info->outputDelay;
136  s->delay_samples = info->outputDelay;
137  s->output_delay_set = 1;
138  }
139 #endif
140 
141  for (i = 0; i < info->numChannels; i++) {
142  AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
143  if (ctype <= ACT_NONE || ctype >= FF_ARRAY_ELEMS(channel_counts)) {
144  av_log(avctx, AV_LOG_WARNING, "unknown channel type\n");
145  break;
146  }
147  channel_counts[ctype]++;
148  }
149  av_log(avctx, AV_LOG_DEBUG,
150  "%d channels - front:%d side:%d back:%d lfe:%d top:%d\n",
151  info->numChannels,
152  channel_counts[ACT_FRONT], channel_counts[ACT_SIDE],
153  channel_counts[ACT_BACK], channel_counts[ACT_LFE],
154  channel_counts[ACT_FRONT_TOP] + channel_counts[ACT_SIDE_TOP] +
155  channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP]);
156 
157  switch (channel_counts[ACT_FRONT]) {
158  case 4:
161  break;
162  case 3:
164  break;
165  case 2:
166  ch_layout |= AV_CH_LAYOUT_STEREO;
167  break;
168  case 1:
169  ch_layout |= AV_CH_FRONT_CENTER;
170  break;
171  default:
172  av_log(avctx, AV_LOG_WARNING,
173  "unsupported number of front channels: %d\n",
174  channel_counts[ACT_FRONT]);
175  ch_error = 1;
176  break;
177  }
178  if (channel_counts[ACT_SIDE] > 0) {
179  if (channel_counts[ACT_SIDE] == 2) {
180  ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
181  } else {
182  av_log(avctx, AV_LOG_WARNING,
183  "unsupported number of side channels: %d\n",
184  channel_counts[ACT_SIDE]);
185  ch_error = 1;
186  }
187  }
188  if (channel_counts[ACT_BACK] > 0) {
189  switch (channel_counts[ACT_BACK]) {
190  case 3:
192  break;
193  case 2:
194  ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
195  break;
196  case 1:
197  ch_layout |= AV_CH_BACK_CENTER;
198  break;
199  default:
200  av_log(avctx, AV_LOG_WARNING,
201  "unsupported number of back channels: %d\n",
202  channel_counts[ACT_BACK]);
203  ch_error = 1;
204  break;
205  }
206  }
207  if (channel_counts[ACT_LFE] > 0) {
208  if (channel_counts[ACT_LFE] == 1) {
209  ch_layout |= AV_CH_LOW_FREQUENCY;
210  } else {
211  av_log(avctx, AV_LOG_WARNING,
212  "unsupported number of LFE channels: %d\n",
213  channel_counts[ACT_LFE]);
214  ch_error = 1;
215  }
216  }
217 
219  av_channel_layout_from_mask(&avctx->ch_layout, ch_layout);
220  if (!ch_error && avctx->ch_layout.nb_channels != info->numChannels) {
221  av_log(avctx, AV_LOG_WARNING, "unsupported channel configuration\n");
222  ch_error = 1;
223  }
224  if (ch_error)
226 
227  return 0;
228 }
229 
231 {
232  FDKAACDecContext *s = avctx->priv_data;
233 
234  if (s->handle)
235  aacDecoder_Close(s->handle);
236  av_freep(&s->decoder_buffer);
237  av_freep(&s->anc_buffer);
238 
239  return 0;
240 }
241 
243 {
244  FDKAACDecContext *s = avctx->priv_data;
245  AAC_DECODER_ERROR err;
246 
247  s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
248  if (!s->handle) {
249  av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
250  return AVERROR_UNKNOWN;
251  }
252 
253  if (avctx->extradata_size) {
254  if ((err = aacDecoder_ConfigRaw(s->handle, &avctx->extradata,
255  &avctx->extradata_size)) != AAC_DEC_OK) {
256  av_log(avctx, AV_LOG_ERROR, "Unable to set extradata\n");
257  return AVERROR_INVALIDDATA;
258  }
259  }
260 
261  if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
262  s->conceal_method)) != AAC_DEC_OK) {
263  av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
264  return AVERROR_UNKNOWN;
265  }
266 
267  if (s->downmix_layout.nb_channels > 0 &&
268  s->downmix_layout.order != AV_CHANNEL_ORDER_NATIVE) {
269  int downmix_channels = -1;
270 
271  switch (s->downmix_layout.u.mask) {
272  case AV_CH_LAYOUT_STEREO:
274  downmix_channels = 2;
275  break;
276  case AV_CH_LAYOUT_MONO:
277  downmix_channels = 1;
278  break;
279  default:
280  av_log(avctx, AV_LOG_WARNING, "Invalid downmix option\n");
281  break;
282  }
283 
284  if (downmix_channels != -1) {
285  if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS,
286  downmix_channels) != AAC_DEC_OK) {
287  av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
288  } else {
289  s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE);
290  if (!s->anc_buffer) {
291  av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n");
292  return AVERROR(ENOMEM);
293  }
294  if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) {
295  av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n");
296  return AVERROR_UNKNOWN;
297  }
298  }
299  }
300  }
301 
302  if (s->drc_boost != -1) {
303  if (aacDecoder_SetParam(s->handle, AAC_DRC_BOOST_FACTOR, s->drc_boost) != AAC_DEC_OK) {
304  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC boost factor in the decoder\n");
305  return AVERROR_UNKNOWN;
306  }
307  }
308 
309  if (s->drc_cut != -1) {
310  if (aacDecoder_SetParam(s->handle, AAC_DRC_ATTENUATION_FACTOR, s->drc_cut) != AAC_DEC_OK) {
311  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC attenuation factor in the decoder\n");
312  return AVERROR_UNKNOWN;
313  }
314  }
315 
316  if (s->drc_level != -1) {
317  // This option defaults to -1, i.e. not calling
318  // aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults
319  // to the level from DRC metadata, if available. The user can set
320  // -drc_level -2, which calls aacDecoder_SetParam(
321  // AAC_DRC_REFERENCE_LEVEL) with a negative value, which then
322  // explicitly disables the feature.
323  if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) {
324  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n");
325  return AVERROR_UNKNOWN;
326  }
327  }
328 
329  if (s->drc_heavy != -1) {
330  if (aacDecoder_SetParam(s->handle, AAC_DRC_HEAVY_COMPRESSION, s->drc_heavy) != AAC_DEC_OK) {
331  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC heavy compression in the decoder\n");
332  return AVERROR_UNKNOWN;
333  }
334  }
335 
336 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
337  // Setting this parameter to -1 enables the auto behaviour in the library.
338  if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
339  av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
340  return AVERROR_UNKNOWN;
341  }
342 #endif
343 
344 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
345  if (s->drc_effect != -1) {
346  if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) {
347  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n");
348  return AVERROR_UNKNOWN;
349  }
350  }
351 #endif
352 
353 #if FDKDEC_VER_AT_LEAST(3, 1) // 3.1.0
354  if (s->album_mode != -1) {
355  if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_ALBUM_MODE, s->album_mode) != AAC_DEC_OK) {
356  av_log(avctx, AV_LOG_ERROR, "Unable to set album mode in the decoder\n");
357  return AVERROR_UNKNOWN;
358  }
359  }
360 #endif
361 
362  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
363 
364  s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
365  s->decoder_buffer = av_malloc(s->decoder_buffer_size);
366  if (!s->decoder_buffer)
367  return AVERROR(ENOMEM);
368 
369  return 0;
370 }
371 
373  int *got_frame_ptr, AVPacket *avpkt)
374 {
375  FDKAACDecContext *s = avctx->priv_data;
376  int ret;
377  AAC_DECODER_ERROR err;
378  UINT valid = avpkt->size;
379  UINT flags = 0;
380  int input_offset = 0;
381 
382  if (avpkt->size) {
383  err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid);
384  if (err != AAC_DEC_OK) {
385  av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err);
386  return AVERROR_INVALIDDATA;
387  }
388  } else {
389 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
390  /* Handle decoder draining */
391  if (s->flush_samples > 0) {
392  flags |= AACDEC_FLUSH;
393  } else {
394  return AVERROR_EOF;
395  }
396 #else
397  return AVERROR_EOF;
398 #endif
399  }
400 
401  err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer,
402  s->decoder_buffer_size / sizeof(INT_PCM),
403  flags);
404  if (err == AAC_DEC_NOT_ENOUGH_BITS) {
405  ret = avpkt->size - valid;
406  goto end;
407  }
408  if (err != AAC_DEC_OK) {
409  av_log(avctx, AV_LOG_ERROR,
410  "aacDecoder_DecodeFrame() failed: %x\n", err);
412  goto end;
413  }
414 
415  if ((ret = get_stream_info(avctx)) < 0)
416  goto end;
417  frame->nb_samples = avctx->frame_size;
418 
419 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
420  if (flags & AACDEC_FLUSH) {
421  // Only return the right amount of samples at the end; if calling the
422  // decoder with AACDEC_FLUSH, it will keep returning frames indefinitely.
423  frame->nb_samples = FFMIN(s->flush_samples, frame->nb_samples);
424  av_log(s, AV_LOG_DEBUG, "Returning %d/%d delayed samples.\n",
425  frame->nb_samples, s->flush_samples);
426  s->flush_samples -= frame->nb_samples;
427  } else {
428  // Trim off samples from the start to compensate for extra decoder
429  // delay. We could also just adjust the pts, but this avoids
430  // including the extra samples in the output altogether.
431  if (s->delay_samples) {
432  int drop_samples = FFMIN(s->delay_samples, frame->nb_samples);
433  av_log(s, AV_LOG_DEBUG, "Dropping %d/%d delayed samples.\n",
434  drop_samples, s->delay_samples);
435  s->delay_samples -= drop_samples;
436  frame->nb_samples -= drop_samples;
437  input_offset = drop_samples * avctx->ch_layout.nb_channels;
438  if (frame->nb_samples <= 0)
439  return 0;
440  }
441  }
442 #endif
443 
444  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
445  goto end;
446 
447  memcpy(frame->extended_data[0], s->decoder_buffer + input_offset,
450 
451  *got_frame_ptr = 1;
452  ret = avpkt->size - valid;
453 
454 end:
455  return ret;
456 }
457 
459 {
460  FDKAACDecContext *s = avctx->priv_data;
461  AAC_DECODER_ERROR err;
462 
463  if (!s->handle)
464  return;
465 
466  if ((err = aacDecoder_SetParam(s->handle,
467  AAC_TPDEC_CLEAR_BUFFER, 1)) != AAC_DEC_OK)
468  av_log(avctx, AV_LOG_WARNING, "failed to clear buffer when flushing\n");
469 }
470 
472  .p.name = "libfdk_aac",
473  CODEC_LONG_NAME("Fraunhofer FDK AAC"),
474  .p.type = AVMEDIA_TYPE_AUDIO,
475  .p.id = AV_CODEC_ID_AAC,
476  .priv_data_size = sizeof(FDKAACDecContext),
479  .close = fdk_aac_decode_close,
480  .flush = fdk_aac_decode_flush,
481  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF
482 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
484 #endif
485  ,
486  .p.priv_class = &fdk_aac_dec_class,
487  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
488  .p.wrapper_name = "libfdk",
489 };
DECODER_BUFFSIZE
#define DECODER_BUFFSIZE
Definition: libfdk-aacdec.c:73
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1077
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1050
ctype
#define ctype
Definition: afir_template.c:47
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:204
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVPacket::data
uint8_t * data
Definition: packet.h:522
AVOption
AVOption.
Definition: opt.h:346
FFCodec
Definition: codec_internal.h:127
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:308
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
AD
#define AD
Definition: libfdk-aacdec.c:76
DMX_ANC_BUFFSIZE
#define DMX_ANC_BUFFSIZE
Definition: libfdk-aacdec.c:71
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:1065
FDKAACDecContext
Definition: libfdk-aacdec.c:48
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:172
FDKAACDecContext::conceal_method
int conceal_method
Definition: libfdk-aacdec.c:54
get_stream_info
static int get_stream_info(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:113
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:205
AAC_PCM_MAX_OUTPUT_CHANNELS
#define AAC_PCM_MAX_OUTPUT_CHANNELS
Definition: libfdk-aacdec.c:38
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:171
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:524
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CHANNEL_ORDER_UNSPEC
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
Definition: channel_layout.h:112
av_channel_layout_from_mask
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.
Definition: channel_layout.c:242
info
MIPS optimizations info
Definition: mips.txt:2
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:239
FDKAACDecContext::drc_heavy
int drc_heavy
Definition: libfdk-aacdec.c:57
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
decode.h
OFFSET
#define OFFSET(x)
Definition: libfdk-aacdec.c:75
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
FDKAACDecContext::handle
HANDLE_AACDECODER handle
Definition: libfdk-aacdec.c:50
fdk_aac_decode_flush
static av_cold void fdk_aac_decode_flush(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:458
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Definition: opt.h:252
AV_CH_FRONT_CENTER
#define AV_CH_FRONT_CENTER
Definition: channel_layout.h:170
FDKAACDecContext::level_limit
int level_limit
Definition: libfdk-aacdec.c:61
AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:174
FDKAACDecContext::album_mode
int album_mode
Definition: libfdk-aacdec.c:60
FDKAACDecContext::drc_effect
int drc_effect
Definition: libfdk-aacdec.c:58
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:442
FDKAACDecContext::decoder_buffer_size
int decoder_buffer_size
Definition: libfdk-aacdec.c:52
FDKAACDecContext::anc_buffer
uint8_t * anc_buffer
Definition: libfdk-aacdec.c:53
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1569
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:523
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:303
codec_internal.h
fdk_aac_dec_options
static const AVOption fdk_aac_dec_options[]
Definition: libfdk-aacdec.c:77
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1057
FDKAACDecContext::drc_cut
int drc_cut
Definition: libfdk-aacdec.c:59
fdk_aac_dec_class
static const AVClass fdk_aac_dec_class
Definition: libfdk-aacdec.c:106
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:118
ConcealMethod
ConcealMethod
Definition: libfdk-aacdec.c:41
FDKAACDecContext::decoder_buffer
uint8_t * decoder_buffer
Definition: libfdk-aacdec.c:51
AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:175
CONCEAL_METHOD_ENERGY_INTERPOLATION
@ CONCEAL_METHOD_ENERGY_INTERPOLATION
Definition: libfdk-aacdec.c:44
FDKAACDecContext::downmix_layout
AVChannelLayout downmix_layout
Definition: libfdk-aacdec.c:67
FDKAACDecContext::drc_level
int drc_level
Definition: libfdk-aacdec.c:55
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:424
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:523
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:405
common.h
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:176
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
CONCEAL_METHOD_SPECTRAL_MUTING
@ CONCEAL_METHOD_SPECTRAL_MUTING
Definition: libfdk-aacdec.c:42
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
FDKAACDecContext::drc_boost
int drc_boost
Definition: libfdk-aacdec.c:56
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
AV_CH_SIDE_RIGHT
#define AV_CH_SIDE_RIGHT
Definition: channel_layout.h:178
CONCEAL_METHOD_NOISE_SUBSTITUTION
@ CONCEAL_METHOD_NOISE_SUBSTITUTION
Definition: libfdk-aacdec.c:43
avcodec.h
ret
ret
Definition: filter_design.txt:187
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
fdk_aac_decode_close
static av_cold int fdk_aac_decode_close(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:230
ff_libfdk_aac_decoder
const FFCodec ff_libfdk_aac_decoder
Definition: libfdk-aacdec.c:471
AVCodecContext
main external API structure.
Definition: avcodec.h:445
channel_layout.h
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:432
AV_CODEC_CAP_DELAY
#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:76
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
DECODER_MAX_CHANNELS
#define DECODER_MAX_CHANNELS
Definition: libfdk-aacdec.c:72
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:173
fdk_aac_decode_frame
static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: libfdk-aacdec.c:372
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
CONCEAL_METHOD_NB
@ CONCEAL_METHOD_NB
Definition: libfdk-aacdec.c:45
fdk_aac_decode_init
static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:242
AV_CH_SIDE_LEFT
#define AV_CH_SIDE_LEFT
Definition: channel_layout.h:177