Commit Graph

614 Commits

Author SHA1 Message Date
Martin Pulec
724eaff424 parse_mtu: additional checks
Added additional number validitiy check (to newly created parse_number
function). Mainly to cover inputs like '1something'  where it should
not be parsed correctly as being 1.
2025-03-17 15:54:45 +01:00
Martin Pulec
fd0771c9c6 prettier audio printout
- just 2 decimal points for secs
- print aggergate sample count with thousands delimiter
2025-03-17 15:51:17 +01:00
Martin Pulec
e0dd01ccaf CoInitializeEx: use COINIT_APARTMENTTHREADED
PortAudio/ASIO drivers seem refuse initialization if
CoInitilizeEx initialized as COINIT_MULTITHREADED but they do for
COINIT_APARTMENTTHREADED.

Windows devices that could be affected by this change tested and seem
to work, namely:
- DeckLink
- DirectShow
- WASAPI

refer to GH-430
2025-03-07 13:26:17 +01:00
Martin Pulec
abc30c2be9 PAM: rename depth to ch_count
The depth (DEPTH field of PAM) is actually channel count, which may be
slightly misleading - use rather ch_count instead.
2025-02-18 16:58:08 +01:00
Martin Pulec
b44af19782 audio sender: use colors for sample cnt summary 2025-02-11 12:59:03 +01:00
Martin Pulec
16d41e8a5d aplay/mixer: restricting senders - check err
also workarounds for CIDs 47049{6,7}
2024-12-04 16:17:03 +01:00
Martin Pulec
e88ad545bc net_udp: enforce v4 sock only for mac+mcast+iface
No longer enforce v4 socket for dot-decimal IPv4 mcast addresses unless
macOS used with mcast4 addr and interface set.

The default behavior now is to use dual-home v6 socket (with v4-mapped
addresses). macOS treates the v4 mcast addresses transparently as
v6 addresses (using v6 sockopts). But interface specification doesn't
currently seem to work in macOS, neither for native v6 mcast addresses
so enforce v4 sockets here.
2024-12-04 15:21:00 +01:00
Martin Pulec
d1023bdccb net_udp: multicast: multiple improvements
- support for v4-mapped IPv6 sockets (handled with v4 sockopts in
Linux+Win and v6 sockopts in macOS)
- for mcast4, except of Windows, the interface must be identified by
local address, not device number
- support also setting the bind address directly for v4
- leave mcast4 group with correct ID (not INADDR_ANY)

The local address interface specification was actually the original one
but was removed by the commit 92e24dd02 (in 2012).
2024-12-04 15:20:56 +01:00
Martin Pulec
b99c8c1300 utils/net: suppress alignment warning 2024-12-04 14:06:52 +01:00
Martin Pulec
d90d2836ec sockaddr_compare: handle v4-mapped sockaddr_in6
Current implementation of resolve_addrinfo defaults to v4-mapped ipv6
addresses even for dotted decimal.
2024-11-28 12:05:11 +01:00
Martin Pulec
9fd68d6447 aplay/mixer: factor out sockaddr_compare 2024-11-28 12:05:11 +01:00
Martin Pulec
273f6d3c1d add get_sockaddr + tests
to convert textual representation of host:port to sockaddr

having this new function, we can also test get_sockaddr_str
2024-11-28 12:05:11 +01:00
Martin Pulec
950f3dc6a4 get_sockaddr_str: obtain IPv6 scope ID
write the IPv6 link-local address with scope ID

This is achieved by using getnameinfo instead of inet_ntop.

Also rewritten in respect to the above change - simplified, no need to
get the port number separately (getnameinfo does that as well).
2024-11-28 12:05:10 +01:00
Martin Pulec
16e647c65a hd-rum-translator: use get_sockaddr_str()
get_sockaddr_str is used also for create-port in the "dynamic" conference
mode, so this is perhaps better because the calls are symmetric.

Also it will allow eg. to add scope ID later to both create- and
delete-port in the single call.

get_replica_mod_name() is kept for the old/static use cases when
create-port is called explicitly or from an argument on command-line. Then
the address can be also the hostname (or a IP addresss in non-canonical
form) and it is up to the user to use the same host:addr representation.
2024-11-28 12:05:10 +01:00
Martin Pulec
abd758241a debug: move some stuff to utils/debug
The rationale is to separate the config.h-dependent stuff to a separate
file to eliminate the need to transitively include config.h.

