Commit Graph

7912 Commits

Author SHA1 Message Date
Martin Pulec
51a1046316 added utils/macos
common macOS utilities
2023-06-06 15:04:32 +02:00
Martin Pulec
4ac8b7eb0f fixed CID 53957
For some reason, this old Coverity issue was already marked as solved.
Also it is slightly more effective to store the end pointer than
evaluate in every pass.
2023-06-06 10:14:08 +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
ac837924d8 AVFoundation: removed deprecated call 2023-06-05 17:00:12 +02:00
Martin Pulec
6471a72885 gpujpeg: support for version 0.21
It changes sizes' type from int to size_t, but only one place needs to
be changed in UG.
2023-06-05 11:09:26 +02:00
Martin Pulec
7780fa8a97 configure: removed -mmacosx-version-min
This option is now mostly useless. From the prespective of UltraGrid
build system (CI), more defining are the binary dependencies by
Homebrow, which doesn't allow setting older Mac version.

Also the problem is, that the macros defined in Availability.h, like
__MAC_10_7 relate to the build system, not taking into account build
target. __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ should perhaps be
used but it seems to be quite poorly defined.

Anyways, users can now provide the environment variable
$COMMON_OSX_FLAGS if really needed.
2023-06-05 10:30:48 +02:00
Martin Pulec
594e649365 vidcap testcard: play audio also with analog/aesebu
Refer also to GH-318 - now testcard may be used with group of devicese
all using analog or aesebu.

Also until that, although analog/aesebu were not accepted to play audio,
no error was prineted and the options was just unused (no sound
generated and no error).
2023-06-02 09:29:02 +02:00
Martin Pulec
f164c5bd3a videcap testcard: reallow :mode=help
strstr("help") has accidentally catched also the above case

+ do not check fmt to NULL, which cannot happen (also was incorrect - if
  it could have (== no opts), we no longer display help but use def. vals)
2023-06-02 09:29:02 +02:00
Martin Pulec
963c09f72d vidcap testcard: support for audio for 119.88p 2023-06-02 09:28:54 +02:00
Martin Pulec
5b91957c7d allow capture filter spec (-F) after single vidcap
When only one vidcap device given, allow capture filter specification
following the capture because it is unambigous.
2023-06-01 15:41:16 +02:00
Martin Pulec
25f4ee904d PAM,Y4M: improved error checking
- errno will not be set on eg. EOF
- report expected and actual read/written sizes
2023-06-01 14:29:14 +02:00
Martin Pulec
4ba8c70a7e vidcap testcard: support for 8b 444 Y4M 2023-06-01 12:17:50 +02:00
Martin Pulec
d1b404a7d8 PAM,Y4M: fixed warnings
The reported problem was not actually a bug, since feof() and ferror()
were both checked but both gcc and coverity complained about that and
changing it accordingly actually simplifies the code.
2023-06-01 11:13:11 +02:00
Martin Pulec
e7a03c3ea2 DeckLink cap.: improved examples in help 2023-06-01 10:52:10 +02:00
Martin Pulec
2302810ad1 video testcard: support audio for 29.97/59.94 FPS
refer to GH-316
2023-05-31 16:00:19 +02:00
Martin Pulec
d0cb80edb6 video testcard: support audio for 23.98 FPS
support 29.98, because 48 kHz is divisible by 24000/1001 (it's 2002
samples)

Note that 29.97 (or 59.94) is still not supported because 48 kHz is not
evenly divisible by that value (it is 1601.6 audio samples per 29.97
video frame).
2023-05-31 16:00:19 +02:00
Martin Pulec
560abdf058 video testcard: refuse video FPS unsupp. by audio 2023-05-31 16:00:19 +02:00
Martin Piatka
8602727d35 acap/wasapi: Fix setting sample rate 2023-05-31 13:11:36 +02:00
Martin Pulec
aa24e65598 parse_options: ensure audio device given once
avoid unintended audio playback/capture devices given

refer GH-316
2023-05-31 12:21:08 +02:00
Martin Pulec
f90214d0c9 CoreAudio: print error numbers 2023-05-30 17:14:21 +02:00
Martin Pulec
0f546e1f4d CoreAudio cap.: check sample rate
On incorrect device index, the further call succeeds but rate returned
is 0, resulting in wrong assert in ring_buffer_init().

+ s/MODULE_NAME/MOD_NAME for convenience (usual in other code)
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
Martin Pulec
0d86ec56d1 video testcard: added afrequency
added "afrequency" option to set sine wave frequency
2023-05-30 17:14:21 +02:00
Martin Pulec
0461ad2f0d video testcard: moved help to separate function 2023-05-30 17:14:20 +02:00
Martin Pulec
5390a307e0 testcard (vidcap+standalone audio): clang warn fix 2023-05-30 17:14:17 +02:00
Martin Pulec
033576f3cc sdl_mixer: paths to Ubuntu SF should be w/o /usr
The listed paths are suffixes to installation prefix, which may be /usr
but almost certainly won't be /, so that the path will be incorrect.
2023-05-30 10:23:55 +02:00
Martin Pulec
108348509e switcher: print device name when switching
Since in last commit, the printed index has changed, print device name
to ensure user that it is the correct one.

