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/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 
47 };
48 
49 typedef struct FDKAACDecContext {
50  const AVClass *class;
51  HANDLE_AACDECODER handle;
52  uint8_t *decoder_buffer;
54  uint8_t *anc_buffer;
56  int drc_level;
57  int drc_boost;
58  int drc_heavy;
60  int drc_cut;
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
78 static 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 
107 static const AVClass fdk_aac_dec_class = {
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 4:
165  break;
166  case 3:
168  break;
169  case 2:
170  ch_layout |= AV_CH_LAYOUT_STEREO;
171  break;
172  case 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  if (channel_counts[ACT_SIDE] > 0) {
183  if (channel_counts[ACT_SIDE] == 2) {
184  ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
185  } else {
186  av_log(avctx, AV_LOG_WARNING,
187  "unsupported number of side channels: %d\n",
188  channel_counts[ACT_SIDE]);
189  ch_error = 1;
190  }
191  }
192  if (channel_counts[ACT_BACK] > 0) {
193  switch (channel_counts[ACT_BACK]) {
194  case 4:
196  break;
197  case 3:
199  break;
200  case 2:
201  ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
202  break;
203  case 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:
229  break;
230  case 2:
232  break;
233  case 1:
234  ch_layout |= AV_CH_TOP_FRONT_CENTER;
235  break;
236  default:
237  av_log(avctx, AV_LOG_WARNING,
238  "unsupported number of top front channels: %d\n",
239  channel_counts[ACT_FRONT_TOP]);
240  ch_error = 1;
241  break;
242  }
243  }
244 
246  av_channel_layout_from_mask(&avctx->ch_layout, ch_layout);
247  if (!ch_error && avctx->ch_layout.nb_channels != info->numChannels) {
248  av_log(avctx, AV_LOG_WARNING, "unsupported channel configuration\n");
249  ch_error = 1;
250  }
251  if (ch_error)
253 
254  return 0;
255 }
256 
258 {
259  FDKAACDecContext *s = avctx->priv_data;
260 
261  if (s->handle)
262  aacDecoder_Close(s->handle);
263  av_freep(&s->decoder_buffer);
264  av_freep(&s->anc_buffer);
265 
266  return 0;
267 }
268 
270 {
271  FDKAACDecContext *s = avctx->priv_data;
272  AAC_DECODER_ERROR err;
273 
274  s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
275  if (!s->handle) {
276  av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
277  return AVERROR_UNKNOWN;
278  }
279 
280  if (avctx->extradata_size) {
281  if ((err = aacDecoder_ConfigRaw(s->handle, &avctx->extradata,
282  &avctx->extradata_size)) != AAC_DEC_OK) {
283  av_log(avctx, AV_LOG_ERROR, "Unable to set extradata\n");
284  return AVERROR_INVALIDDATA;
285  }
286  }
287 
288  if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
289  s->conceal_method)) != AAC_DEC_OK) {
290  av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
291  return AVERROR_UNKNOWN;
292  }
293 
294  if (s->downmix_layout.nb_channels > 0 &&
295  s->downmix_layout.order == AV_CHANNEL_ORDER_NATIVE) {
296  int downmix_channels = -1;
297 
298  switch (s->downmix_layout.u.mask) {
299  case AV_CH_LAYOUT_STEREO:
301  downmix_channels = 2;
302  break;
303  case AV_CH_LAYOUT_MONO:
304  downmix_channels = 1;
305  break;
306  default:
307  av_log(avctx, AV_LOG_WARNING, "Invalid downmix option\n");
308  break;
309  }
310 
311  if (downmix_channels != -1) {
312  if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS,
313  downmix_channels) != AAC_DEC_OK) {
314  av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
315  } else {
316  s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE);
317  if (!s->anc_buffer) {
318  av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n");
319  return AVERROR(ENOMEM);
320  }
321  if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) {
322  av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n");
323  return AVERROR_UNKNOWN;
324  }
325  }
326  }
327 #if FDKDEC_VER_AT_LEAST(2, 5)
328  } else {
329  // AAC_PCM_MAX_OUTPUT_CHANNELS == 0 means outputting all the coded channels
330  if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS, 0) != AAC_DEC_OK)
331  av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
332 #endif
333  }
334 
335  if (s->drc_boost != -1) {
336  if (aacDecoder_SetParam(s->handle, AAC_DRC_BOOST_FACTOR, s->drc_boost) != AAC_DEC_OK) {
337  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC boost factor in the decoder\n");
338  return AVERROR_UNKNOWN;
339  }
340  }
341 
342  if (s->drc_cut != -1) {
343  if (aacDecoder_SetParam(s->handle, AAC_DRC_ATTENUATION_FACTOR, s->drc_cut) != AAC_DEC_OK) {
344  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC attenuation factor in the decoder\n");
345  return AVERROR_UNKNOWN;
346  }
347  }
348 
349  if (s->drc_level != -1) {
350  // This option defaults to -1, i.e. not calling
351  // aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults
352  // to the level from DRC metadata, if available. The user can set
353  // -drc_level -2, which calls aacDecoder_SetParam(
354  // AAC_DRC_REFERENCE_LEVEL) with a negative value, which then
355  // explicitly disables the feature.
356  if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) {
357  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n");
358  return AVERROR_UNKNOWN;
359  }
360  }
361 
362  if (s->drc_heavy != -1) {
363  if (aacDecoder_SetParam(s->handle, AAC_DRC_HEAVY_COMPRESSION, s->drc_heavy) != AAC_DEC_OK) {
364  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC heavy compression in the decoder\n");
365  return AVERROR_UNKNOWN;
366  }
367  }
368 
369 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
370  // Setting this parameter to -1 enables the auto behaviour in the library.
371  if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
372  av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
373  return AVERROR_UNKNOWN;
374  }
375 #endif
376 
377 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
378  if (s->drc_effect != -1) {
379  if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) {
380  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n");
381  return AVERROR_UNKNOWN;
382  }
383  }
384 #endif
385 
386 #if FDKDEC_VER_AT_LEAST(3, 1) // 3.1.0
387  if (s->album_mode != -1) {
388  if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_ALBUM_MODE, s->album_mode) != AAC_DEC_OK) {
389  av_log(avctx, AV_LOG_ERROR, "Unable to set album mode in the decoder\n");
390  return AVERROR_UNKNOWN;
391  }
392  }
393 #endif
394 
395  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
396 
397  s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
398  s->decoder_buffer = av_malloc(s->decoder_buffer_size);
399  if (!s->decoder_buffer)
400  return AVERROR(ENOMEM);
401 
402  return 0;
403 }
404 
406  int *got_frame_ptr, AVPacket *avpkt)
407 {
408  FDKAACDecContext *s = avctx->priv_data;
409  int ret;
410  AAC_DECODER_ERROR err;
411  UINT valid = avpkt->size;
412  UINT flags = 0;
413  int input_offset = 0;
414 
415  if (avpkt->size) {
416  err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid);
417  if (err != AAC_DEC_OK) {
418  av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err);
419  return AVERROR_INVALIDDATA;
420  }
421  } else {
422 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
423  /* Handle decoder draining */
424  if (s->flush_samples > 0) {
425  flags |= AACDEC_FLUSH;
426  } else {
427  return AVERROR_EOF;
428  }
429 #else
430  return AVERROR_EOF;
431 #endif
432  }
433 
434  err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer,
435  s->decoder_buffer_size / sizeof(INT_PCM),
436  flags);
437  if (err == AAC_DEC_NOT_ENOUGH_BITS) {
438  ret = avpkt->size - valid;
439  goto end;
440  }
441  if (err != AAC_DEC_OK) {
442  av_log(avctx, AV_LOG_ERROR,
443  "aacDecoder_DecodeFrame() failed: %x\n", err);
445  goto end;
446  }
447 
448  if ((ret = get_stream_info(avctx, frame)) < 0)
449  goto end;
450  frame->nb_samples = avctx->frame_size;
451 
452 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
453  if (flags & AACDEC_FLUSH) {
454  // Only return the right amount of samples at the end; if calling the
455  // decoder with AACDEC_FLUSH, it will keep returning frames indefinitely.
456  frame->nb_samples = FFMIN(s->flush_samples, frame->nb_samples);
457  av_log(s, AV_LOG_DEBUG, "Returning %d/%d delayed samples.\n",
458  frame->nb_samples, s->flush_samples);
459  s->flush_samples -= frame->nb_samples;
460  } else {
461  // Trim off samples from the start to compensate for extra decoder
462  // delay. We could also just adjust the pts, but this avoids
463  // including the extra samples in the output altogether.
464  if (s->delay_samples) {
465  int drop_samples = FFMIN(s->delay_samples, frame->nb_samples);
466  av_log(s, AV_LOG_DEBUG, "Dropping %d/%d delayed samples.\n",
467  drop_samples, s->delay_samples);
468  s->delay_samples -= drop_samples;
469  frame->nb_samples -= drop_samples;
470  input_offset = drop_samples * avctx->ch_layout.nb_channels;
471  if (frame->nb_samples <= 0)
472  return 0;
473  }
474  }
475 #endif
476 
477  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
478  goto end;
479 
480  memcpy(frame->extended_data[0], s->decoder_buffer + input_offset,
481  avctx->ch_layout.nb_channels * frame->nb_samples *
483 
484  *got_frame_ptr = 1;
485  ret = avpkt->size - valid;
486 
487 end:
488  return ret;
489 }
490 
492 {
493  FDKAACDecContext *s = avctx->priv_data;
494  AAC_DECODER_ERROR err;
495 
496  if (!s->handle)
497  return;
498 
499  if ((err = aacDecoder_SetParam(s->handle,
500  AAC_TPDEC_CLEAR_BUFFER, 1)) != AAC_DEC_OK)
501  av_log(avctx, AV_LOG_WARNING, "failed to clear buffer when flushing\n");
502 }
503 
505  .p.name = "libfdk_aac",
506  CODEC_LONG_NAME("Fraunhofer FDK AAC"),
507  .p.type = AVMEDIA_TYPE_AUDIO,
508  .p.id = AV_CODEC_ID_AAC,
509  .priv_data_size = sizeof(FDKAACDecContext),
512  .close = fdk_aac_decode_close,
513  .flush = fdk_aac_decode_flush,
514  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF
515 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
517 #endif
518  ,
519  .p.priv_class = &fdk_aac_dec_class,
520  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
521  .p.wrapper_name = "libfdk",
522 };
DECODER_BUFFSIZE
#define DECODER_BUFFSIZE
Definition: libfdk-aacdec.c:74
flags
const SwsFlags flags[]
Definition: swscale.c:72
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1068
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
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:43
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
AV_CH_TOP_FRONT_CENTER
#define AV_CH_TOP_FRONT_CENTER
Definition: channel_layout.h:188
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1040
ctype
#define ctype
Definition: afir_template.c:46
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:217
AV_CH_TOP_FRONT_RIGHT
#define AV_CH_TOP_FRONT_RIGHT
Definition: channel_layout.h:189
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:459
AVPacket::data
uint8_t * data
Definition: packet.h:595
AVOption
AVOption.
Definition: opt.h:429
FFCodec
Definition: codec_internal.h:127
AV_CH_TOP_FRONT_LEFT
#define AV_CH_TOP_FRONT_LEFT
Definition: channel_layout.h:187
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:324
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:329
AD
#define AD
Definition: libfdk-aacdec.c:77
DMX_ANC_BUFFSIZE
#define DMX_ANC_BUFFSIZE
Definition: libfdk-aacdec.c:72
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:1055
FDKAACDecContext
Definition: libfdk-aacdec.c:49
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:179
FDKAACDecContext::conceal_method
int conceal_method
Definition: libfdk-aacdec.c:55
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:218
AAC_PCM_MAX_OUTPUT_CHANNELS
#define AAC_PCM_MAX_OUTPUT_CHANNELS
Definition: libfdk-aacdec.c:39
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:119
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:674
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:178
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:527
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:347
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:201
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:119
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:253
info
MIPS optimizations info
Definition: mips.txt:2
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:255
FDKAACDecContext::drc_heavy
int drc_heavy
Definition: libfdk-aacdec.c:58
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
decode.h
OFFSET
#define OFFSET(x)
Definition: libfdk-aacdec.c:76
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:332
FDKAACDecContext::handle
HANDLE_AACDECODER handle
Definition: libfdk-aacdec.c:51
fdk_aac_decode_flush
static av_cold void fdk_aac_decode_flush(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:491
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
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:242
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition: opt.h:331
AV_CH_FRONT_CENTER
#define AV_CH_FRONT_CENTER
Definition: channel_layout.h:177
FDKAACDecContext::level_limit
int level_limit
Definition: libfdk-aacdec.c:62
AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:181
FDKAACDecContext::album_mode
int album_mode
Definition: libfdk-aacdec.c:61
FDKAACDecContext::drc_effect
int drc_effect
Definition: libfdk-aacdec.c:59
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:91
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:463
FDKAACDecContext::decoder_buffer_size
int decoder_buffer_size
Definition: libfdk-aacdec.c:53
FDKAACDecContext::anc_buffer
uint8_t * anc_buffer
Definition: libfdk-aacdec.c:54
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1768
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:551
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:596
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
codec_internal.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
fdk_aac_dec_options
static const AVOption fdk_aac_dec_options[]
Definition: libfdk-aacdec.c:78
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1047
FDKAACDecContext::drc_cut
int drc_cut
Definition: libfdk-aacdec.c:60
fdk_aac_dec_class
static const AVClass fdk_aac_dec_class
Definition: libfdk-aacdec.c:107
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:125
ConcealMethod
ConcealMethod
Definition: libfdk-aacdec.c:42
FDKAACDecContext::decoder_buffer
uint8_t * decoder_buffer
Definition: libfdk-aacdec.c:52
AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:182
CONCEAL_METHOD_ENERGY_INTERPOLATION
@ CONCEAL_METHOD_ENERGY_INTERPOLATION
Definition: libfdk-aacdec.c:45
FDKAACDecContext::downmix_layout
AVChannelLayout downmix_layout
Definition: libfdk-aacdec.c:68
get_stream_info
static int get_stream_info(AVCodecContext *avctx, AVFrame *frame)
Definition: libfdk-aacdec.c:114
FDKAACDecContext::drc_level
int drc_level
Definition: libfdk-aacdec.c:56
av_malloc
#define av_malloc(s)
Definition: ops_asmgen.c:44
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
Out-of-band global headers that may be used by some codecs.
Definition: avcodec.h:526
common.h
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:183
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
CONCEAL_METHOD_SPECTRAL_MUTING
@ CONCEAL_METHOD_SPECTRAL_MUTING
Definition: libfdk-aacdec.c:43
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:57
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
AV_CH_SIDE_RIGHT
#define AV_CH_SIDE_RIGHT
Definition: channel_layout.h:185
CONCEAL_METHOD_NOISE_SUBSTITUTION
@ CONCEAL_METHOD_NOISE_SUBSTITUTION
Definition: libfdk-aacdec.c:44
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:81
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
fdk_aac_decode_close
static av_cold int fdk_aac_decode_close(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:257
ff_libfdk_aac_decoder
const FFCodec ff_libfdk_aac_decoder
Definition: libfdk-aacdec.c:504
AVCodecContext
main external API structure.
Definition: avcodec.h:443
channel_layout.h
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1636
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:443
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
mem.h
AVPacket
This structure stores compressed data.
Definition: packet.h:572
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
DECODER_MAX_CHANNELS
#define DECODER_MAX_CHANNELS
Definition: libfdk-aacdec.c:73
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:180
fdk_aac_decode_frame
static int fdk_aac_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: libfdk-aacdec.c:405
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
CONCEAL_METHOD_NB
@ CONCEAL_METHOD_NB
Definition: libfdk-aacdec.c:46
fdk_aac_decode_init
static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:269
AV_CH_SIDE_LEFT
#define AV_CH_SIDE_LEFT
Definition: channel_layout.h:184