+ fix the files that need config.h directly to include it
2024-11-28 11:46:09 +01:00
Martin Pulec
d4e216e21c aplay/mixer: participant add/rm print fixes
- do not print it in constructor/dtor - the participant may be moved
- copy the stored address in copy constructor
- use get_sockaddr_str + change its prototype - do not use thread_local
vars but user provided buffer
- also take (const sockaddr *) in the get_sockaddr_str and
get_sockaddr_addr_* functions (participants iterated by const iterator
returning const participant reference)
2024-11-13 17:00:10 +01:00
Martin Pulec
225fbc8ea1 aplay/mixer: print participant add/rm 2024-11-13 14:52:28 +01:00
Martin Pulec
8b33b1e058 vcap/rtsp: create fallback file in $TMPDIR
If running with Firejail, neither /tmp (used by tmpfile()) nor CWD may
be writable so try to create file in $TMPDIR (if defined, otherwise
there a default).

+ modified get_temp_file() opened file mode to be readable
2024-10-31 10:58:47 +01:00
Martin Pulec
328dd443fc get_temp_file: allow NULL for output filename 2024-10-31 10:58:47 +01:00
Martin Pulec
72ac724fb1 correct color names
The actual value (5,2,1)/5 didn't match peach fuzz (255,190,152)/255
but the rather closest color is Tomato (255,99,71)/255.

The T_DARKER_ORANGE is poorly defined but its value (3,1,0)/5 matches
approximately the X11 color Saddle Brown (139,69,19)/255.
2024-10-21 10:55:27 +02:00
Martin Pulec
3d0cf25ab9 jpeg_reader: check comp_count validity
+ piggyback switch error msg from verbose (it will fail so the error
just in verbose doesn't make much sense)
2024-10-15 16:20:06 +02:00
Martin Pulec
91819d289d jpeg_reader: read_adobe_app14 fix
the terminating NUL byte was not read - the tag is 'Adobe\0'

+ mark length as const as it won't change later
2024-10-15 16:13:44 +02:00
Martin Pulec
47b1b8c871 jpeg_reader: bound-check all marker read fns 2024-10-15 16:13:44 +02:00
Martin Pulec
e102b79600 jpeg_reader: replaced read_marker
replaced old read_marker with bound-checking (former) read_marker_new
2024-10-15 16:13:44 +02:00
Martin Pulec
9531c04a23 jpeg_reader: sanitize input
Sanitize incorrect marker lengths for SOS and SOF0 as reported by Coverity
CID 469656. Utilized image_end sentinel as in GPUJPEG.
2024-10-15 16:13:37 +02: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
b9c012737f jpeg_reader: add additional SPIFF CS
Add all color space parameter specifications from T.81 - map known ones,
add commented-out case for the rest.
2024-10-09 15:08:52 +02:00
Martin Pulec
f2d2fcdb8d jpeg_reader: support for spiff pictures
+ hint for GPUJPEG to set limited 601
2024-10-09 15:08:52 +02:00
Martin Pulec
5471e80497 removed MJPG codec_t
Remove MJPG codec_t which was complementary to JPEG. The difference was
that JPEG was used for JPEG with restart intervals and MJPG without.

But slices are now enabled for MJPG (emits reset marker every 16 lines)
which actually gives the GPUJPEG decoder a space for efficient decoding.

Measured decoding performance using Ryzen 7900X and RTX 4080:

NewZealand (UYVY, 3840x2160, frame 2500):

  encoded by\decoded by  GPUJPEG  lavd
  -c libavcodec          7.1 ms   19 ms
  -c gpujpeg             1.35 ms  14.3 ms

-t testcard:s=3840x2160:patt=text

  encoded by\decoded by  GPUJPEG  lavd
  -c libavcodec          2 ms     40 ms
  -c gpujpeg             25 ms    40 ms

The advantage is simpler maintanance (no need to handle 2 codec
identifiers) and also performance because from the above, the  GPUJPEG
decode should be faster even for JPEGs encoded by lavc.

Only situation where lavd performs better is a stream without restart
intervals at all (either `-c lavc:slices=1`, `-c gpujpeg:r=0` or from
a webcam), let say 28 ms for lavd and 40 for GPUJPEG. But it is not worth
keeping it for such a case - it will be better implemented using struct
pixfmt_desc to return rst count and picking the decoder according to
this if really needed.
2024-10-08 12:32:02 +02:00
Martin Pulec
bdce8d7ae8 tools: add ug_stub.c to substitute host.cpp
Because host.cpp has extensive dependencies on UG internals, it is a
bit tricky to link-in. Created a replacement instead.
2024-09-30 11:07:37 +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
707e4af458 get rid of WORDS_BIGENDIAN
WORDS_BIGENDIAN is defiend by config.h

Use __BYTE_ORDER__  defined by GNU compilers (POSIX 2024 further defines
endian.h header but not yet in macOS /15/),
2024-09-26 14:36:42 +02:00
Martin Pulec
70e169db3f utils/misc: improved including 2024-09-18 14:35:48 +02:00
Martin Pulec
3c9e260240 vdisp/sdl2: enable R10k
Seem to be working now (but requires a byte swap for the R10k pixels
values).

refer to GH-412
2024-09-18 14:34:57 +02:00
Martin Pulec
95ae4c0616 invalid_arg_is_numeric: handle also macOS
std::invalid_argument::what() returns in macOS the string:
"stoi: no conversion"
2024-09-13 15:35:44 +02:00
Martin Pulec
ef0cd7130d unify stod/stoi invalid_argument::what parse
This is a hack to check whether given invalid_argument message belongs
to stoi/stod. It is usually used to catch non-numeric user input where
a number was expected.
2024-09-13 15:35:44 +02:00
Martin Pulec
0a8467b01f vcomp/cmpto_j2k: print opt hint in help
+ use unit_evaluate_dbl (instead of unit_evaluate) - **also** in decompress
2024-09-12 16:35:57 +02:00
Martin Pulec
52b9ed2554 testcard/pattern: rename pixel_bars to strips + w=10
Renamed pixel_bars to strips - the original name is not much descriptive -
pixels indicated 1 pixel width, which is not necessarily true, bars
(=vertical) isn't the default mode. Also not much distinctive (there
are other "bars").