+ fixed not freed device state array on cleanup
2023-05-30 10:08:10 +02:00
Martin Pulec
2720dc3bef switcher: print 1-based indices
keys as well as devices in help are 1-based
2023-05-30 09:57:13 +02:00
Martin Pulec
90ee2a2023 fixed CID 408095 2023-05-30 08:58:20 +02:00
Martin Pulec
fbb6b77b4c testcard: improved help
- describe 'fps' option - although the semantics is obvious, it was not
  mentioned that it accepts 'i' (interlaced) suffix
- change FPS in examples to '59.94i' to illustrate the syntax

refer to GH-317
2023-05-26 16:58:17 +02:00
Martin Pulec
066d1f4fd9 PAM: ignore comments
synced with GPUJPEG

comments are correctly skipped in PAM

- moved fread to while (not to repeat and potentially forget when there
  is continue keyword)
2023-05-25 16:58:31 +02:00
Martin Pulec
194849ad2b added video capture filter ratelimit
Limits frame rate to specified value.

This can be used if source doesn't keep its nominal frame rate, as some
Magewells do and use higher.

Another use case is just to limit the framerate from eg. 60 to 25 (which
are coprimes, for 60 and 30, already existing capture filter 'every')
can be used.
2023-05-24 09:35:17 +02:00
Martin Pulec
0f4855e7f1 testcard: added some examples
+ few more mode aliases
2023-05-24 09:35:10 +02:00
Martin Piatka
aa0adb152e logger: Add missing initialization
Doesn't really matter since it's set in host.cpp
2023-05-23 13:05:14 +02:00
Martin Piatka
111ee21dcd GUI: Eliminate a few copies
Get's rid of a few copies that Coverity was complaining about
2023-05-23 12:49:06 +02:00
Martin Pulec
65c7924e4d testcard: allow mode specification with shortcut
added support for specifying video with something like:
`-t testcard:mode=vga`.
2023-05-23 09:29:39 +02:00
Martin Pulec
3f5e4df87b testcard help: small updates
- sort options alphabetically + change some
- print default used format
2023-05-22 16:37:50 +02:00
Martin Pulec
6ad63dc300 testcard: fixed a crash 2023-05-22 16:37:50 +02:00
Martin Pulec
0e0ffb3454 GLFW: swap buffers after changing size
In Wayland, when resizing windows programmatically glfwSetWindowSize(),
if swap buffers was not triggered, event returning back to the original
resolution is triggered when swap buffer is triggered just after
drawing. It looks like that no drawing should occur before window size
change and swap buffers, seems there has been reports for SDL, eg. [1].

Also do not call gl_resize() after glfw_resize_window() (needless, it
will be triggered via callback after swapping the buffers).

To reproduce the wrong behavior - use Wayland with GLFW native Wayland
build, then: `uv -t testcard -d gl` (size may be any other than the
splashscreen size 512x512).

[1] https://github.com/libsdl-org/SDL/pull/4821
2023-05-19 12:49:35 +02:00
Martin Pulec
54c2bcce8b GL display: round window width
Window width is not taken directly from video desc but rather computed
according to height (to reflect optional aspect ratio). So the window
size needs to be rather rounded to respect odd sizes like 187x77, which
rounded down 186x77, eg.:

    uv -t testcard:size=187x77 -d gl
2023-05-19 12:49:35 +02:00
Martin Pulec
1b6ed9252b vidcap testcard: moved to C 2023-05-19 12:49:27 +02:00
Martin Pulec
a24878cadc vidcap testcard: print error on unsupported Y4M
Instead of crashing on assert, print user-friendly message that the Y4M
is not supported. Also print the properties of the file and what is
supported, which allows easy debug and user can eg. request the feature.
2023-05-19 09:56:35 +02:00
Martin Pulec
0555e49acf vidcap testcard: support for RGBA PAM
+ print user-friendly message if PAM has unsupported channel count,
  instead of crashing on assert
2023-05-19 09:56:35 +02:00
Martin Pulec
98d0372b95 testcard: use time_ns_t instead of std::chrono 2023-05-19 09:56:34 +02:00
Martin Pulec
a55e42a421 vidcap testcard: do not use vectors 2023-05-19 09:56:27 +02:00
Martin Pulec
fa3a69473c video_pattern_generator can have C API 2023-05-19 08:53:17 +02:00