FFmpeg
audiotoolbox.m
Go to the documentation of this file.
1 /*
2  * AudioToolbox output device
3  * Copyright (c) 2020 Thilo Borgmann <thilo.borgmann@mail.de>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * AudioToolbox output device
25  * @author Thilo Borgmann <thilo.borgmann@mail.de>
26  */
27 
28 #import <AudioToolbox/AudioToolbox.h>
29 #include <pthread.h>
30 
31 #include "libavutil/opt.h"
32 #include "libavformat/internal.h"
33 #include "libavformat/mux.h"
34 #include "libavutil/internal.h"
35 #include "avdevice.h"
36 
37 typedef struct
38 {
39  AVClass *class;
40 
41  AudioQueueBufferRef buffer[2];
42  pthread_mutex_t buffer_lock[2];
43  int cur_buf;
44  AudioQueueRef queue;
45 
48 
49 } ATContext;
50 
51 static int check_status(AVFormatContext *avctx, OSStatus *status, const char *msg)
52 {
53  if (*status != noErr) {
54  av_log(avctx, AV_LOG_ERROR, "Error: %s (%i)\n", msg, *status);
55  return 1;
56  } else {
57  av_log(avctx, AV_LOG_DEBUG, " OK : %s\n", msg);
58  return 0;
59  }
60 }
61 
62 static void queue_callback(void* atctx, AudioQueueRef inAQ,
63  AudioQueueBufferRef inBuffer)
64 {
65  // unlock the buffer that has just been consumed
66  ATContext *ctx = (ATContext*)atctx;
67  for (int i = 0; i < 2; i++) {
68  if (inBuffer == ctx->buffer[i]) {
69  pthread_mutex_unlock(&ctx->buffer_lock[i]);
70  }
71  }
72 }
73 
75 {
76  ATContext *ctx = (ATContext*)avctx->priv_data;
77  OSStatus err = noErr;
78  CFStringRef device_UID = NULL;
79  AudioDeviceID *devices;
80  int num_devices;
81 
82 
83  // get devices
84  UInt32 data_size = 0;
85  AudioObjectPropertyAddress prop;
86  prop.mSelector = kAudioHardwarePropertyDevices;
87  prop.mScope = kAudioObjectPropertyScopeGlobal;
88 #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
89  prop.mElement = kAudioObjectPropertyElementMain;
90 #else
91  prop.mElement = kAudioObjectPropertyElementMaster;
92 #endif
93  err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &prop, 0, NULL, &data_size);
94  if (check_status(avctx, &err, "AudioObjectGetPropertyDataSize devices"))
95  return AVERROR(EINVAL);
96 
97  num_devices = data_size / sizeof(AudioDeviceID);
98 
99  devices = (AudioDeviceID*)(av_malloc(data_size));
100  err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &data_size, devices);
101  if (check_status(avctx, &err, "AudioObjectGetPropertyData devices")) {
102  av_freep(&devices);
103  return AVERROR(EINVAL);
104  }
105 
106  // list devices
107  if (ctx->list_devices) {
108  CFStringRef device_name = NULL;
109  prop.mScope = kAudioDevicePropertyScopeInput;
110 
111  av_log(ctx, AV_LOG_INFO, "CoreAudio devices:\n");
112  for(UInt32 i = 0; i < num_devices; ++i) {
113  // UID
114  data_size = sizeof(device_UID);
115  prop.mSelector = kAudioDevicePropertyDeviceUID;
116  err = AudioObjectGetPropertyData(devices[i], &prop, 0, NULL, &data_size, &device_UID);
117  if (check_status(avctx, &err, "AudioObjectGetPropertyData UID"))
118  continue;
119 
120  // name
121  data_size = sizeof(device_name);
122  prop.mSelector = kAudioDevicePropertyDeviceNameCFString;
123  err = AudioObjectGetPropertyData(devices[i], &prop, 0, NULL, &data_size, &device_name);
124  if (check_status(avctx, &err, "AudioObjecTGetPropertyData name"))
125  continue;
126 
127  av_log(ctx, AV_LOG_INFO, "[%d] %30s, %s\n", i,
128  CFStringGetCStringPtr(device_name, kCFStringEncodingMacRoman),
129  CFStringGetCStringPtr(device_UID, kCFStringEncodingMacRoman));
130  }
131  }
132 
133  // get user-defined device UID or use default device
134  // -audio_device_index overrides any URL given
135  const char *stream_name = avctx->url;
136  if (stream_name && ctx->audio_device_index == -1) {
137  sscanf(stream_name, "%d", &ctx->audio_device_index);
138  }
139 
140  if (ctx->audio_device_index >= 0) {
141  // get UID of selected device
142  data_size = sizeof(device_UID);
143  prop.mSelector = kAudioDevicePropertyDeviceUID;
144  err = AudioObjectGetPropertyData(devices[ctx->audio_device_index], &prop, 0, NULL, &data_size, &device_UID);
145  if (check_status(avctx, &err, "AudioObjecTGetPropertyData UID")) {
146  av_freep(&devices);
147  return AVERROR(EINVAL);
148  }
149  } else {
150  // use default device
151  device_UID = NULL;
152  }
153 
154  av_log(ctx, AV_LOG_DEBUG, "stream_name: %s\n", stream_name);
155  av_log(ctx, AV_LOG_DEBUG, "audio_device_idnex: %i\n", ctx->audio_device_index);
156  av_log(ctx, AV_LOG_DEBUG, "UID: %s\n", CFStringGetCStringPtr(device_UID, kCFStringEncodingMacRoman));
157 
158  // check input stream
159  if (avctx->nb_streams != 1 || avctx->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) {
160  av_log(ctx, AV_LOG_ERROR, "Only a single audio stream is supported.\n");
161  return AVERROR(EINVAL);
162  }
163 
164  av_freep(&devices);
165  AVCodecParameters *codecpar = avctx->streams[0]->codecpar;
166 
167  // audio format
168  AudioStreamBasicDescription device_format = {0};
169  device_format.mSampleRate = codecpar->sample_rate;
170  device_format.mFormatID = kAudioFormatLinearPCM;
171  device_format.mFormatFlags |= (codecpar->format == AV_SAMPLE_FMT_FLT) ? kLinearPCMFormatFlagIsFloat : 0;
172  device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S8) ? kLinearPCMFormatFlagIsSignedInteger : 0;
173  device_format.mFormatFlags |= (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)) ? kLinearPCMFormatFlagIsSignedInteger : 0;
174  device_format.mFormatFlags |= (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S24BE, AV_CODEC_ID_PCM_S24LE)) ? kLinearPCMFormatFlagIsSignedInteger : 0;
175  device_format.mFormatFlags |= (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S32BE, AV_CODEC_ID_PCM_S32LE)) ? kLinearPCMFormatFlagIsSignedInteger : 0;
176  device_format.mFormatFlags |= (av_sample_fmt_is_planar(codecpar->format)) ? kAudioFormatFlagIsNonInterleaved : 0;
177  device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_F32BE) ? kAudioFormatFlagIsBigEndian : 0;
178  device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) ? kAudioFormatFlagIsBigEndian : 0;
179  device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S24BE) ? kAudioFormatFlagIsBigEndian : 0;
180  device_format.mFormatFlags |= (codecpar->codec_id == AV_CODEC_ID_PCM_S32BE) ? kAudioFormatFlagIsBigEndian : 0;
181  device_format.mChannelsPerFrame = codecpar->ch_layout.nb_channels;
182  device_format.mBitsPerChannel = (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S24BE, AV_CODEC_ID_PCM_S24LE)) ? 24 : (av_get_bytes_per_sample(codecpar->format) << 3);
183  device_format.mBytesPerFrame = (device_format.mBitsPerChannel >> 3) * device_format.mChannelsPerFrame;
184  device_format.mFramesPerPacket = 1;
185  device_format.mBytesPerPacket = device_format.mBytesPerFrame * device_format.mFramesPerPacket;
186  device_format.mReserved = 0;
187 
188  av_log(ctx, AV_LOG_DEBUG, "device_format.mSampleRate = %i\n", codecpar->sample_rate);
189  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatID = %s\n", "kAudioFormatLinearPCM");
190  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->format == AV_SAMPLE_FMT_FLT) ? "kLinearPCMFormatFlagIsFloat" : "0");
191  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_CODEC_ID_PCM_S8) ? "kLinearPCMFormatFlagIsSignedInteger" : "0");
192  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S32BE, AV_CODEC_ID_PCM_S32LE)) ? "kLinearPCMFormatFlagIsSignedInteger" : "0");
193  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE)) ? "kLinearPCMFormatFlagIsSignedInteger" : "0");
194  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_NE(AV_CODEC_ID_PCM_S24BE, AV_CODEC_ID_PCM_S24LE)) ? "kLinearPCMFormatFlagIsSignedInteger" : "0");
195  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (av_sample_fmt_is_planar(codecpar->format)) ? "kAudioFormatFlagIsNonInterleaved" : "0");
196  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_CODEC_ID_PCM_F32BE) ? "kAudioFormatFlagIsBigEndian" : "0");
197  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) ? "kAudioFormatFlagIsBigEndian" : "0");
198  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_CODEC_ID_PCM_S24BE) ? "kAudioFormatFlagIsBigEndian" : "0");
199  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags |= %s\n", (codecpar->codec_id == AV_CODEC_ID_PCM_S32BE) ? "kAudioFormatFlagIsBigEndian" : "0");
200  av_log(ctx, AV_LOG_DEBUG, "device_format.mFormatFlags == %i\n", device_format.mFormatFlags);
201  av_log(ctx, AV_LOG_DEBUG, "device_format.mChannelsPerFrame = %i\n", codecpar->ch_layout.nb_channels);
202  av_log(ctx, AV_LOG_DEBUG, "device_format.mBitsPerChannel = %i\n", av_get_bytes_per_sample(codecpar->format) << 3);
203  av_log(ctx, AV_LOG_DEBUG, "device_format.mBytesPerFrame = %i\n", (device_format.mBitsPerChannel >> 3) * codecpar->ch_layout.nb_channels);
204  av_log(ctx, AV_LOG_DEBUG, "device_format.mBytesPerPacket = %i\n", device_format.mBytesPerFrame);
205  av_log(ctx, AV_LOG_DEBUG, "device_format.mFramesPerPacket = %i\n", 1);
206  av_log(ctx, AV_LOG_DEBUG, "device_format.mReserved = %i\n", 0);
207 
208  // create new output queue for the device
209  err = AudioQueueNewOutput(&device_format, queue_callback, ctx,
210  NULL, kCFRunLoopCommonModes,
211  0, &ctx->queue);
212  if (check_status(avctx, &err, "AudioQueueNewOutput")) {
213  if (err == kAudioFormatUnsupportedDataFormatError)
214  av_log(ctx, AV_LOG_ERROR, "Unsupported output format.\n");
215  return AVERROR(EINVAL);
216  }
217 
218  // set user-defined device or leave untouched for default
219  if (device_UID != NULL) {
220  err = AudioQueueSetProperty(ctx->queue, kAudioQueueProperty_CurrentDevice, &device_UID, sizeof(device_UID));
221  if (check_status(avctx, &err, "AudioQueueSetProperty output UID"))
222  return AVERROR(EINVAL);
223  }
224 
225  // start the queue
226  err = AudioQueueStart(ctx->queue, NULL);
227  if (check_status(avctx, &err, "AudioQueueStart"))
228  return AVERROR(EINVAL);
229 
230  // init the mutexes for double-buffering
231  pthread_mutex_init(&ctx->buffer_lock[0], NULL);
232  pthread_mutex_init(&ctx->buffer_lock[1], NULL);
233 
234  return 0;
235 }
236 
238 {
239  ATContext *ctx = (ATContext*)avctx->priv_data;
240  OSStatus err = noErr;
241 
242  // use the other buffer
243  ctx->cur_buf = !ctx->cur_buf;
244 
245  // lock for writing or wait for the buffer to be available
246  // will be unlocked by queue callback
247  pthread_mutex_lock(&ctx->buffer_lock[ctx->cur_buf]);
248 
249  // (re-)allocate the buffer if not existant or of different size
250  if (!ctx->buffer[ctx->cur_buf] || ctx->buffer[ctx->cur_buf]->mAudioDataBytesCapacity != pkt->size) {
251  err = AudioQueueAllocateBuffer(ctx->queue, pkt->size, &ctx->buffer[ctx->cur_buf]);
252  if (check_status(avctx, &err, "AudioQueueAllocateBuffer")) {
253  pthread_mutex_unlock(&ctx->buffer_lock[ctx->cur_buf]);
254  return AVERROR(ENOMEM);
255  }
256  }
257 
258  AudioQueueBufferRef buf = ctx->buffer[ctx->cur_buf];
259 
260  // copy audio data into buffer and enqueue the buffer
261  memcpy(buf->mAudioData, pkt->data, buf->mAudioDataBytesCapacity);
262  buf->mAudioDataByteSize = buf->mAudioDataBytesCapacity;
263  err = AudioQueueEnqueueBuffer(ctx->queue, buf, 0, NULL);
264  if (check_status(avctx, &err, "AudioQueueEnqueueBuffer")) {
265  pthread_mutex_unlock(&ctx->buffer_lock[ctx->cur_buf]);
266  return AVERROR(EINVAL);
267  }
268 
269  return 0;
270 }
271 
273 {
274  ATContext *ctx = (ATContext*)avctx->priv_data;
275  OSStatus err = noErr;
276 
277  pthread_mutex_destroy(&ctx->buffer_lock[0]);
278  pthread_mutex_destroy(&ctx->buffer_lock[1]);
279 
280  err = AudioQueueFlush(ctx->queue);
281  check_status(avctx, &err, "AudioQueueFlush");
282  err = AudioQueueDispose(ctx->queue, true);
283  check_status(avctx, &err, "AudioQueueDispose");
284 
285  return 0;
286 }
287 
288 static const AVOption options[] = {
289  { "list_devices", "list available audio devices", offsetof(ATContext, list_devices), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
290  { "audio_device_index", "select audio device by index (starts at 0)", offsetof(ATContext, audio_device_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
291  { NULL },
292 };
293 
294 static const AVClass at_class = {
295  .class_name = "AudioToolbox",
296  .item_name = av_default_item_name,
297  .option = options,
298  .version = LIBAVUTIL_VERSION_INT,
300 };
301 
303  .p.name = "audiotoolbox",
304  .p.long_name = NULL_IF_CONFIG_SMALL("AudioToolbox output device"),
305  .priv_data_size = sizeof(ATContext),
307  .p.video_codec = AV_CODEC_ID_NONE,
308  .write_header = at_write_header,
309  .write_packet = at_write_packet,
310  .write_trailer = at_write_trailer,
311  .p.flags = AVFMT_NOFILE,
312  .p.priv_class = &at_class,
313 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:331
pthread_mutex_t
_fmutex pthread_mutex_t
Definition: os2threads.h:53
at_write_trailer
static av_cold int at_write_trailer(AVFormatContext *avctx)
Definition: audiotoolbox.m:272
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:351
AVOutputFormat::name
const char * name
Definition: avformat.h:511
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
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
ATContext::cur_buf
int cur_buf
Definition: audiotoolbox.m:43
pthread_mutex_init
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
Definition: os2threads.h:104
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1431
AVPacket::data
uint8_t * data
Definition: packet.h:522
AVOption
AVOption.
Definition: opt.h:294
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:323
FFOutputFormat::p
AVOutputFormat p
The public AVOutputFormat.
Definition: mux.h:36
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
at_write_packet
static int at_write_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: audiotoolbox.m:237
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:332
ff_audiotoolbox_muxer
const FFOutputFormat ff_audiotoolbox_muxer
Definition: audiotoolbox.m:302
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:335
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
AV_NE
#define AV_NE(be, le)
Definition: macros.h:33
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_sample_fmt_is_planar
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:114
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AVFormatContext
Format I/O context.
Definition: avformat.h:1363
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:864
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
ATContext::list_devices
int list_devices
Definition: audiotoolbox.m:46
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
FFOutputFormat
Definition: mux.h:32
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:206
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:251
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:171
pthread_mutex_unlock
#define pthread_mutex_unlock(a)
Definition: ffprobe.c:79
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1419
at_class
static const AVClass at_class
Definition: audiotoolbox.m:294
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:343
at_write_header
static av_cold int at_write_header(AVFormatContext *avctx)
Definition: audiotoolbox.m:74
AVPacket::size
int size
Definition: packet.h:523
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:106
queue_callback
static void queue_callback(void *atctx, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer)
Definition: audiotoolbox.m:62
AVFormatContext::url
char * url
input or output URL.
Definition: avformat.h:1446
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:469
ATContext
Definition: audiotoolbox.m:37
avdevice.h
ATContext::queue
AudioQueueRef queue
Definition: audiotoolbox.m:44
check_status
static int check_status(AVFormatContext *avctx, OSStatus *status, const char *msg)
Definition: audiotoolbox.m:51
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
pthread_mutex_destroy
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
Definition: os2threads.h:112
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
internal.h
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
Definition: log.h:42
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:340
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
status
ov_status_e status
Definition: dnn_backend_openvino.c:120
options
static const AVOption options[]
Definition: audiotoolbox.m:288
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:339
AVCodecParameters::format
int format
Definition: codec_par.h:79
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ATContext::audio_device_index
int audio_device_index
Definition: audiotoolbox.m:47
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1391
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:344
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
pthread_mutex_lock
#define pthread_mutex_lock(a)
Definition: ffprobe.c:75
mux.h