Commit Graph

82 Commits

Author SHA1 Message Date
Martin Pulec
bf949d50b6 fix other pthread_t arithmetic comparison
should use `pthread_equal(thread_id, PTHREAD_NULL)`, see the commit HEAD~3
2025-11-21 14:41:25 +01:00
Martin Pulec
89c3ed6f2c mark some more compat headers as IWYU export
not all compat/ headers are marked as exporting, 2 reasons:
- some compat define own symbols, like platform_semafore or aligned_malloc
(not _alloc as in C11)
- some headers are too generic to export all symbols, eg. unistd.h
or windows.h
2025-11-10 15:56:22 +01:00
Martin Pulec
8896b87b44 compat/strings.h: IWYU export strings.h
The includer needs no longer use IWYU pragmas for strcasecmp in *NIX.

In Windows, _stricmp is defined in string.h, which is not currently
exported (it contains more symbols so it isn't specific enough, in
contrary to POSIX strings.h which contains just strcasecmp and ffs
family).
2025-11-10 15:56:22 +01:00
Martin Piatka
eb5e77b980 compat/aligned_malloc: Add missing include guard 2025-10-17 09:55:11 +02:00
Martin Pulec
09f82871f4 compat/endian: sync with GPUJPEG
ported changes from GPUJPEG, mostly cosmetic

For Win32 implementation, winsock2 is not used at all - Windows stdlib.h
contains _byteswap_* family so it is better to use these and not pull
the whole winsock2.h header struff (and also the winsock library but this
is irrelevannt for UG because we need to link with it unconditionally).
2025-10-14 13:17:10 +02:00
Martin Pulec
e63988478d compat/alarm: include unistd.h if not Win
If not using the Windows compat, include unistd.h that declares alarm()
according to the POSIX.
2025-09-16 15:32:20 +02:00
Martin Pulec
cda3d1b860 control_socket.cpp: IWYU 2025-06-18 08:49:44 +02:00
Martin Pulec
d21c44c737 portaudio: allow also case insensitive substr 2025-06-04 15:42:16 +02:00
Ben Roeder
a62fe80c3f Fix spelling errors throughout codebase
Corrected various spelling mistakes in comments, documentation, and
variable names across the project. Changes include:
- Documentation files (CONTRIBUTING.md, README.md, etc.)
- Source code comments in C/C++ files
- Function parameter names and descriptions

No functional changes were made.
2025-06-01 18:03:40 +01:00
Martin Pulec
5dbf9204b1 DragonFly BSD compat 2025-05-30 08:38:05 +02:00
Martin Pulec
c9bb34f9f5 compat/qsort_s: reformat + improve doc
+ s/QSORT_S_COMP_CTX_FIRST/QSORT_S_COMP_CTX_FIRST/
+ define the comparator with QSORT_S_COMP_DEFINE in hwaccel_videotoolbox.c
2025-05-30 08:38:03 +02:00
Martin Pulec
7c911a3312 NetBSD compat 2025-05-30 08:10:34 +02:00
Martin Pulec
1effd49286 qsort_r fallback implementation 2025-05-30 08:10:33 +02:00
Martin Pulec
38f134938f compat/net.h: include headers for sockaddr*
eg. sockaddr_storage used by rtp/pbuf.h
2025-05-30 08:10:30 +02:00
Martin Pulec
35ef6f4e6b sdl3: handle eventual big-endian 2025-04-01 14:02:27 +02:00
Martin Pulec
e2f0ddc6eb CI ARM: set CFLAGS for 32-bit off_t
The flags queried also for 64-bit ARM but it is empty there.

This does basically the same as the commit f46a101c, that adds
_FILE_OFFSET_BITS=64 define to config.h. But the config.h may not be
always included now.