Set also the default width to 10 - actually, the original width 1 is
better for troubleshooting compressions etc. But 10 is a visually more
appealing as a default and for the original use, the with can be set
explictily.
2024-09-04 11:58:17 +02:00
Martin Pulec
3a4c13f2d1 testcard/pattern/pixel_bars: add white/gray/black
may help in some troubleshooting
2024-09-04 11:56:20 +02:00
Martin Pulec
fe77b42a1e testcard/pattern/pixel_bars: added strip width opt 2024-09-04 11:08:12 +02:00
Martin Pulec
33675df8f6 pattern pixel_{rows,column}: add diagonal+rename
- added diagonal variant
- rename to pixel_bars again (we now have 3 flavors, but are related).

vertical/horizontal/diagonal is now an option
2024-09-03 16:41:49 +02:00
Martin Pulec
6e42db0bed image_pattern_pixel_bars: allow also rows
+ bars rename to columns
2024-09-03 14:54:56 +02:00
Martin Pulec
66e7b23f2c video_pattern_generator/interlaced: check width 2024-09-03 14:54:56 +02:00
Martin Pulec
c9aef86c40 video_pattern_generator/interlaced: alloc inc MAX_PADDING 2024-09-03 14:54:56 +02:00
Martin Pulec
0e7b990d2b video_pattern_generator usage: reformat
as the number of of patterns grew, it became a bit messy
2024-09-03 14:54:56 +02:00
Martin Pulec
0466ef87a8 video_pattern_generator: new pattern pixel_bars
makes the bars as the default pattern, but width is set to 1 pixel
(and repeated).
2024-09-03 14:54:56 +02:00
Martin Pulec
cc6b820db2 vcomp/cmpto_j2k, pool: alloc extra data
padding for conversions
2024-09-03 14:54:21 +02:00
Martin Pulec
0df55a477f testcard/pattern=blank: print inline help 2024-09-03 09:14:15 +02:00
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