UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
src
utils
macos.m
Go to the documentation of this file.
1
5
/*
6
* Copyright (c) 2023 CESNET, z. s. p. o.
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, is permitted provided that the following conditions
11
* are met:
12
*
13
* 1. Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
*
16
* 2. Redistributions in binary form must reproduce the above copyright
17
* notice, this list of conditions and the following disclaimer in the
18
* documentation and/or other materials provided with the distribution.
19
*
20
* 3. Neither the name of CESNET nor the names of its contributors may be
21
* used to endorse or promote products derived from this software without
22
* specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28
* EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
*/
37
38
#ifdef HAVE_CONFIG_H
39
#include "config.h"
40
#include "
config_unix.h
"
41
#include "
config_win32.h
"
42
#endif
43
44
#include <stdint.h>
45
46
#include "
utils/macos.h
"
47
#include "
utils/macros.h
"
48
49
static
const
char
*
get_mapped_osstatus_str
(OSStatus err) {
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
}
105
106
const
char
*
get_osstatus_str
(OSStatus err) {
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
}
120
config_unix.h
config_win32.h
macos.h
get_mapped_osstatus_str
static const char * get_mapped_osstatus_str(OSStatus err)
Definition
macos.m:49
get_osstatus_str
const char * get_osstatus_str(OSStatus err)
Definition
macos.m:106
macros.h
IS_FCC
#define IS_FCC(val)
Definition
macros.h:116
msg
struct msghdr msg
Definition
rtp_callback.c:80
Generated on Wed Sep 25 2024 14:27:19 for UltraGrid by
1.12.0