+ compat/misc: typo in comment + assert 64b off_t (off_t should be
actually 64b in _OFF64 env and >= 64b in _OFFBIG so assert at least 64)
2025-03-27 12:17:34 +01:00
Martin Pulec
ca93e7db8f wav_{reader,writer}: IWYU 2025-03-25 10:56:11 +01:00
Martin Pulec
c2116835da compat/platform_{pipe,semaphore}: IWYU 2025-03-25 10:56:10 +01:00
Martin Pulec
e8cd71b259 vcap/import: IWYU + aligned_malloc compat 2025-03-25 09:17:13 +01:00
Martin Pulec
283439b9fe aplay/portaudio get_supported_format: sort srates
Sort sampling rates for poraudio playback that are tested if the device
doesn't support natively the received sample rate.

Use lowest higher or equal sampling rate if possible, if not, use the
highest usable sampling rate.

Also remove note in qsort_s.h (no longer valid - can be included where
approopriate, not only before first inclusion of stdlib.h).
2025-03-17 15:51:20 +01:00
Martin Pulec
b3c89e34d2 ndi_common: unify loader for Win and mac/Linux
Always try the list of libraries. Also replace FALLBACK_NDI_PATH with
_PATHS which now can contain comma-delimited list of libraries.
2024-10-14 14:49:04 +02:00
Martin Pulec
9adf7b6101 compat/htonl.->compat/net.h
It can be used in place of other network-related headers, not just for
htonl and family.

+ compat for fd_t and INVALID_SOCKET (that has been in config_*.h)
2024-09-30 10:54:14 +02:00
Martin Pulec
06afd55d25 compat/htonl.h Win warning fix for rtpdec_h264.c
fixed:
```
Compiling src/rtp/rtpdec_h264.c...
In file included from src/rtp/rtpdec_h264.c:54:
In file included from src/rtp/rtp.h:40:
In file included from src/config_win32.h:78:
C:/msys64/clang64/include/winsock2.h:15:2: warning: Please include winsock2.h before windows.h [-W#warnings]
   15 | #warning Please include winsock2.h before windows.h
```

Also include winsock2.h in blackmagic_common.hpp, because BMD includes include
windows.h and that would be included prior to compat/htonl.h.
2024-07-29 09:10:22 +02:00
Martin Pulec
de127dd76d vcap/rtsp: do the SDP parsing more reliably
The original mean was a bit cumbersome so rewrite it entirely in a more clean way.

It is now capable of playing the video produced by this UG command:
```
uv -t testcard -x rtsp:port=8654 -c lavc:enc=libx264:safe -V -A mp3 -s testcard
```

Note that the audio is still not fully implemented so that only video will
be presented. Neither this was possible before this change (audio control
was used instead of video due to buggy parsing).
2024-07-25 09:35:25 +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
f01e4c36b7 moved around compat functions
moved compat functions from config_*h, namely:
- localtime_s/gmtime_s
- strerror_s
- mkdir Windows compat
- removed str[n]cmp from compat/misc (already in compat/strings,h,
which is the better location)

Do not use config*.h in export.c (motivation for the above changes).
2024-06-12 14:02:42 +02:00
Martin Pulec
2ee702e15e blackmagic_common: fixed including
do not include config*h
2024-06-07 10:40:19 +02:00
Martin Pulec
f5d124a9ea decklink: improved including 2024-05-16 09:54:24 +02:00
Martin Pulec
226c17f02d replace all other AC-defined platform macro
Replaced all other autoconf-defined platform macros (HAVE_LINUX and
HAVE_MACOSX, WIN32 already done) with those ones defined by compiler.

Not yet remove the definitions from autoconf, in case someone will use
the old macros anyways. Remove in future.
2024-05-13 12:56:53 +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
97cef055e6 compat/alarm,compat/usleep: do not use config*h
\+ use _WIN32 platform macro instead of WIN32
2024-05-13 12:56:52 +02:00
Martin Pulec
e332c85b20 vcap/testcard: improved including
- do not include config*h - for [nh]to[nl][sh] created a compat file,
because it is included in different headers in MSW and POSIX-compatible
systems
- include suggested headers by include-what-you-use
2024-03-06 13:19:13 +01:00
Martin Pulec
7c28f98a07 usleep.h: improved including
Include config.h directly if possible (to avoid obligating the includer
to do so).

