Commit Graph

308 Commits

Author SHA1 Message Date
Martin Pulec
e52dffac5e src/audio/playback/alsa.c: todo for get_sched_latency_ns
returns now always -1, suggesting removal
2024-07-08 10:21:01 +02:00
Martin Pulec
e494106bba moved strdupa from compat/misc to strings
\+ missing include guard
2024-06-12 14:26:34 +02:00
Martin Pulec
d0bfef4651 portaudio: accept device name prefixes
Also copy the device name to caller allocated buffer instead of cumbersome
giving the pointer to original string.
2024-05-14 11:31:56 +02:00
Martin Pulec
cec50e7656 portaudio: fixed including
- removed config*.h included
- optimized with include-what-you-use
2024-05-14 08:58:45 +02:00
Martin Pulec
9ca00ff610 CoreAudio: accept name for default devices
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
2024-05-13 16:47:20 +02:00
Martin Pulec
56a6dc78b0 replace remaining WIN32 platform macros
see the commit HEAD@{2}
2024-05-13 12:56:53 +02:00
Martin Pulec
1cb9d0aea1 jack sources: fixed includes+year, enum
- 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)
2024-02-07 11:31:12 +01:00
Martin Pulec
0241177c0e JACK loader [macOS,arm64]: try using Homebrew lib
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
2024-02-07 10:21:16 +01:00
Martin Pulec
f9290460a2 fixed CID 428882 2023-12-01 10:18:47 +01:00
Martin Pulec
cd22b7d8cc aplay dummy: print also offset from previous TS 2023-11-27 15:21:40 +01:00
Martin Pulec
99269e670d aplay dummy: added option debug
print timestamps etc.
2023-11-27 15:21:29 +01:00
Martin Pulec
7e2090b1cc audio mixer: fixed some Coverity complains
CID 424194, 424202
2023-11-21 09:38:25 +01:00
Martin Pulec
a4fa860b40 audio mixer: simplified 2023-11-21 09:08:15 +01:00
Martin Pulec
68eeafca5e Revert "audio transmit: new sending API"
This reverts commit bf35242e78.
2023-10-16 16:19:56 +02:00
Martin Pulec
cdef66a141 Revert "audio TX: use the packet API"
This reverts commit 8da83d3e92.
2023-10-16 16:19:56 +02:00
Martin Piatka
873a70ebba pipewire: Make the logging MOD_NAME consistent 2023-10-16 15:48:39 +02:00
Martin Piatka
0bb9fbb07e Move pipewire_common to src/
Since it will be used for video stuff too
2023-09-05 15:23:53 +02:00
Martin Piatka
0d12a49531 aplay/pipewire: Old pw compat 2023-08-01 13:45:01 +02:00
Martin Pulec
8da83d3e92 audio TX: use the packet API
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.
2023-08-01 12:01:05 +02:00
Martin Pulec
bf35242e78 audio transmit: new sending API
Added API allowing sending multiple compressed packets (eg. by Opus)
with the same timestamp.
2023-08-01 10:26:15 +02:00
Martin Piatka
7230f51c49 aplay/pipewire: Add help 2023-07-28 12:33:20 +02:00
Martin Piatka
b249b18c17 aplay/pipewire: reconfigure returns bool 2023-07-28 12:33:18 +02:00
Martin Piatka
f1c4daab4f aplay/pipewire: Log format on param change 2023-07-28 12:33:17 +02:00
Martin Piatka
6dceaa5996 aplay/pipwire: Wait for stream to start on reconf 2023-07-28 12:33:17 +02:00
Martin Piatka
86f69754fe aplay/pipewire: Warn when frame doesn't fit in ring 2023-07-28 12:33:17 +02:00
Martin Piatka
4357fb5c24 aplay/pipewire: Better logging 2023-07-28 12:33:16 +02:00
Martin Piatka
6794ef6fce aplay/pipewire: Configurable buffer length & quant 2023-07-28 12:33:16 +02:00
Martin Piatka
e064f0e40b audio/pipewire: Add bps to pw format helper 2023-07-28 12:33:16 +02:00
Martin Piatka
c28a770bfb audio/pipewire: Add common device listing 2023-07-28 12:33:15 +02:00
Martin Piatka
e9f0a0ec67 aplay/pipewire: Target node key compat
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.
2023-07-28 12:33:15 +02:00
Martin Piatka
6ef50bd9fb aplay/pipewire: Set params buffers 2023-07-28 12:33:14 +02:00
Martin Piatka
1457e07ab0 aplay/pipewire: Add device selection 2023-07-28 12:33:13 +02:00
Martin Piatka
1bde21ba38 Add initial pipewire audio output 2023-07-28 12:33:13 +02:00
Martin Pulec
6780691b4e modernize playback APIs
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).
2023-07-18 16:43:37 +02:00
Martin Pulec
5029aa2258 CoreAudio: allow selection by name (substring) 2023-06-12 13:21:55 +02:00
Martin Pulec
83d819600e CoreAudio play: print more errors
Avoid the cases when there some error occurs but nothing is printed to
the output.
2023-06-12 11:37:23 +02:00
Martin Pulec
683ddaf381 CoreAudio: removed OS X 10.5 compat
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.
2023-06-12 11:35:13 +02:00
Martin Pulec
4be9decd7e CoreAudio small help fixes 2023-06-12 11:13:29 +02:00
Martin Pulec
876f2e9609 CoreAudio: pretty color help 2023-06-06 15:04:37 +02:00
Martin Pulec
4836d56d49 CoreAudio cap.: MOD_NAME updated (indicate cap) 2023-06-06 15:04:37 +02:00
Martin Pulec
7e5b5b1b9f CoreAudio: print device name when starting cap/play 2023-06-06 15:04:37 +02:00
Martin Pulec
a2e1deb564 CoreAudio play.: removed rang.hpp 2023-06-06 15:04:37 +02:00
Martin Pulec
51a1046316 added utils/macos
common macOS utilities
2023-06-06 15:04:32 +02:00
Martin Pulec
c0176fcb50 aplayback DeckLink: removed rang.hpp
+ one line doxygen file documenatation
2023-06-06 09:26:33 +02:00
Martin Pulec
e99244b175 audio devices: removed handling of NULL cfg
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.
2023-06-06 09:26:27 +02:00
Martin Pulec
fe1b38767e CoreAudio: print error FourCC if available
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.
2023-06-05 17:00:18 +02:00
Martin Pulec
45cbd8dd06 macOS: fixed some other deprecates 2023-06-05 17:00:18 +02:00
Martin Pulec
f90214d0c9 CoreAudio: print error numbers 2023-05-30 17:14:21 +02:00
Martin Pulec
9abd64ff5b CoreAudio: check indices val validity 2023-05-30 17:14:21 +02:00
Martin Pulec
bb5c413ce4 fixed CoreAudio default devices
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).
2023-05-30 17:14:21 +02:00