FFmpeg
audiotoolboxenc.c
Go to the documentation of this file.
1 /*
2  * Audio Toolbox system codecs
3  *
4  * copyright (c) 2016 rcombs
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <AudioToolbox/AudioToolbox.h>
24 
25 #define FF_BUFQUEUE_SIZE 256
27 
28 #include "config.h"
29 #include "audio_frame_queue.h"
30 #include "avcodec.h"
31 #include "bytestream.h"
32 #include "codec_internal.h"
33 #include "encode.h"
34 #include "internal.h"
35 #include "libavformat/isom.h"
36 #include "libavutil/avassert.h"
38 #include "libavutil/opt.h"
39 #include "libavutil/log.h"
40 
41 typedef struct ATDecodeContext {
43  int mode;
44  int quality;
45 
46  AudioConverterRef converter;
49 
50  unsigned pkt_size;
52  int eof;
54 
57 
58 static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
59 {
60  switch (codec) {
61  case AV_CODEC_ID_AAC:
62  switch (profile) {
63  case FF_PROFILE_AAC_LOW:
64  default:
65  return kAudioFormatMPEG4AAC;
66  case FF_PROFILE_AAC_HE:
67  return kAudioFormatMPEG4AAC_HE;
69  return kAudioFormatMPEG4AAC_HE_V2;
70  case FF_PROFILE_AAC_LD:
71  return kAudioFormatMPEG4AAC_LD;
72  case FF_PROFILE_AAC_ELD:
73  return kAudioFormatMPEG4AAC_ELD;
74  }
76  return kAudioFormatAppleIMA4;
77  case AV_CODEC_ID_ALAC:
78  return kAudioFormatAppleLossless;
79  case AV_CODEC_ID_ILBC:
80  return kAudioFormatiLBC;
82  return kAudioFormatALaw;
84  return kAudioFormatULaw;
85  default:
86  av_assert0(!"Invalid codec ID!");
87  return 0;
88  }
89 }
90 
91 static void ffat_update_ctx(AVCodecContext *avctx)
92 {
93  ATDecodeContext *at = avctx->priv_data;
94  UInt32 size = sizeof(unsigned);
95  AudioConverterPrimeInfo prime_info;
96  AudioStreamBasicDescription out_format;
97 
98  AudioConverterGetProperty(at->converter,
99  kAudioConverterPropertyMaximumOutputPacketSize,
100  &size, &at->pkt_size);
101 
102  if (at->pkt_size <= 0)
103  at->pkt_size = 1024 * 50;
104 
105  size = sizeof(prime_info);
106 
107  if (!AudioConverterGetProperty(at->converter,
108  kAudioConverterPrimeInfo,
109  &size, &prime_info)) {
110  avctx->initial_padding = prime_info.leadingFrames;
111  }
112 
113  size = sizeof(out_format);
114  if (!AudioConverterGetProperty(at->converter,
115  kAudioConverterCurrentOutputStreamDescription,
116  &size, &out_format)) {
117  if (out_format.mFramesPerPacket)
118  avctx->frame_size = out_format.mFramesPerPacket;
119  if (out_format.mBytesPerPacket && avctx->codec_id == AV_CODEC_ID_ILBC)
120  avctx->block_align = out_format.mBytesPerPacket;
121  }
122 
123  at->frame_size = avctx->frame_size;
124  if (avctx->codec_id == AV_CODEC_ID_PCM_MULAW ||
125  avctx->codec_id == AV_CODEC_ID_PCM_ALAW) {
126  at->pkt_size *= 1024;
127  avctx->frame_size *= 1024;
128  }
129 }
130 
131 static int read_descr(GetByteContext *gb, int *tag)
132 {
133  int len = 0;
134  int count = 4;
135  *tag = bytestream2_get_byte(gb);
136  while (count--) {
137  int c = bytestream2_get_byte(gb);
138  len = (len << 7) | (c & 0x7f);
139  if (!(c & 0x80))
140  break;
141  }
142  return len;
143 }
144 
145 static int get_ilbc_mode(AVCodecContext *avctx)
146 {
147  if (avctx->block_align == 38)
148  return 20;
149  else if (avctx->block_align == 50)
150  return 30;
151  else if (avctx->bit_rate > 0)
152  return avctx->bit_rate <= 14000 ? 30 : 20;
153  else
154  return 30;
155 }
156 
158 {
159  uint64_t map = 1 << channel;
160  if (map <= AV_CH_LOW_FREQUENCY)
161  return channel + 1;
162  else if (map <= AV_CH_BACK_RIGHT)
163  return channel + 29;
164  else if (map <= AV_CH_BACK_CENTER)
165  return channel - 1;
166  else if (map <= AV_CH_SIDE_RIGHT)
167  return channel - 4;
168  else if (map <= AV_CH_TOP_BACK_RIGHT)
169  return channel + 1;
170  else if (map <= AV_CH_STEREO_RIGHT)
171  return -1;
172  else if (map <= AV_CH_WIDE_RIGHT)
173  return channel + 4;
174  else if (map <= AV_CH_SURROUND_DIRECT_RIGHT)
175  return channel - 23;
176  else if (map == AV_CH_LOW_FREQUENCY_2)
177  return kAudioChannelLabel_LFE2;
178  else
179  return -1;
180 }
181 
182 static int remap_layout(AudioChannelLayout *layout, const AVChannelLayout *in_layout)
183 {
184  int i;
185  layout->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions;
186  layout->mNumberChannelDescriptions = in_layout->nb_channels;
187  for (i = 0; i < in_layout->nb_channels; i++) {
188  int c, label;
189 
191  if (c < 0 || c >= 64)
192  return AVERROR(EINVAL);
193  label = get_channel_label(c);
194  layout->mChannelDescriptions[i].mChannelLabel = label;
195  if (label < 0)
196  return AVERROR(EINVAL);
197  c++;
198  }
199  return 0;
200 }
201 
202 static int get_aac_tag(const AVChannelLayout *in_layout)
203 {
204  static const struct {
205  AVChannelLayout chl;
206  int tag;
207  } map[] = {
208  { AV_CHANNEL_LAYOUT_MONO, kAudioChannelLayoutTag_Mono },
209  { AV_CHANNEL_LAYOUT_STEREO, kAudioChannelLayoutTag_Stereo },
210  { AV_CHANNEL_LAYOUT_QUAD, kAudioChannelLayoutTag_AAC_Quadraphonic },
211  { AV_CHANNEL_LAYOUT_OCTAGONAL, kAudioChannelLayoutTag_AAC_Octagonal },
212  { AV_CHANNEL_LAYOUT_SURROUND, kAudioChannelLayoutTag_AAC_3_0 },
213  { AV_CHANNEL_LAYOUT_4POINT0, kAudioChannelLayoutTag_AAC_4_0 },
214  { AV_CHANNEL_LAYOUT_5POINT0, kAudioChannelLayoutTag_AAC_5_0 },
215  { AV_CHANNEL_LAYOUT_5POINT1, kAudioChannelLayoutTag_AAC_5_1 },
216  { AV_CHANNEL_LAYOUT_6POINT0, kAudioChannelLayoutTag_AAC_6_0 },
217  { AV_CHANNEL_LAYOUT_6POINT1, kAudioChannelLayoutTag_AAC_6_1 },
218  { AV_CHANNEL_LAYOUT_7POINT0, kAudioChannelLayoutTag_AAC_7_0 },
219  { AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK, kAudioChannelLayoutTag_AAC_7_1 },
220  { AV_CHANNEL_LAYOUT_7POINT1, kAudioChannelLayoutTag_MPEG_7_1_C },
221  };
222  int i;
223 
224  for (i = 0; i < FF_ARRAY_ELEMS(map); i++)
225  if (!av_channel_layout_compare(in_layout, &map[i].chl))
226  return map[i].tag;
227 
228  return 0;
229 }
230 
232 {
233  ATDecodeContext *at = avctx->priv_data;
234  OSStatus status;
235 
236  AudioStreamBasicDescription in_format = {
237  .mSampleRate = avctx->sample_rate,
238  .mFormatID = kAudioFormatLinearPCM,
239  .mFormatFlags = ((avctx->sample_fmt == AV_SAMPLE_FMT_FLT ||
240  avctx->sample_fmt == AV_SAMPLE_FMT_DBL) ? kAudioFormatFlagIsFloat
241  : avctx->sample_fmt == AV_SAMPLE_FMT_U8 ? 0
242  : kAudioFormatFlagIsSignedInteger)
243  | kAudioFormatFlagIsPacked,
244  .mBytesPerPacket = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels,
245  .mFramesPerPacket = 1,
246  .mBytesPerFrame = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels,
247  .mChannelsPerFrame = avctx->ch_layout.nb_channels,
248  .mBitsPerChannel = av_get_bytes_per_sample(avctx->sample_fmt) * 8,
249  };
250  AudioStreamBasicDescription out_format = {
251  .mSampleRate = avctx->sample_rate,
252  .mFormatID = ffat_get_format_id(avctx->codec_id, avctx->profile),
253  .mChannelsPerFrame = in_format.mChannelsPerFrame,
254  };
255  UInt32 layout_size = sizeof(AudioChannelLayout) +
256  sizeof(AudioChannelDescription) * avctx->ch_layout.nb_channels;
257  AudioChannelLayout *channel_layout = av_malloc(layout_size);
258 
259  if (!channel_layout)
260  return AVERROR(ENOMEM);
261 
262  if (avctx->codec_id == AV_CODEC_ID_ILBC) {
263  int mode = get_ilbc_mode(avctx);
264  out_format.mFramesPerPacket = 8000 * mode / 1000;
265  out_format.mBytesPerPacket = (mode == 20 ? 38 : 50);
266  }
267 
268  status = AudioConverterNew(&in_format, &out_format, &at->converter);
269 
270  if (status != 0) {
271  av_log(avctx, AV_LOG_ERROR, "AudioToolbox init error: %i\n", (int)status);
272  av_free(channel_layout);
273  return AVERROR_UNKNOWN;
274  }
275 
278 
279  if ((status = remap_layout(channel_layout, &avctx->ch_layout)) < 0) {
280  av_log(avctx, AV_LOG_ERROR, "Invalid channel layout\n");
281  av_free(channel_layout);
282  return status;
283  }
284 
285  if (AudioConverterSetProperty(at->converter, kAudioConverterInputChannelLayout,
286  layout_size, channel_layout)) {
287  av_log(avctx, AV_LOG_ERROR, "Unsupported input channel layout\n");
288  av_free(channel_layout);
289  return AVERROR(EINVAL);
290  }
291  if (avctx->codec_id == AV_CODEC_ID_AAC) {
292  int tag = get_aac_tag(&avctx->ch_layout);
293  if (tag) {
294  channel_layout->mChannelLayoutTag = tag;
295  channel_layout->mNumberChannelDescriptions = 0;
296  }
297  }
298  if (AudioConverterSetProperty(at->converter, kAudioConverterOutputChannelLayout,
299  layout_size, channel_layout)) {
300  av_log(avctx, AV_LOG_ERROR, "Unsupported output channel layout\n");
301  av_free(channel_layout);
302  return AVERROR(EINVAL);
303  }
304  av_free(channel_layout);
305 
306  if (avctx->bits_per_raw_sample)
307  AudioConverterSetProperty(at->converter,
308  kAudioConverterPropertyBitDepthHint,
309  sizeof(avctx->bits_per_raw_sample),
310  &avctx->bits_per_raw_sample);
311 
312 #if !TARGET_OS_IPHONE
313  if (at->mode == -1)
314  at->mode = (avctx->flags & AV_CODEC_FLAG_QSCALE) ?
315  kAudioCodecBitRateControlMode_Variable :
316  kAudioCodecBitRateControlMode_Constant;
317 
318  AudioConverterSetProperty(at->converter, kAudioCodecPropertyBitRateControlMode,
319  sizeof(at->mode), &at->mode);
320 
321  if (at->mode == kAudioCodecBitRateControlMode_Variable) {
322  int q = avctx->global_quality / FF_QP2LAMBDA;
323  if (q < 0 || q > 14) {
324  av_log(avctx, AV_LOG_WARNING,
325  "VBR quality %d out of range, should be 0-14\n", q);
326  q = av_clip(q, 0, 14);
327  }
328  q = 127 - q * 9;
329  AudioConverterSetProperty(at->converter, kAudioCodecPropertySoundQualityForVBR,
330  sizeof(q), &q);
331  } else
332 #endif
333  if (avctx->bit_rate > 0) {
334  UInt32 rate = avctx->bit_rate;
335  UInt32 size;
336  status = AudioConverterGetPropertyInfo(at->converter,
337  kAudioConverterApplicableEncodeBitRates,
338  &size, NULL);
339  if (!status && size) {
340  UInt32 new_rate = rate;
341  int count;
342  int i;
343  AudioValueRange *ranges = av_malloc(size);
344  if (!ranges)
345  return AVERROR(ENOMEM);
346  AudioConverterGetProperty(at->converter,
347  kAudioConverterApplicableEncodeBitRates,
348  &size, ranges);
349  count = size / sizeof(AudioValueRange);
350  for (i = 0; i < count; i++) {
351  AudioValueRange *range = &ranges[i];
352  if (rate >= range->mMinimum && rate <= range->mMaximum) {
353  new_rate = rate;
354  break;
355  } else if (rate > range->mMaximum) {
356  new_rate = range->mMaximum;
357  } else {
358  new_rate = range->mMinimum;
359  break;
360  }
361  }
362  if (new_rate != rate) {
363  av_log(avctx, AV_LOG_WARNING,
364  "Bitrate %u not allowed; changing to %u\n", rate, new_rate);
365  rate = new_rate;
366  }
367  av_free(ranges);
368  }
369  AudioConverterSetProperty(at->converter, kAudioConverterEncodeBitRate,
370  sizeof(rate), &rate);
371  }
372 
373  at->quality = 96 - at->quality * 32;
374  AudioConverterSetProperty(at->converter, kAudioConverterCodecQuality,
375  sizeof(at->quality), &at->quality);
376 
377  if (!AudioConverterGetPropertyInfo(at->converter, kAudioConverterCompressionMagicCookie,
378  &avctx->extradata_size, NULL) &&
379  avctx->extradata_size) {
380  int extradata_size = avctx->extradata_size;
381  uint8_t *extradata;
383  return AVERROR(ENOMEM);
384  if (avctx->codec_id == AV_CODEC_ID_ALAC) {
385  avctx->extradata_size = 0x24;
386  AV_WB32(avctx->extradata, 0x24);
387  AV_WB32(avctx->extradata + 4, MKBETAG('a','l','a','c'));
388  extradata = avctx->extradata + 12;
389  avctx->extradata_size = 0x24;
390  } else {
391  extradata = avctx->extradata;
392  }
393  status = AudioConverterGetProperty(at->converter,
394  kAudioConverterCompressionMagicCookie,
395  &extradata_size, extradata);
396  if (status != 0) {
397  av_log(avctx, AV_LOG_ERROR, "AudioToolbox cookie error: %i\n", (int)status);
398  return AVERROR_UNKNOWN;
399  } else if (avctx->codec_id == AV_CODEC_ID_AAC) {
400  GetByteContext gb;
401  int tag, len;
402  bytestream2_init(&gb, extradata, extradata_size);
403  do {
404  len = read_descr(&gb, &tag);
405  if (tag == MP4DecConfigDescrTag) {
406  bytestream2_skip(&gb, 13);
407  len = read_descr(&gb, &tag);
408  if (tag == MP4DecSpecificDescrTag) {
409  len = FFMIN(gb.buffer_end - gb.buffer, len);
410  memmove(extradata, gb.buffer, len);
411  avctx->extradata_size = len;
412  break;
413  }
414  } else if (tag == MP4ESDescrTag) {
415  int flags;
416  bytestream2_skip(&gb, 2);
417  flags = bytestream2_get_byte(&gb);
418  if (flags & 0x80) //streamDependenceFlag
419  bytestream2_skip(&gb, 2);
420  if (flags & 0x40) //URL_Flag
421  bytestream2_skip(&gb, bytestream2_get_byte(&gb));
422  if (flags & 0x20) //OCRstreamFlag
423  bytestream2_skip(&gb, 2);
424  }
425  } while (bytestream2_get_bytes_left(&gb));
426  } else if (avctx->codec_id != AV_CODEC_ID_ALAC) {
427  avctx->extradata_size = extradata_size;
428  }
429  }
430 
431  ffat_update_ctx(avctx);
432 
433 #if !TARGET_OS_IPHONE && defined(__MAC_10_9)
434  if (at->mode == kAudioCodecBitRateControlMode_Variable && avctx->rc_max_rate) {
435  UInt32 max_size = avctx->rc_max_rate * avctx->frame_size / avctx->sample_rate;
436  if (max_size)
437  AudioConverterSetProperty(at->converter, kAudioCodecPropertyPacketSizeLimitForVBR,
438  sizeof(max_size), &max_size);
439  }
440 #endif
441 
442  ff_af_queue_init(avctx, &at->afq);
443 
445  if (!at->encoding_frame)
446  return AVERROR(ENOMEM);
447 
448  return 0;
449 }
450 
451 static OSStatus ffat_encode_callback(AudioConverterRef converter, UInt32 *nb_packets,
452  AudioBufferList *data,
453  AudioStreamPacketDescription **packets,
454  void *inctx)
455 {
456  AVCodecContext *avctx = inctx;
457  ATDecodeContext *at = avctx->priv_data;
458  AVFrame *frame;
459  int ret;
460 
461  if (!at->frame_queue.available) {
462  if (at->eof) {
463  *nb_packets = 0;
464  return 0;
465  } else {
466  *nb_packets = 0;
467  return 1;
468  }
469  }
470 
472 
473  data->mNumberBuffers = 1;
474  data->mBuffers[0].mNumberChannels = avctx->ch_layout.nb_channels;
475  data->mBuffers[0].mDataByteSize = frame->nb_samples *
477  avctx->ch_layout.nb_channels;
478  data->mBuffers[0].mData = frame->data[0];
479  if (*nb_packets > frame->nb_samples)
480  *nb_packets = frame->nb_samples;
481 
484  if (ret < 0) {
485  *nb_packets = 0;
486  return ret;
487  }
488 
489  ff_bufqueue_add(avctx, &at->used_frame_queue, frame);
490 
491  return 0;
492 }
493 
494 static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt,
495  const AVFrame *frame, int *got_packet_ptr)
496 {
497  ATDecodeContext *at = avctx->priv_data;
498  OSStatus ret;
499 
500  AudioBufferList out_buffers = {
501  .mNumberBuffers = 1,
502  .mBuffers = {
503  {
504  .mNumberChannels = avctx->ch_layout.nb_channels,
505  .mDataByteSize = at->pkt_size,
506  }
507  }
508  };
509  AudioStreamPacketDescription out_pkt_desc = {0};
510 
511  if (frame) {
512  AVFrame *in_frame;
513 
514  if (ff_bufqueue_is_full(&at->frame_queue)) {
515  /*
516  * The frame queue is significantly larger than needed in practice,
517  * but no clear way to determine the minimum number of samples to
518  * get output from AudioConverterFillComplexBuffer().
519  */
520  av_log(avctx, AV_LOG_ERROR, "Bug: frame queue is too small.\n");
521  return AVERROR_BUG;
522  }
523 
524  if ((ret = ff_af_queue_add(&at->afq, frame)) < 0)
525  return ret;
526 
527  in_frame = av_frame_clone(frame);
528  if (!in_frame)
529  return AVERROR(ENOMEM);
530 
531  ff_bufqueue_add(avctx, &at->frame_queue, in_frame);
532  } else {
533  at->eof = 1;
534  }
535 
536  if ((ret = ff_alloc_packet(avctx, avpkt, at->pkt_size)) < 0)
537  return ret;
538 
539 
540  out_buffers.mBuffers[0].mData = avpkt->data;
541 
542  *got_packet_ptr = avctx->frame_size / at->frame_size;
543 
544  ret = AudioConverterFillComplexBuffer(at->converter, ffat_encode_callback, avctx,
545  got_packet_ptr, &out_buffers,
546  (avctx->frame_size > at->frame_size) ? NULL : &out_pkt_desc);
547 
549 
550  if ((!ret || ret == 1) && *got_packet_ptr) {
551  avpkt->size = out_buffers.mBuffers[0].mDataByteSize;
552  ff_af_queue_remove(&at->afq, out_pkt_desc.mVariableFramesInPacket ?
553  out_pkt_desc.mVariableFramesInPacket :
554  avctx->frame_size,
555  &avpkt->pts,
556  &avpkt->duration);
557  } else if (ret && ret != 1) {
558  av_log(avctx, AV_LOG_WARNING, "Encode error: %i\n", ret);
559  }
560 
561  return 0;
562 }
563 
565 {
566  ATDecodeContext *at = avctx->priv_data;
567  AudioConverterReset(at->converter);
570 }
571 
573 {
574  ATDecodeContext *at = avctx->priv_data;
575  AudioConverterDispose(at->converter);
578  ff_af_queue_close(&at->afq);
580  return 0;
581 }
582 
583 static const AVProfile aac_profiles[] = {
584  { FF_PROFILE_AAC_LOW, "LC" },
585  { FF_PROFILE_AAC_HE, "HE-AAC" },
586  { FF_PROFILE_AAC_HE_V2, "HE-AACv2" },
587  { FF_PROFILE_AAC_LD, "LD" },
588  { FF_PROFILE_AAC_ELD, "ELD" },
589  { FF_PROFILE_UNKNOWN },
590 };
591 
592 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
593 static const AVOption options[] = {
594 #if !TARGET_OS_IPHONE
595  {"aac_at_mode", "ratecontrol mode", offsetof(ATDecodeContext, mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, kAudioCodecBitRateControlMode_Variable, AE, "mode"},
596  {"auto", "VBR if global quality is given; CBR otherwise", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, AE, "mode"},
597  {"cbr", "constant bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Constant}, INT_MIN, INT_MAX, AE, "mode"},
598  {"abr", "long-term average bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_LongTermAverage}, INT_MIN, INT_MAX, AE, "mode"},
599  {"cvbr", "constrained variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_VariableConstrained}, INT_MIN, INT_MAX, AE, "mode"},
600  {"vbr" , "variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Variable}, INT_MIN, INT_MAX, AE, "mode"},
601 #endif
602  {"aac_at_quality", "quality vs speed control", offsetof(ATDecodeContext, quality), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 2, AE},
603  { NULL },
604 };
605 
606 #define FFAT_ENC_CLASS(NAME) \
607  static const AVClass ffat_##NAME##_enc_class = { \
608  .class_name = "at_" #NAME "_enc", \
609  .item_name = av_default_item_name, \
610  .option = options, \
611  .version = LIBAVUTIL_VERSION_INT, \
612  };
613 
614 #define FFAT_ENC(NAME, ID, PROFILES, CAPS, CHANNEL_LAYOUTS, CH_LAYOUTS) \
615  FFAT_ENC_CLASS(NAME) \
616  const FFCodec ff_##NAME##_at_encoder = { \
617  .p.name = #NAME "_at", \
618  .p.long_name = NULL_IF_CONFIG_SMALL(#NAME " (AudioToolbox)"), \
619  .p.type = AVMEDIA_TYPE_AUDIO, \
620  .p.id = ID, \
621  .priv_data_size = sizeof(ATDecodeContext), \
622  .init = ffat_init_encoder, \
623  .close = ffat_close_encoder, \
624  FF_CODEC_ENCODE_CB(ffat_encode), \
625  .flush = ffat_encode_flush, \
626  .p.priv_class = &ffat_##NAME##_enc_class, \
627  .p.capabilities = AV_CODEC_CAP_DELAY | \
628  AV_CODEC_CAP_ENCODER_FLUSH CAPS, \
629  .p.channel_layouts = CHANNEL_LAYOUTS, \
630  .p.ch_layouts = CH_LAYOUTS, \
631  .p.sample_fmts = (const enum AVSampleFormat[]) { \
632  AV_SAMPLE_FMT_S16, \
633  AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_NONE \
634  }, \
635  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, \
636  .p.profiles = PROFILES, \
637  .p.wrapper_name = "at", \
638  };
639 
653  { 0 },
654 };
655 
656 #if FF_API_OLD_CHANNEL_LAYOUT
657 static const uint64_t aac_at_channel_layouts[] = {
670  0,
671 };
672 #endif
673 
674 FFAT_ENC(aac, AV_CODEC_ID_AAC, aac_profiles, , aac_at_channel_layouts, aac_at_ch_layouts)
675 //FFAT_ENC(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT, NULL)
AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_7POINT0
Definition: channel_layout.h:224
read_descr
static int read_descr(GetByteContext *gb, int *tag)
Definition: audiotoolboxenc.c:131
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1026
AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT1
Definition: channel_layout.h:221
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_CH_LAYOUT_7POINT1_WIDE_BACK
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK
Definition: channel_layout.h:228
AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: codec_id.h:355
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
MP4DecConfigDescrTag
#define MP4DecConfigDescrTag
Definition: isom.h:330
FFAT_ENC
#define FFAT_ENC(NAME, ID, PROFILES, CAPS, CHANNEL_LAYOUTS, CH_LAYOUTS)
Definition: audiotoolboxenc.c:614
av_clip
#define av_clip
Definition: common.h:95
get_channel_label
static av_cold int get_channel_label(int channel)
Definition: audiotoolboxenc.c:157
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
ff_af_queue_remove
void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, int64_t *duration)
Remove frame(s) from the queue.
Definition: audio_frame_queue.c:75
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:998
GetByteContext
Definition: bytestream.h:33
AV_CH_LOW_FREQUENCY_2
#define AV_CH_LOW_FREQUENCY_2
Definition: channel_layout.h:182
ff_af_queue_close
void ff_af_queue_close(AudioFrameQueue *afq)
Close AudioFrameQueue.
Definition: audio_frame_queue.c:36
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:364
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:204
AV_CODEC_FLAG_QSCALE
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
Definition: avcodec.h:216
ff_af_queue_init
av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
Initialize AudioFrameQueue.
Definition: audio_frame_queue.c:28
AV_CHANNEL_LAYOUT_6POINT1
#define AV_CHANNEL_LAYOUT_6POINT1
Definition: channel_layout.h:370
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:111
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:374
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:359
AVOption
AVOption.
Definition: opt.h:251
encode.h
data
const char data[16]
Definition: mxf.c:143
AV_CODEC_ID_ALAC
@ AV_CODEC_ID_ALAC
Definition: codec_id.h:441
ffat_init_encoder
static av_cold int ffat_init_encoder(AVCodecContext *avctx)
Definition: audiotoolboxenc.c:231
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:353
get_ilbc_mode
static int get_ilbc_mode(AVCodecContext *avctx)
Definition: audiotoolboxenc.c:145
aac_profiles
static const AVProfile aac_profiles[]
Definition: audiotoolboxenc.c:583
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:354
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:295
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
ffat_get_format_id
static UInt32 ffat_get_format_id(enum AVCodecID codec, int profile)
Definition: audiotoolboxenc.c:58
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
AV_CHANNEL_LAYOUT_6POINT0
#define AV_CHANNEL_LAYOUT_6POINT0
Definition: channel_layout.h:367
quality
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
Definition: rate_distortion.txt:12
ff_bufqueue_get
static AVFrame * ff_bufqueue_get(struct FFBufQueue *queue)
Get the first buffer from the queue and remove it.
Definition: bufferqueue.h:98
AV_CH_SURROUND_DIRECT_RIGHT
#define AV_CH_SURROUND_DIRECT_RIGHT
Definition: channel_layout.h:181
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
AV_CH_WIDE_RIGHT
#define AV_CH_WIDE_RIGHT
Definition: channel_layout.h:179
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:363
AVProfile
AVProfile.
Definition: codec.h:188
AV_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_6POINT0
Definition: channel_layout.h:218
AV_CHANNEL_LAYOUT_7POINT0
#define AV_CHANNEL_LAYOUT_7POINT0
Definition: channel_layout.h:373
bytestream2_skip
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:168
ATDecodeContext::used_frame_queue
struct FFBufQueue used_frame_queue
Definition: audiotoolboxenc.c:48
ATDecodeContext::frame_size
int frame_size
Definition: audiotoolboxenc.c:53
ffat_close_encoder
static av_cold int ffat_close_encoder(AVCodecContext *avctx)
Definition: audiotoolboxenc.c:572
ATDecodeContext::eof
int eof
Definition: audiotoolboxdec.c:56
MP4DecSpecificDescrTag
#define MP4DecSpecificDescrTag
Definition: isom.h:331
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:2057
AE
#define AE
Definition: audiotoolboxenc.c:592
remap_layout
static int remap_layout(AudioChannelLayout *layout, const AVChannelLayout *in_layout)
Definition: audiotoolboxenc.c:182
audio_frame_queue.h
AVCodecContext::initial_padding
int initial_padding
Audio only.
Definition: avcodec.h:1724
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:357
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:469
ffat_encode_callback
static OSStatus ffat_encode_callback(AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx)
Definition: audiotoolboxenc.c:451
ff_af_queue_add
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f)
Add a frame to the queue.
Definition: audio_frame_queue.c:44
ATDecodeContext::mode
int mode
Definition: audiotoolboxenc.c:43
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:205
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:213
ff_bufqueue_is_full
static int ff_bufqueue_is_full(struct FFBufQueue *queue)
Test if a buffer queue is full.
Definition: bufferqueue.h:60
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:99
options
static const AVOption options[]
Definition: audiotoolboxenc.c:593
avassert.h
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
FF_PROFILE_AAC_HE_V2
#define FF_PROFILE_AAC_HE_V2
Definition: avcodec.h:1557
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:161
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:491
AVCodecContext::global_quality
int global_quality
Global quality for codecs which cannot change it per frame.
Definition: avcodec.h:455
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:106
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1549
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
AudioFrameQueue
Definition: audio_frame_queue.h:32
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1448
ATDecodeContext::encoding_frame
AVFrame * encoding_frame
Definition: audiotoolboxenc.c:55
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:464
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:322
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1214
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:399
AV_CH_STEREO_RIGHT
#define AV_CH_STEREO_RIGHT
Definition: channel_layout.h:177
MP4ESDescrTag
#define MP4ESDescrTag
Definition: isom.h:329
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:323
ATDecodeContext::quality
int quality
Definition: audiotoolboxenc.c:44
get_aac_tag
static int get_aac_tag(const AVChannelLayout *in_layout)
Definition: audiotoolboxenc.c:202
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
isom.h
ffat_update_ctx
static void ffat_update_ctx(AVCodecContext *avctx)
Definition: audiotoolboxenc.c:91
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:439
FF_PROFILE_AAC_LD
#define FF_PROFILE_AAC_LD
Definition: avcodec.h:1558
ff_bufqueue_discard_all
static void ff_bufqueue_discard_all(struct FFBufQueue *queue)
Unref and remove all buffers from the queue.
Definition: bufferqueue.h:111
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:930
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:215
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:960
AV_CODEC_CAP_VARIABLE_FRAME_SIZE
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE
Audio encoder supports receiving a different number of samples in each call.
Definition: codec.h:134
AV_CHANNEL_LAYOUT_7POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
Definition: channel_layout.h:375
FF_PROFILE_AAC_ELD
#define FF_PROFILE_AAC_ELD
Definition: avcodec.h:1559
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:47
AV_WB32
#define AV_WB32(p, v)
Definition: intreadwrite.h:419
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:427
bufferqueue.h
AVPacket::size
int size
Definition: packet.h:375
av_frame_ref
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:343
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:290
codec_internal.h
FF_PROFILE_AAC_LOW
#define FF_PROFILE_AAC_LOW
Definition: avcodec.h:1553
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1014
size
int size
Definition: twinvq_data.h:10344
MKBETAG
#define MKBETAG(a, b, c, d)
Definition: macros.h:56
AV_CHANNEL_LAYOUT_OCTAGONAL
#define AV_CHANNEL_LAYOUT_OCTAGONAL
Definition: channel_layout.h:378
ff_bufqueue_add
static void ff_bufqueue_add(void *log, struct FFBufQueue *queue, AVFrame *buf)
Add a buffer to the queue.
Definition: bufferqueue.h:71
AV_CH_TOP_BACK_RIGHT
#define AV_CH_TOP_BACK_RIGHT
Definition: channel_layout.h:175
layout
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 layout
Definition: filter_design.txt:18
AV_CH_LAYOUT_OCTAGONAL
#define AV_CH_LAYOUT_OCTAGONAL
Definition: channel_layout.h:229
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:214
AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK
Definition: channel_layout.h:377
log.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
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:490
FFBufQueue
Structure holding the queue.
Definition: bufferqueue.h:49
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
FFBufQueue::available
unsigned short available
number of available buffers
Definition: bufferqueue.h:52
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:166
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:477
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:264
AV_CH_SIDE_RIGHT
#define AV_CH_SIDE_RIGHT
Definition: channel_layout.h:168
len
int len
Definition: vorbis_enc_data.h:426
profile
int profile
Definition: mxfenc.c:2005
GetByteContext::buffer_end
const uint8_t * buffer_end
Definition: bytestream.h:34
av_channel_layout_channel_from_index
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
Definition: channel_layout.c:794
avcodec.h
FF_PROFILE_AAC_HE
#define FF_PROFILE_AAC_HE
Definition: avcodec.h:1556
tag
uint32_t tag
Definition: movenc.c:1630
ret
ret
Definition: filter_design.txt:187
AVCodecContext::block_align
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition: avcodec.h:1043
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
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:208
ffat_encode_flush
static av_cold void ffat_encode_flush(AVCodecContext *avctx)
Definition: audiotoolboxenc.c:564
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
ATDecodeContext::converter
AudioConverterRef converter
Definition: audiotoolboxdec.c:45
AVCodecContext
main external API structure.
Definition: avcodec.h:389
channel_layout.h
ffat_encode
static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: audiotoolboxenc.c:494
mode
mode
Definition: ebur128.h:83
ATDecodeContext
Definition: audiotoolboxdec.c:42
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1548
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:351
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:416
aac_at_ch_layouts
static const AVChannelLayout aac_at_ch_layouts[]
Definition: audiotoolboxenc.c:640
ATDecodeContext::pkt_size
unsigned pkt_size
Definition: audiotoolboxenc.c:50
AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_4POINT0
Definition: channel_layout.h:210
AV_CODEC_ID_ILBC
@ AV_CODEC_ID_ILBC
Definition: codec_id.h:484
bytestream.h
ATDecodeContext::av_class
AVClass * av_class
Definition: audiotoolboxdec.c:43
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
ATDecodeContext::afq
AudioFrameQueue afq
Definition: audiotoolboxenc.c:51
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:163
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
FF_QP2LAMBDA
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
Definition: avutil.h:227
AV_CHANNEL_LAYOUT_QUAD
#define AV_CHANNEL_LAYOUT_QUAD
Definition: channel_layout.h:362
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
ff_alloc_packet
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
Definition: encode.c:35
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
channel
channel
Definition: ebur128.h:39
ATDecodeContext::frame_queue
struct FFBufQueue frame_queue
Definition: audiotoolboxenc.c:47