Revert the condition to work better if HAVE_CONFIG_H is not defined -
unistd.h is included then.
2023-11-16 14:01:23 +01:00
Martin Pulec
8b412140d7 renamed get_win_error->get_win32_error
it formats win32 errors, but not HRESULT in general
2023-10-27 12:18:17 +02:00
Martin Pulec
0017e57134 compat/qsort_s.h: do not require include 1st
Do not enforce the file to be either included before stdlib.h or stdlib.h
to be using __STDC_WANT_LIB_EXT1__ = 1. The bound checking API is
currently nowhere implemented, anyways, and we may use system native secure
qsort implementation (qsort_r in *NIX, MS variant of qsort_s).
2023-08-14 16:06:15 +02:00
Martin Pulec
d17c5ea24c removed platform_time.c + references
get_time_in_ns() should be used instead time_since_epoch_in_ms(). Having
both may be misleading and may lead to errors when interchanged.
2023-08-08 15:32:29 +02:00
Martin Pulec
3639d00dbf replaced not thread-safe *rand48 functions
Use rand_s() in Windows and random() in POSIX systems.
2023-08-02 10:07:19 +02:00
Martin Pulec
a4d88298f7 win: common err to string func 2023-02-27 09:49:20 +01:00
Martin Pulec
717b575d87 qsort_s comparator compat macro
comparators can be defined utilizing the macro to avoid fiddling with
ifdefs

+ use it in lavc conversions
2023-02-21 10:46:47 +01:00
Martin Pulec
0aaf9fff99 qsort_s compat: relax requirement to include first
If includer defines __STDC_WANT_LIB_EXT1__ to 1, it is no longer needed
to include this header first.
2023-02-10 15:13:17 +01:00
Martin Pulec
62f143f939 config_common.h: removed macros.h include 2022-11-22 14:50:19 +01:00
Martin Pulec
c132fcc9fe removed gettimeofday win32 replacement
The replacement was recently (since 6dfd098d) used even despite the
built-in has been implemented. The replacement was there because it
has supposedly better precision than the built-in. But since it is
no longer true (if it ever was), it is removed.

Note: there is also timespec_get (or UG wrapper get_time_in_ns) that can
be used in recent code instead of POSIX gettimeofday.
2022-10-13 12:15:40 +02:00
Martin Pulec
2066262f3a JACK: use platform_semaphore
POSIX semaphores are deprecated on macOS

+ keep error checking from JACK and moved it to platform_semaphore
+ reorder includes alphabetically
2022-10-03 16:01:53 +02:00
Martin Pulec
888dbe14d5 removed platform_spin
There is perhaps no need to use spin lock - pthread mutexes have low
overhead if no contention takes place, anyway.

+ replaced platform_spin with pthread_mutex in resource manager
+ document why resource manager is needed
2022-04-01 10:28:55 +02:00
Martin Pulec
f84c5ec859 VideoToolbox: offer also P210
If decoding to swformat fails, try to use also P210 depending. It is
used if >8 bits video is present, otherwise UYVY is preferred.
2022-03-30 16:51:35 +02:00
Martin Pulec
90686125c9 gettimeofday win32 compat: use timespec_get 2022-03-18 08:52:32 +01:00
Martin Pulec
89a4050c76 lib_common: move dlopen etc compat to separate src
It is a bit needless to compile the dlerror() commat in a huge number of
sources including that file. Moreover, the compat functions are not
direcly linked to modules' infrastructure in UG, which was piggy-backed
to.
2022-03-11 10:48:49 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
3cc5281a40 Compile usleep only if not found
Do not use always our usleep implementation on MSW - MSYS2/CLANG64 has
its own implementation.
2021-09-06 13:32:06 +02:00
Martin Pulec
4cc3e442b1 Added strdupa compat 2021-08-05 09:28:52 +02:00