Commit Graph

566 Commits

Author SHA1 Message Date
Martin Pulec
bda593c85b vcap/cmpto_j2k + video_frame_pool rework
use pimpl for video_frame_pool

use implicit constructor for vcomp/cmpto_j2k to allow switching of pools
2024-08-30 15:49:04 +02:00
Martin Pulec
7995b18255 print_stacktrace_win: print stack ptr addr
possibly useful sometimes (?)
2024-08-16 16:15:13 +02:00
Martin Pulec
0092d0cc3a windows: print stacktrace in crash handler
added print_stacktrace_win

similarly to other platforms
2024-08-16 16:05:05 +02:00
Martin Pulec
50812bba34 replacing PACKAGE_BUGREPORT with bug_msg
Where the PACKAGE_BUGREPORT is the only used item from config.h,
use bug_msg(), which can be then removed.

Improved bug_msg() to allow printf-like fomat + arguments.
2024-08-14 15:26:12 +02:00
Martin Pulec
e154dfa294 rxrx/sdp: print URL only once + when no autorun
- print the direct RTP stream URLs only once (== do not repeat with
every printed address)
- print only if autorun was not specifiec
- take the IP version from the state
2024-08-14 11:28:11 +02:00
Martin Pulec
2535d66f25 rxtx/sdp: direct play url again print
Since the rtpmap line is now generated also for static packet types,
the condition must have been updated to check the packet type rather
than the presence of rtpmap line.
2024-08-14 11:28:11 +02:00
Martin Pulec
77deb0f1c0 h264_sdp, utils/sdp: improved including 2024-08-14 11:28:11 +02:00
Martin Pulec
b0704afb8e utils/sdp: do not repeat a condition 2024-08-09 09:23:01 +02:00
Martin Pulec
ecc8332359 sdp: add "video" to get_codec_from_pt_rtpmap name
get_codec_from_pt_rtpmap->get_video_codec_from_pt_rtpmap
2024-08-08 11:16:19 +02:00
Martin Pulec
8ddf95a497 sdp.c: fixed wrong PT for static PT PCMA/PCMU
fixed the commit f28371c2 (from 2024-02-05)
2024-08-08 11:16:19 +02:00
Martin Pulec
c5312812ec rxtx/sdp: print the supported codecs as well 2024-08-06 16:25:12 +02:00
Martin Pulec
1b03ad341a sdp: generate rtpmap even for static PT
Generate rtpmap lines even for formats with statically assigned PT  -
bluenviron/mediamtx does it as well and it is nicer, although not
necessary.

RFC 3555
2024-08-02 15:52:59 +02:00
Martin Pulec
1a570365df rtsp,sdp: prefer rtpmap codec over PT 2024-08-02 15:52:59 +02:00
Martin Pulec
ae10e2ca17 vcap/rtsp: accept JPEG without rtpmap= in SDP
JPEG uses static PT=26, which is sufficient for identification

UG currently doesn't produce rtpmap for static PT.
2024-08-02 15:52:59 +02:00
Martin Pulec
a0405b4d49 jpeg_reader.c: extend the complaint over FFmpeg
Although RFC 2435 supports YUV 422, it has to have sampling factors
h: 2,1,1 v: 1,1,1

FFmpeg built-in JPEG encoder generates h: 2,1,1 v: 2,2,2 and
it cannot changed (set by function ff_mjpeg_init_hvsample() in
libavcodec/mjpegenc_common.c).
2024-08-02 15:52:59 +02:00
Martin Pulec
2d42b12cfa rxtx/rtsp: support for JPEG 2024-08-02 15:52:59 +02:00
Martin Pulec
1a6ef2d808 utils/sdp: replace STR_LENGTH with STR_LEN
STR_LENGTH was very similar name to STR_LEN, even set to the same value
so replace its ocuurences simply by STR_LEN.

This also allows putting it to headers because the constant is public.
2024-08-02 15:52:58 +02:00
Martin Pulec
b506f66d62 vcap/rtsp: support JPEG
- added RFC 2435 JPEG decoder
- added JPEG interchange format writer (JFIF in particular)

Decode RFC encoded JPEG (abbreviated) and create a JFIF, which can be then
passed to further processing (decode in the end).

The testing JPEG stream played with bluenviron/mediamtx as defined in the
beginning of video_capture/rtsp.c can be now sucessfully played.
2024-08-02 15:52:55 +02:00
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