The default device name was not included in the list of device for
comparison, because the direction was not given. But we know the direction
both in capture and playback, so we can add it so that the default device
is recognized by name.
This also makes audio_ca_probe() more clear as a direction is always
capture or playback (-1 or 1).
\+ added some doxygen documentation
refer to GH-385
- removed config*.h (not needed)
- moved system headers prior user-defined
- fixed copyright year to 2024
- replaced numeric macros with enum (cppcoreguidelines-macro-to-enum)
On ARM64 macs, the loader refuses to load the library installed with
Homebrew in /opt/homebrew/lib, even when added to DYLD_LIBRARY_PATH. Error
message is:
```
JACK library "libjack.dylib" opening failed: dlopen(libjack.dylib,
0x0002): tried: 'libjack.dylib' (relative path not allowed in hardened
program), '/System/Volumes/Preboot/Cryptexes/OSlibjack.dylib' (no such
file), '/Volumes/ULTRAGRID/uv-qt.app/Contents/libs/libjack.dylib' (no
such file), '/Volumes/ULTRAGRID/uv-qt.app/Contents/libs/libjack.dylib'
(no such file), '/usr/lib/libjack.dylib' (no such file, not in dyld
cache), 'libjack.dylib' (relative path not allowed in hardened program)
```
As a solution, the absolute path `/opt/homebrew/lib/libjack.dylib`
is loaded.
Other changes:
- try array of candidate JACK library paths
- increased STR_LEN to 2048 - for the error messages from the JACK, 1024
could be too little (errs stored and printed only if no library usable)
- MOD_NAME defined in the header, so that MOD_NAME cannot be defined in
the source prior include; undefined at the end of the header
It needs to be enabled explicitly, anyways - at least Opus won't work
with former UG versions. For 40 ms frame, it produces 2 packets. When
merged into one packet, the decoder is unable to decompress.
Stream target should be set using PW_KEY_TARGET_OBJECT to target node
serial or node name.
However, old pipewire versions (e.g. 0.3.48) seem to ignore this
property. So instead we use the PW_KEY_NODE_TARGET (which gets
deprecated in 0.3.64) with the target node name. This older property
however doesn't support serial numbers.
modernized video display, audio playback and vo postprocess APIs
THe APIs were already recently updated so modernize it by using bool
where the return value is semantically boolean value. Using TRUE/FALSE is
inherently ambiguous because it is not obvious from the prototype if
success is 0 or TRUE (1).
Mac OS X 10.5 is unsupported by Apple for more than 10 years and it is
questionable if UltraGrid even compiles there. There is no indication
(requests, questions) that anyone uses that.
cfg cannot be NULL so do not handle it in any way
In the historic API, empty options was passed as NULL but it is not the
case for some time so remove the NULL handling entirely not to be
confusing.
In addition to error code, the OSStatus usually represent a FourCC that
can be presented to user.
Some generic error may be interpreted by:
NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
const char *err_str = [[error localizedDescription] UTF8String];
But it looks like it almost always returns 'The operation couldn’t be
completed.' for unknown errors. Also there doesn't seem to be any domain
specific for CoreAudio.
if no configuration is set, empty string ("") is passed, not NULL
This resulted in wrong device set 0 set because the atoi doesn't check
its arguments. Example of fixed behavior:
uv -s testcard -r coreaudio
`AudioUnitSetProperty(s->auHALComponentInstance, kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, 1, &device, sizeof(device));` succeeded with 0
for some reason (but not with other values).