Commit Graph

548 Commits

Author SHA1 Message Date
Martin Pulec
ef0b63feaa fixed some Coverity bugs
Fixed CID 464432
2024-07-02 16:36:13 +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
80e9d01d2d com_initialize: warn if not false
The guard value should be used only for one pair of
com_initialize/uniniialize call, so ensure it by checking if the value
is initialized to false.

It should be possible to use an int instead but there is currently
no need.

Set the occurences to false explicitly (in the case of vcap/deck change
from true to false).
2024-06-12 09:41:53 +02:00
Martin Pulec
c82eef4258 com init documenation updates (incl deck) 2024-06-12 09:41:52 +02:00
Martin Pulec
818fcc0057 added log-nocolor compat
refers to GH-394 and also earlier GH-256
2024-06-11 15:18:09 +02:00
Martin Pulec
bf36adeee8 get_local_address: use early return 2024-06-05 08:45:06 +02:00
Martin Pulec
e290283659 fix repeated get_sockaddr_str calls
When get_sockaddr_str was called second time, the buffer was not cleared.

Also use snprintf to write the result in get_scoaddr_addr_str.
2024-06-05 08:38:19 +02:00
Martin Pulec
2c22850a20 net: get_local_addresses - ifaddrs.ifa_addr can be NULL
The pointer ifa_addr in struct ifaddrs can be NULL and indeed it occurs
(perhaps with interfaces without assigned addrs?). Steps to reproduce:
```
uv -x sdp -t testcard -c lavc:subs=420
````
2024-06-05 08:24:23 +02:00
Martin Pulec
b30d0d96f1 starts_with->STARTS_WITH
libajantv2 now defines starts_with inside the namespace std, which
collides with the our macro.

This is also consistent with documenation in @{3}.
2024-05-31 16:04:42 +02:00
Martin Pulec
1345bc912d color_out: set support flag (color_stdout) reliably
ULTRAGRID_COLOR_OUT env variable didn't set the internal flag, just
caused color_output_init to return true. Rather moved the check to
separate funcction to avoid this.
2024-05-28 08:51:02 +02:00
Martin Pulec
1bd1bb018c color_out: fixed headers 2024-05-22 11:26:47 +02:00
Martin Pulec
313264f134 color_out: added env opt to enforce color term output
will be needed for the reflector wrapper
2024-05-22 11:26:47 +02:00
Martin Pulec
9880a1aa29 vcap/fps_indicator: use colors when low fps
Indicate lower than nominal FPS with different colors when using generic
FPS indicator.

This should help user to detect potential problems.
2024-05-16 09:54:23 +02:00
Martin Pulec
ade96e561d moved FPS indicator prefix trailing ' ' trim
moved to video_capture.cpp  - it is a bit technical and it is nicer to
have it there than in the huge main.cpp
2024-05-16 09:50:08 +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
04beae7c2d fixed some clang-tidy complains 2024-04-26 16:48:56 +02:00
Martin Pulec
80281c5c07 older compiler compat - rm array type deduction
Removed array template arguments deduction. Is not supported eg. by
clang 10 on macOS (Xcode 10.1) - perhaps not a big deal but the fix is
quite undemanding.
2024-04-26 14:38:39 +02:00
Martin Pulec
13905c4d76 use dedicated server mode blackhole addr
- use custom IPv6 black hole address 100::556C:7472:4772:6453 instead
of 100::1, which a user may use explicitly to signalize server mode
- check just the one address, not the black hole prefix in general
(again, the user may select the discard address intentinally without
knowing our semantics)
- removed the black hole handling functions (no longer needed)
- compute the actual in6_addr from the string with inet_pton instead of
hard coding the value
2024-04-26 10:35:16 +02:00
Martin Pulec
321517ffad net/udp: do not include config*h headers 2024-04-25 17:41:48 +02:00
Martin Pulec
bb3d1e128f RTP: send RTCP to clinet in server mode
Send RTCP correctly in the server mode to a client if we have the RTCP
connection (== receiving RTCP from the client).

It is done in the same way as it is currently implemented when UG is in
receiver-only mode without explicit remote address.
2024-04-25 17:41:37 +02:00
Martin Pulec
08abdf7605 vcap/dshow probe fixes
- if skipped, the mediaType was not deallocated
- use own mode variable instead of 'i', because otherwise there would be holes
+ print the id, not the ordinal numeber of the mode (now it doesn't match)
- last mode must be zero (the show_help expects zero-termination) even
  if there are not enough space
2024-04-10 08:14:17 +02:00
Martin Pulec
d53db9d75a set MAX_PATH_SIZE to MAX_PATH+1 in Windows
Actually the value MAX_PATH doesn't contain terminating NULL byte
according to the MSDN documentation for GetTempPathA. Perhaps not
a big deal but since the MAX_PATH_SIZE is generic, it is nicer to
have it correct.
2024-04-08 14:27:58 +02:00
Martin Pulec
3708bd74ea fixed VLAs in C++ files
see commit @{2} description
2024-03-25 15:29:10 +01:00
Martin Pulec
a02d6069b4 utils/worker.cpp: improved including + using 2024-03-25 14:28:40 +01:00
Martin Pulec
31618f59a9 utils/y4m: added missing new-lines 2024-02-29 14:28:06 +01:00
Martin Pulec
502fb0c554 Windows: issue a warning for PWSH/cmd term only in W10
Do not issue the warning over PowerShell or cmd legacy terminal emulators
in Windows 11. In Window the check doesn't work, because the process
tree is different - the Windows Terminal doesn't have its own process
and it is uv.exe->powershell.exe->exporer.exe.

This improves commit bb2a72f67f.
2024-02-28 12:15:40 +01:00
Martin Pulec
95b344c83e added release 1.9 color 2024-02-12 16:34:52 +01:00
Martin Pulec
ecdad2a74b utils/sdp: print RTP url for static PT
Print RTP URLs for statically mapped packet types that do not require
SDP description.

It seems like just ffplay is capable to handle the stream(s), mpv and
vlc doesn't (vlc supports at least audio).
2024-02-07 16:38:57 +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
bba976da66 utils/sdp: fixes includes
compile failed on arm64 macOS 12&13
2024-02-06 10:33:47 +01:00
Martin Pulec
772ef5de19 utils/sdp: improved string handling
- use snprintf instead of strncat (better behavior - always appends \0 and
no need to subtract 1 from len /and expecting that there is \0 at the end)
- use actual string length with sizeof than STR_LEN (which may get
removed because it is misleading in respect to global STR_LENi value)
2024-02-05 16:42:31 +01:00
Martin Pulec
6b03287fa0 utils/sdp: use CRLF
CRLF should be used in SDP (the same as for HTTP for robots.txt+security)
2024-02-05 16:37:20 +01:00
Martin Pulec
f28371c2e0 utils/sdp: separate and export PT+rtpmap fn
Separated packet type computation + eventual rtpmap generation to a
separate function, that may be used also by RTSP.
2024-02-05 15:00:06 +01:00
Martin Pulec
731a48e94f rxtx/sdp: default to mjpeg+mp3
Those doesn't need to be signalized in any way (PT is defined), so that
the receiver can play the streams directly without SDP - eg. `ffplay
rtp://[::1]:5004` (and similarly on port 5006).

