![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "config_unix.h"#include "config_win32.h"#include <AudioUnit/AudioUnit.h>#include <Availability.h>#include <chrono>#include <cinttypes>#include <climits>#include <CoreAudio/AudioHardware.h>#include <iostream>#include <stdlib.h>#include <string>#include <string.h>#include "audio/audio_playback.h"#include "audio/playback/coreaudio.h"#include "audio/types.h"#include "debug.h"#include "lib_common.h"#include "utils/audio_buffer.h"#include "utils/color_out.h"#include "utils/macos.h"#include "utils/ring_buffer.h"
Go to the source code of this file.
Classes | |
| struct | state_ca_playback |
Macros | |
| #define | MOD_NAME "[CoreAudio play.] " |
| #define | NO_DATA_STOP_SEC 2 |
Functions | |
| ADD_TO_PARAM ("ca-disable-adaptive-buf", "* ca-disable-adaptive-buf\n" " Core Audio - use fixed audio playback buffer instead of an adaptive one\n") | |
| AudioDeviceID | audio_ca_get_device_by_name (const char *name, int dir) |
| void | audio_ca_get_device_name (AudioDeviceID dev_id, size_t namebuf_len, char *namebuf) |
| void | audio_ca_probe (struct device_info **available_devices, int *count, int dir) |
| static bool | audio_play_ca_ctl (void *state, int request, void *data, size_t *len) |
| static void | audio_play_ca_done (void *state) |
| static void | audio_play_ca_help () |
| static void * | audio_play_ca_init (const char *cfg) |
| static void | audio_play_ca_probe (struct device_info **available_devices, int *count, void(**deleter)(void *)) |
| static void | audio_play_ca_put_frame (void *state, const struct audio_frame *frame) |
| static bool | audio_play_ca_reconfigure (void *state, struct audio_desc desc) |
| static bool | is_requested_direction (AudioObjectPropertyAddress propertyAddress, AudioDeviceID *audioDevice) |
| REGISTER_MODULE (coreaudio, &aplay_coreaudio_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION) | |
| static OSStatus | theRenderProc (void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumFrames, AudioBufferList *ioData) |
Variables | |
| static const struct audio_playback_info | aplay_coreaudio_info |
| constexpr int | CA_DIR = 1 |
| constexpr int | DEFAULT_BUFLEN_MS = 50 |
Definition in file coreaudio.cpp.
| #define MOD_NAME "[CoreAudio play.] " |
Definition at line 77 of file coreaudio.cpp.
Referenced by audio_ca_probe(), audio_play_ca_init(), audio_play_ca_reconfigure(), is_requested_direction(), and theRenderProc().
| #define NO_DATA_STOP_SEC 2 |
Definition at line 76 of file coreaudio.cpp.
Referenced by theRenderProc().
| ADD_TO_PARAM | ( | "ca-disable-adaptive-buf" | , |
| "* ca-disable-adaptive-buf\n" " Core Audio - use fixed audio playback buffer instead of an adaptive one\n" | ) |
| AudioDeviceID audio_ca_get_device_by_name | ( | const char * | name, |
| int | dir ) |
@briew tries to get device id from device name
| name | name of the device to be looked up |
| dir | direction - |
Definition at line 369 of file coreaudio.cpp.
References audio_ca_probe(), count, device_info::dev, and name.
Referenced by audio_cap_ca_init(), and audio_play_ca_init().

| void audio_ca_get_device_name | ( | AudioDeviceID | dev_id, |
| size_t | namebuf_len, | ||
| char * | namebuf ) |
Definition at line 281 of file coreaudio.cpp.
References get_osstatus_str(), kAudioObjectPropertyElementMain, LOG_LEVEL_WARNING, and log_msg().
Referenced by audio_ca_probe(), audio_cap_ca_init(), and audio_play_ca_init().

| void audio_ca_probe | ( | struct device_info ** | available_devices, |
| int * | count, | ||
| int | dir ) |
@briew probe for available capture/playback devices (direction given by parameter dir)
| dir | -1 capture, 1 playback |
Definition at line 305 of file coreaudio.cpp.
References audio_ca_get_device_name(), count, device_info::dev, get_osstatus_str(), is_requested_direction(), kAudioObjectPropertyElementMain, LOG, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, and name.
Referenced by audio_ca_get_device_by_name(), audio_cap_ca_probe(), and audio_play_ca_probe().

|
static |
Definition at line 133 of file coreaudio.cpp.
References AC_PCM, AUDIO_PLAYBACK_CTL_QUERY_FORMAT, desc, and len.
|
static |
Definition at line 524 of file coreaudio.cpp.
References state_ca_playback::auHALComponentInstance, state_ca_playback::buffer, state_ca_playback::buffer_fns, audio_buffer_api::destroy, state_ca_playback::initialized, and state.
|
static |
Definition at line 388 of file coreaudio.cpp.
References audio_play_ca_probe(), color_printf(), count, deleter, device_info::dev, name, SBOLD, SRED, and TBOLD.
Referenced by audio_play_ca_init().

|
static |
Definition at line 407 of file coreaudio.cpp.
References audio_ca_get_device_by_name(), audio_ca_get_device_name(), audio_play_ca_help(), state_ca_playback::auHALComponentInstance, state_ca_playback::buf_len_ms, state_ca_playback::buffer, CA_DIR, get_commandline_param(), get_osstatus_str(), INIT_NOERR, kAudioObjectPropertyElementMain, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), MOD_NAME, and val.

|
static |
Definition at line 382 of file coreaudio.cpp.
References audio_ca_probe(), count, and deleter.
Referenced by audio_play_ca_help().

|
static |
Definition at line 517 of file coreaudio.cpp.
References state_ca_playback::buffer, state_ca_playback::buffer_fns, frame, state, and audio_buffer_api::write.
|
static |
Definition at line 154 of file coreaudio.cpp.
References audio_buffer_fns, audio_buffer_init(), state_ca_playback::audio_packet_size, state_ca_playback::auHALComponentInstance, state_ca_playback::buf_len_ms, state_ca_playback::buffer, state_ca_playback::buffer_fns, desc, state_ca_playback::desc, audio_buffer_api::destroy, get_commandline_param(), get_osstatus_str(), state_ca_playback::initialized, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_NOTICE, LOG_LEVEL_WARNING, MOD_NAME, ring_buffer_fns, ring_buffer_init(), state, and theRenderProc().

|
static |
Definition at line 254 of file coreaudio.cpp.
References LOG, LOG_LEVEL_ERROR, and MOD_NAME.
Referenced by audio_ca_probe().
| REGISTER_MODULE | ( | coreaudio | , |
| & | aplay_coreaudio_info, | ||
| LIBRARY_CLASS_AUDIO_PLAYBACK | , | ||
| AUDIO_PLAYBACK_ABI_VERSION | ) |
|
static |
Definition at line 97 of file coreaudio.cpp.
References state_ca_playback::audio_packet_size, state_ca_playback::buffer, state_ca_playback::buffer_fns, state_ca_playback::last_audio_read, LOG, LOG_LEVEL_NOTICE, LOG_LEVEL_WARNING, MOD_NAME, NO_DATA_STOP_SEC, state_ca_playback::quiet, audio_buffer_api::read, and UNUSED.
Referenced by audio_play_ca_reconfigure().
|
static |
Definition at line 538 of file coreaudio.cpp.
|
constexpr |
Definition at line 75 of file coreaudio.cpp.
Referenced by audio_play_ca_init().
|
constexpr |
Definition at line 74 of file coreaudio.cpp.