UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
macos.m File Reference
#include <stdint.h>
#include "utils/macos.h"
#include "utils/macros.h"
Include dependency graph for macos.m:

Go to the source code of this file.

Functions

static const char * get_mapped_osstatus_str (OSStatus err)
 
const char * get_osstatus_str (OSStatus err)
 

Detailed Description

Author
Martin Pulec pulec.nosp@m.@ces.nosp@m.net.c.nosp@m.z

Definition in file macos.m.

Function Documentation

◆ get_mapped_osstatus_str()

static const char * get_mapped_osstatus_str ( OSStatus err)
static

Definition at line 49 of file macos.m.

49 {
50 static const struct osstatus_map {
51 OSStatus err;
52 const char *msg;
53 } osstatus_map[] = {
54 { 0, "noErr" },
55 // AUComponent.h
56 { -10879, "kAudioUnitErr_InvalidProperty" },
57 { -10878, "kAudioUnitErr_InvalidParameter" },
58 { -10877, "kAudioUnitErr_InvalidElement" },
59 { -10876, "kAudioUnitErr_NoConnection" },
60 { -10875, "kAudioUnitErr_FailedInitialization" },
61 { -10874, "kAudioUnitErr_TooManyFramesToProcess" },
62 { -10871, "kAudioUnitErr_InvalidFile" },
63 { -10870, "kAudioUnitErr_UnknownFileType" },
64 { -10869, "kAudioUnitErr_FileNotSpecified" },
65 { -10868, "kAudioUnitErr_FormatNotSupported" },
66 { -10867, "kAudioUnitErr_Uninitialized" },
67 { -10866, "kAudioUnitErr_InvalidScope" },
68 { -10865, "kAudioUnitErr_PropertyNotWritable" },
69 { -10863, "kAudioUnitErr_CannotDoInCurrentContext" },
70 { -10851, "kAudioUnitErr_InvalidPropertyValue" },
71 { -10850, "kAudioUnitErr_PropertyNotInUse" },
72 { -10849, "kAudioUnitErr_Initialized" },
73 { -10848, "kAudioUnitErr_InvalidOfflineRender" },
74 { -10847, "kAudioUnitErr_Unauthorized" },
75 { -66753, "kAudioUnitErr_MIDIOutputBufferFull" },
76 { -66754, "kAudioComponentErr_InstanceTimedOut" },
77 { -66749, "kAudioComponentErr_InstanceInvalidated" },
78 { -66745, "kAudioUnitErr_RenderTimeout" },
79 { -66744, "kAudioUnitErr_ExtensionNotFound" },
80 { -66743, "kAudioUnitErr_InvalidParameterValue" },
81 { -66742, "kAudioUnitErr_InvalidFilePath" },
82 { -66741, "kAudioUnitErr_MissingKey" },
83 // AudioHardwareBase.h
84 { 'stop', "kAudioHardwareNotRunningError" },
85 { 'what', "kAudioHardwareUnspecifiedError" },
86 { 'who?', "kAudioHardwareUnknownPropertyError" },
87 { '!siz', "kAudioHardwareBadPropertySizeError" },
88 { 'nope', "kAudioHardwareIllegalOperationError" },
89 { '!obj', "kAudioHardwareBadObjectError" },
90 { '!dev', "kAudioHardwareBadDeviceError" },
91 { '!str', "kAudioHardwareBadStreamError" },
92 { 'unop', "kAudioHardwareUnsupportedOperationError" },
93 { 'nrdy', "kAudioHardwareNotReadyError" },
94 { '!dat', "kAudioDeviceUnsupportedFormatError" },
95 { '!hog', "kAudioDevicePermissionsError" },
96 };
97
98 for (unsigned i = 0; i < sizeof osstatus_map / sizeof osstatus_map[0]; ++i) {
99 if (osstatus_map[i].err == err) {
100 return osstatus_map[i].msg;
101 }
102 }
103 return NULL;
104}
struct msghdr msg

References msg.

Referenced by get_osstatus_str().

◆ get_osstatus_str()

const char * get_osstatus_str ( OSStatus err)

Definition at line 106 of file macos.m.

106 {
107 static _Thread_local char buf[128];
108 const char *mapped_err = get_mapped_osstatus_str(err);
109 if (mapped_err != NULL) {
110 snprintf(buf, sizeof buf, "%s", mapped_err);
111 } else if (IS_FCC(err)) {
112 uint32_t fcc_be = htonl(err);
113 snprintf(buf, sizeof buf, "'%.4s'", (char *) &fcc_be);
114 } else {
115 snprintf(buf, sizeof buf, "0x%x", err);
116 }
117 snprintf(buf + strlen(buf), sizeof buf - strlen(buf), " (OSStatus error %d)", err);
118 return buf;
119}
static const char * get_mapped_osstatus_str(OSStatus err)
Definition macos.m:49
#define IS_FCC(val)
Definition macros.h:116

References get_mapped_osstatus_str(), and IS_FCC.

Referenced by audio_ca_get_device_name(), audio_ca_probe(), audio_cap_ca_init(), audio_play_ca_init(), audio_play_ca_reconfigure(), and InputProc().

Here is the call graph for this function: