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 "internal.h"
27 
28 #ifdef AACDECODER_LIB_VL0
29 #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
30  ((AACDECODER_LIB_VL0 > vl0) || \
31  (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
32 #else
33 #define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
34 #endif
35 
36 #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
37 #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
38 #endif
39 
45 };
46 
47 typedef struct FDKAACDecContext {
48  const AVClass *class;
49  HANDLE_AACDECODER handle;
54  int drc_level;
55  int drc_boost;
56  int drc_heavy;
58  int drc_cut;
62 
63 
64 #define DMX_ANC_BUFFSIZE 128
65 #define DECODER_MAX_CHANNELS 8
66 #define DECODER_BUFFSIZE 2048 * sizeof(INT_PCM)
67 
68 #define OFFSET(x) offsetof(FDKAACDecContext, x)
69 #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
70 static const AVOption fdk_aac_dec_options[] = {
71  { "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, "conceal" },
72  { "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, "conceal" },
73  { "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, "conceal" },
74  { "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, "conceal" },
75  { "drc_boost", "Dynamic Range Control: boost, where [0] is none and [127] is max boost",
76  OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL },
77  { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression",
78  OFFSET(drc_cut), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL },
79  { "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",
80  OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -2, 127, AD, NULL },
81  { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off",
82  OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL },
83 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
84  { "level_limit", "Signal level limiting",
85  OFFSET(level_limit), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, AD },
86 #endif
87 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
88  { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general",
89  OFFSET(drc_effect), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 8, AD, NULL },
90 #endif
91  { NULL }
92 };
93 
94 static const AVClass fdk_aac_dec_class = {
95  .class_name = "libfdk-aac decoder",
96  .item_name = av_default_item_name,
97  .option = fdk_aac_dec_options,
98  .version = LIBAVUTIL_VERSION_INT,
99 };
100 
101 static int get_stream_info(AVCodecContext *avctx)
102 {
103  FDKAACDecContext *s = avctx->priv_data;
104  CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle);
105  int channel_counts[0x24] = { 0 };
106  int i, ch_error = 0;
107  uint64_t ch_layout = 0;
108 
109  if (!info) {
110  av_log(avctx, AV_LOG_ERROR, "Unable to get stream info\n");
111  return AVERROR_UNKNOWN;
112  }
113 
114  if (info->sampleRate <= 0) {
115  av_log(avctx, AV_LOG_ERROR, "Stream info not initialized\n");
116  return AVERROR_UNKNOWN;
117  }
118  avctx->sample_rate = info->sampleRate;
119  avctx->frame_size = info->frameSize;
120 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
121  s->output_delay = info->outputDelay;
122 #endif
123 
124  for (i = 0; i < info->numChannels; i++) {
125  AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i];
126  if (ctype <= ACT_NONE || ctype >= FF_ARRAY_ELEMS(channel_counts)) {
127  av_log(avctx, AV_LOG_WARNING, "unknown channel type\n");
128  break;
129  }
130  channel_counts[ctype]++;
131  }
132  av_log(avctx, AV_LOG_DEBUG,
133  "%d channels - front:%d side:%d back:%d lfe:%d top:%d\n",
134  info->numChannels,
135  channel_counts[ACT_FRONT], channel_counts[ACT_SIDE],
136  channel_counts[ACT_BACK], channel_counts[ACT_LFE],
137  channel_counts[ACT_FRONT_TOP] + channel_counts[ACT_SIDE_TOP] +
138  channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP]);
139 
140  switch (channel_counts[ACT_FRONT]) {
141  case 4:
144  break;
145  case 3:
147  break;
148  case 2:
149  ch_layout |= AV_CH_LAYOUT_STEREO;
150  break;
151  case 1:
152  ch_layout |= AV_CH_FRONT_CENTER;
153  break;
154  default:
155  av_log(avctx, AV_LOG_WARNING,
156  "unsupported number of front channels: %d\n",
157  channel_counts[ACT_FRONT]);
158  ch_error = 1;
159  break;
160  }
161  if (channel_counts[ACT_SIDE] > 0) {
162  if (channel_counts[ACT_SIDE] == 2) {
163  ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT;
164  } else {
165  av_log(avctx, AV_LOG_WARNING,
166  "unsupported number of side channels: %d\n",
167  channel_counts[ACT_SIDE]);
168  ch_error = 1;
169  }
170  }
171  if (channel_counts[ACT_BACK] > 0) {
172  switch (channel_counts[ACT_BACK]) {
173  case 3:
175  break;
176  case 2:
177  ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT;
178  break;
179  case 1:
180  ch_layout |= AV_CH_BACK_CENTER;
181  break;
182  default:
183  av_log(avctx, AV_LOG_WARNING,
184  "unsupported number of back channels: %d\n",
185  channel_counts[ACT_BACK]);
186  ch_error = 1;
187  break;
188  }
189  }
190  if (channel_counts[ACT_LFE] > 0) {
191  if (channel_counts[ACT_LFE] == 1) {
192  ch_layout |= AV_CH_LOW_FREQUENCY;
193  } else {
194  av_log(avctx, AV_LOG_WARNING,
195  "unsupported number of LFE channels: %d\n",
196  channel_counts[ACT_LFE]);
197  ch_error = 1;
198  }
199  }
200  if (!ch_error &&
201  av_get_channel_layout_nb_channels(ch_layout) != info->numChannels) {
202  av_log(avctx, AV_LOG_WARNING, "unsupported channel configuration\n");
203  ch_error = 1;
204  }
205  if (ch_error)
206  avctx->channel_layout = 0;
207  else
208  avctx->channel_layout = ch_layout;
209 
210  avctx->channels = info->numChannels;
211 
212  return 0;
213 }
214 
216 {
217  FDKAACDecContext *s = avctx->priv_data;
218 
219  if (s->handle)
220  aacDecoder_Close(s->handle);
221  av_freep(&s->decoder_buffer);
222  av_freep(&s->anc_buffer);
223 
224  return 0;
225 }
226 
228 {
229  FDKAACDecContext *s = avctx->priv_data;
230  AAC_DECODER_ERROR err;
231 
232  s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1);
233  if (!s->handle) {
234  av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n");
235  return AVERROR_UNKNOWN;
236  }
237 
238  if (avctx->extradata_size) {
239  if ((err = aacDecoder_ConfigRaw(s->handle, &avctx->extradata,
240  &avctx->extradata_size)) != AAC_DEC_OK) {
241  av_log(avctx, AV_LOG_ERROR, "Unable to set extradata\n");
242  return AVERROR_INVALIDDATA;
243  }
244  }
245 
246  if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
247  s->conceal_method)) != AAC_DEC_OK) {
248  av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
249  return AVERROR_UNKNOWN;
250  }
251 
252  if (avctx->request_channel_layout > 0 &&
254  int downmix_channels = -1;
255 
256  switch (avctx->request_channel_layout) {
257  case AV_CH_LAYOUT_STEREO:
259  downmix_channels = 2;
260  break;
261  case AV_CH_LAYOUT_MONO:
262  downmix_channels = 1;
263  break;
264  default:
265  av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n");
266  break;
267  }
268 
269  if (downmix_channels != -1) {
270  if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS,
271  downmix_channels) != AAC_DEC_OK) {
272  av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n");
273  } else {
274  s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE);
275  if (!s->anc_buffer) {
276  av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n");
277  return AVERROR(ENOMEM);
278  }
279  if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) {
280  av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n");
281  return AVERROR_UNKNOWN;
282  }
283  }
284  }
285  }
286 
287  if (s->drc_boost != -1) {
288  if (aacDecoder_SetParam(s->handle, AAC_DRC_BOOST_FACTOR, s->drc_boost) != AAC_DEC_OK) {
289  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC boost factor in the decoder\n");
290  return AVERROR_UNKNOWN;
291  }
292  }
293 
294  if (s->drc_cut != -1) {
295  if (aacDecoder_SetParam(s->handle, AAC_DRC_ATTENUATION_FACTOR, s->drc_cut) != AAC_DEC_OK) {
296  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC attenuation factor in the decoder\n");
297  return AVERROR_UNKNOWN;
298  }
299  }
300 
301  if (s->drc_level != -1) {
302  // This option defaults to -1, i.e. not calling
303  // aacDecoder_SetParam(AAC_DRC_REFERENCE_LEVEL) at all, which defaults
304  // to the level from DRC metadata, if available. The user can set
305  // -drc_level -2, which calls aacDecoder_SetParam(
306  // AAC_DRC_REFERENCE_LEVEL) with a negative value, which then
307  // explicitly disables the feature.
308  if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) {
309  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n");
310  return AVERROR_UNKNOWN;
311  }
312  }
313 
314  if (s->drc_heavy != -1) {
315  if (aacDecoder_SetParam(s->handle, AAC_DRC_HEAVY_COMPRESSION, s->drc_heavy) != AAC_DEC_OK) {
316  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC heavy compression in the decoder\n");
317  return AVERROR_UNKNOWN;
318  }
319  }
320 
321 #if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10
322  // Setting this parameter to -1 enables the auto behaviour in the library.
323  if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) {
324  av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n");
325  return AVERROR_UNKNOWN;
326  }
327 #endif
328 
329 #if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0
330  if (s->drc_effect != -1) {
331  if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) {
332  av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n");
333  return AVERROR_UNKNOWN;
334  }
335  }
336 #endif
337 
338  avctx->sample_fmt = AV_SAMPLE_FMT_S16;
339 
340  s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS;
341  s->decoder_buffer = av_malloc(s->decoder_buffer_size);
342  if (!s->decoder_buffer)
343  return AVERROR(ENOMEM);
344 
345  return 0;
346 }
347 
348 static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data,
349  int *got_frame_ptr, AVPacket *avpkt)
350 {
351  FDKAACDecContext *s = avctx->priv_data;
352  AVFrame *frame = data;
353  int ret;
354  AAC_DECODER_ERROR err;
355  UINT valid = avpkt->size;
356 
357  err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid);
358  if (err != AAC_DEC_OK) {
359  av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err);
360  return AVERROR_INVALIDDATA;
361  }
362 
363  err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size / sizeof(INT_PCM), 0);
364  if (err == AAC_DEC_NOT_ENOUGH_BITS) {
365  ret = avpkt->size - valid;
366  goto end;
367  }
368  if (err != AAC_DEC_OK) {
369  av_log(avctx, AV_LOG_ERROR,
370  "aacDecoder_DecodeFrame() failed: %x\n", err);
372  goto end;
373  }
374 
375  if ((ret = get_stream_info(avctx)) < 0)
376  goto end;
377  frame->nb_samples = avctx->frame_size;
378 
379  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
380  goto end;
381 
382  if (frame->pts != AV_NOPTS_VALUE)
383  frame->pts -= av_rescale_q(s->output_delay,
384  (AVRational){1, avctx->sample_rate},
385  avctx->time_base);
386 
387  memcpy(frame->extended_data[0], s->decoder_buffer,
388  avctx->channels * avctx->frame_size *
390 
391  *got_frame_ptr = 1;
392  ret = avpkt->size - valid;
393 
394 end:
395  return ret;
396 }
397 
399 {
400  FDKAACDecContext *s = avctx->priv_data;
401  AAC_DECODER_ERROR err;
402 
403  if (!s->handle)
404  return;
405 
406  if ((err = aacDecoder_SetParam(s->handle,
407  AAC_TPDEC_CLEAR_BUFFER, 1)) != AAC_DEC_OK)
408  av_log(avctx, AV_LOG_WARNING, "failed to clear buffer when flushing\n");
409 }
410 
412  .name = "libfdk_aac",
413  .long_name = NULL_IF_CONFIG_SMALL("Fraunhofer FDK AAC"),
414  .type = AVMEDIA_TYPE_AUDIO,
415  .id = AV_CODEC_ID_AAC,
416  .priv_data_size = sizeof(FDKAACDecContext),
419  .close = fdk_aac_decode_close,
422  .priv_class = &fdk_aac_dec_class,
423  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE |
425  .wrapper_name = "libfdk",
426 };
DECODER_BUFFSIZE
#define DECODER_BUFFSIZE
Definition: libfdk-aacdec.c:66
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1216
AVCodec
AVCodec.
Definition: codec.h:197
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:41
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
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::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1247
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1196
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:90
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:369
AVOption
AVOption.
Definition: opt.h:248
data
const char data[16]
Definition: mxf.c:142
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
AVCodecContext::request_channel_layout
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
Definition: avcodec.h:1254
AD
#define AD
Definition: libfdk-aacdec.c:69
DMX_ANC_BUFFSIZE
#define DMX_ANC_BUFFSIZE
Definition: libfdk-aacdec.c:64
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:31
FDKAACDecContext
Definition: libfdk-aacdec.c:47
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:53
FDKAACDecContext::conceal_method
int conceal_method
Definition: libfdk-aacdec.c:53
ff_libfdk_aac_decoder
AVCodec ff_libfdk_aac_decoder
Definition: libfdk-aacdec.c:411
get_stream_info
static int get_stream_info(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:101
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:91
AAC_PCM_MAX_OUTPUT_CHANNELS
#define AAC_PCM_MAX_OUTPUT_CHANNELS
Definition: libfdk-aacdec.c:37
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
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:52
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:638
s
#define s(width, name)
Definition: cbs_vp9.c:257
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
info
MIPS optimizations info
Definition: mips.txt:2
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:117
FDKAACDecContext::drc_heavy
int drc_heavy
Definition: libfdk-aacdec.c:56
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
OFFSET
#define OFFSET(x)
Definition: libfdk-aacdec.c:68
FDKAACDecContext::handle
HANDLE_AACDECODER handle
Definition: libfdk-aacdec.c:49
fdk_aac_decode_flush
static av_cold void fdk_aac_decode_flush(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:398
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:592
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
AV_CH_FRONT_CENTER
#define AV_CH_FRONT_CENTER
Definition: channel_layout.h:51
FDKAACDecContext::level_limit
int level_limit
Definition: libfdk-aacdec.c:59
AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:55
FDKAACDecContext::drc_effect
int drc_effect
Definition: libfdk-aacdec.c:57
av_get_channel_layout_nb_channels
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
Definition: channel_layout.c:226
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:104
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:426
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:659
FDKAACDecContext::decoder_buffer_size
int decoder_buffer_size
Definition: libfdk-aacdec.c:51
FDKAACDecContext::anc_buffer
uint8_t * anc_buffer
Definition: libfdk-aacdec.c:52
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1900
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:370
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
fdk_aac_dec_options
static const AVOption fdk_aac_dec_options[]
Definition: libfdk-aacdec.c:70
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1204
FDKAACDecContext::drc_cut
int drc_cut
Definition: libfdk-aacdec.c:58
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
fdk_aac_dec_class
static const AVClass fdk_aac_dec_class
Definition: libfdk-aacdec.c:94
ConcealMethod
ConcealMethod
Definition: libfdk-aacdec.c:40
FDKAACDecContext::decoder_buffer
uint8_t * decoder_buffer
Definition: libfdk-aacdec.c:50
AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:56
CONCEAL_METHOD_ENERGY_INTERPOLATION
@ CONCEAL_METHOD_ENERGY_INTERPOLATION
Definition: libfdk-aacdec.c:43
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:1197
FDKAACDecContext::drc_level
int drc_level
Definition: libfdk-aacdec.c:54
i
int i
Definition: input.c:407
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:106
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:637
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: internal.h:49
fdk_aac_decode_frame
static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: libfdk-aacdec.c:348
common.h
AV_CH_LAYOUT_NATIVE
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
Definition: channel_layout.h:83
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:57
CONCEAL_METHOD_SPECTRAL_MUTING
@ CONCEAL_METHOD_SPECTRAL_MUTING
Definition: libfdk-aacdec.c:41
uint8_t
uint8_t
Definition: audio_convert.c:194
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
FDKAACDecContext::drc_boost
int drc_boost
Definition: libfdk-aacdec.c:55
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:204
AV_CH_SIDE_RIGHT
#define AV_CH_SIDE_RIGHT
Definition: channel_layout.h:59
CONCEAL_METHOD_NOISE_SUBSTITUTION
@ CONCEAL_METHOD_NOISE_SUBSTITUTION
Definition: libfdk-aacdec.c:42
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:72
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:264
fdk_aac_decode_close
static av_cold int fdk_aac_decode_close(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:215
channel_counts
static const uint8_t channel_counts[7]
Definition: dca_lbr.c:110
AVCodecContext
main external API structure.
Definition: avcodec.h:536
channel_layout.h
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVPacket
This structure stores compressed data.
Definition: packet.h:346
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:563
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:242
FDKAACDecContext::output_delay
int output_delay
Definition: libfdk-aacdec.c:60
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
DECODER_MAX_CHANNELS
#define DECODER_MAX_CHANNELS
Definition: libfdk-aacdec.c:65
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:54
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
CONCEAL_METHOD_NB
@ CONCEAL_METHOD_NB
Definition: libfdk-aacdec.c:44
fdk_aac_decode_init
static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
Definition: libfdk-aacdec.c:227
AV_CH_SIDE_LEFT
#define AV_CH_SIDE_LEFT
Definition: channel_layout.h:58