MP3 (just added std TX) is set as default for RTSP as well - perhaps
not a big difference if MP3 or Opus so we do not need to handle two
cases. Also MP3 could be more compatible.
2024-02-05 09:40:49 +01:00
Martin Pulec
fcc7190bc6 transmit: support for RFC 2550 MP3 packetization
the packet header is very simple (just fragment offset)
2024-02-05 09:40:49 +01:00
Martin Pulec
e872453595 rxtx/sdp: print receiver for the stream
Print explicity that the SDP served over HTTP is valid only for the
specified receiver.
2024-02-05 09:40:43 +01:00
Martin Pulec
eb0f52e686 fix cycle in win_has_ancestor_process
In W11, there is a cycle between processes services.exe and wininit.exe:
```
[utils/win] have_ancestor: services.exe PID: 788, PPID: 892
[utils/win] have_ancestor: wininit.exe PID: 892, PPID: 788
```
which caused infinite cycle between these 2 processes.
2024-01-29 12:01:29 +01:00
Martin Pulec
bb2a72f67f issue a warning in legacy W10 terminals (PS/cmd)
Those terminal emulators block stdout/stderr output when scrolled,
which effectively stops UltraGrid. The behavior doesn't occur in MS
Terminal app, which is encouraged instead.

Note that Windows Terminal still runs cmd.exe or powershell.exe as a shell
while the cmd/PS process can acts like both terminal emulator and
shell. We also do not trigger the warning if UG is run from within
MSYS2 terminal.
2024-01-29 12:00:44 +01:00
Martin Pulec
c074bdfd41 vcap/dshow: GetSubtypeName - handle non-printable characters
added resolve_fourcc to utils/string

   - fixed wrong signal.h include guard (it should be definitely included
   in mac, it was perhaps meant to be MSW, but it is needed there too)
   - removed config*h
2024-01-25 17:07:41 +01:00
Martin Pulec
2f56acbf7a vcap/dshow: optimized including 2024-01-25 17:07:39 +01:00
Martin Pulec
783fb8a5f9 vcap/dshow: print whole grabber out command + conv
Print the grabber format + set the conversion according to that format,
not the streaming format.
2024-01-25 17:07:39 +01:00
Martin Pulec
45f51f8bb0 display_gl_get_property: assert correct size
Enough space is rather assumed because in the oppiste case, hard-to-detect
behavior may occur, especially while the problem is not reported.
2024-01-22 12:53:14 +01:00
Martin Pulec
1fa19a6844 dshow: print error info 2024-01-19 16:49:58 +01:00
Martin Pulec
0db80ba471 JPEG read_dqt: improvements
- allow reading up to 4 quantization tables (extended mode)
- check errors (unsupported/wrong precision)
2024-01-16 14:45:50 +01:00
Martin Pulec
bbbf0bc7db JPEG reader: handle quant tables more generically
- do not assume in reader indices 0 for Y a 1 for Cb/Cr
- check the RTP egligibility later
- handle lavc-compressed JPEG (using only table 0) properly, not as a
hack until today
2024-01-16 14:45:50 +01:00
Martin Pulec
5c35bddd4d jpeg reader: RTP compatibility check to sep fn 2024-01-16 14:45:49 +01:00
Martin Pulec
64d088f5e7 SDP: set audio ch count 2 for Opus
According to RFC 7587, channel count must be set always to 2 (actual
channel count like mono is signalized in-band in Opus)
2024-01-08 17:18:31 +01:00
Martin Pulec
3d0fb3e5fd simple_linked_list: replace NULL with nullptr
cstddef is not included, anyways
2023-11-30 16:35:15 +01:00
Martin Pulec
6183399199 fixed CID 424188, 42421{0,1,2,6}
COPY_INSTEAD_OF_MOVE
2023-11-30 16:05:54 +01:00
Martin Pulec
8b61234e9c simple_linked_list_remove: return bool
+ modernize
2023-11-30 09:38:12 +01:00