Commit Graph

410 Commits

Author SHA1 Message Date
Martin Pulec
fa3f5f6d0a main: make also MOD_NAME and PORT_BASE constexpr
Also remove static and const from DEFAULT_VIDEO_COMPRESSION and
DEFAULT_AUDIO_CODEC:
- pointer to const char -> can be turned to constexpr char array,
where constexpr implies const
- static unnecessary - const (implied by constexpr) objects have implicit
internal linkage in C++ (differs from C)
2026-01-02 16:00:31 +01:00
Martin Pulec
88e9cf207b main: make multichar cmdline opt values constexpr
this will eg. allow the compiler to detect unused vars

+ removed the unused MAX_CAPTURE_COUNT (detected when made constexpr as
the opt vals)
2026-01-02 16:00:31 +01:00
Martin Pulec
72b496469f uv executable: add control-port shortopt 'n'
To be compatible with hd-rum-transcode that already has that shortopt.
2026-01-02 16:00:31 +01:00
Martin Pulec
ff62efd4ed main,audio: utilize PTHREAD_NULL
to simplify (no need for separate bool)

In main, there were additional conditions to join - perhaps unneeded
(legacy?) -> removed. If it causes problems, it can be readded.
2025-11-21 15:46:37 +01:00
Martin Pulec
ba0d897c50 replace vidcap_params_set_capture_filter with _add_
Improves the commint 4682cf65 (2024-08-19) allowing also the capture
filter to be specified both before and after the vcap (if only one
used), eg.  `-F flip -t testcard -F mirror`.
2025-11-14 10:35:04 +01:00
Martin Pulec
af1f6e493c usage: remove exec_path parameter
Unneeded, ug_argv and ug_argv[0] already set so the nullptr check is
also unnecessary.
2025-11-10 15:56:21 +01:00
Martin Pulec
8c0a79cba6 main usage: fix GCC 15 warning
fix the warning:
```
/usr/include/c++/15.2.1/bits/new_allocator.h:172:66: warning: ‘void operator delete(void*, std::size_t)’ called on pointer ‘__result’ with nonzero offset 32 [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
```

full warning:
<https://gist.github.com/MartinPulec/976f020990831e40de4dc206f2cebf30>

Most likely false positive.
2025-11-10 15:56:05 +01:00
Martin Pulec
763089ed57 main: valildate some params
Issue a warning eg. when -c option used without -t, in which case the
compression does nothing.  This avoids either omitting an option by
mistake (here `-t`) or vice versa passing an extra parameter (either by
accident or not knowing that not usable in the context).
2025-09-16 15:30:11 +02:00
Martin Pulec
bc05c72e0d main: IWYU 2025-09-16 15:29:48 +02:00
Martin Pulec
cc336eb38d main: --cuda-devices help suppress err
avoid printing 'Input number help contains non-numeric symbols!' (missing
return)
2025-06-24 08:42:47 +02:00
Martin Pulec
99588ababe remove module.deleter 2025-06-17 12:35:38 +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
594e3f06db vcomp/cmpto_j2k: print cuda devices in help 2025-05-28 09:11:47 +02:00
Martin Pulec
952a993c7a main: removed execinfo.h include
originally needed for backtrace() stuff that has moved entirely to host.cpp
2025-04-14 15:44:11 +02:00
Martin Pulec
c5628a5a38 main: fix CID 480348
introduced by 0ccf0f24 (2025-04-10)
2025-04-14 15:44:10 +02:00
Martin Pulec
0ccf0f2461 main/parse_cuda_device: validate
Validate the number, eg. `--cuda-device list` (instead of "help") now
triggers error.
2025-04-10 16:16:54 +02:00
Martin Pulec
e41ab00ac6 parse_mtu: erase '!' before parse_number call
Do not pass number with trailing '!' to parse_number, which would
refuse it.

fixed GH-438
2025-03-28 08:47:47 +01:00
Martin Pulec
b09636241d main: mk fun adjust_ports from adjust_param
Separated adjust_ports() from adjust_params - the stuff is a bit complex
now, so use rather separate function that encapsulates the tweking.
2025-03-27 08:03:40 +01:00
Martin Pulec
159f687c90 respect the selected port if sending over loopback
`uv -t testcard -d gl -P 5004` didn't select the port 5004 until now
2025-03-27 08:03:26 +01:00
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
84c3e5571d MTU size check: improved
Do not use positional references to printf format string, which is a
POSIX extension and not supported by Windows C library.

+ write the optarg string (in case that is only partionally parsed -
atoi stopped at first non-number)

refers to GH-437
2025-03-17 15:51:20 +01:00
Martin Pulec
850138ab59 set ug_options.audio.codec_cfg=nullptr
The commit b785c3d8 from 2024-08-05 changed the default unconditionally
to PCM, but this has been true just for UltraGrid RTP, not RTSP or SDP
that used MP3, so this change reverts it back.
2025-03-06 10:59:26 +01:00
Martin Pulec
4a085c6c6c vrxtx/rtsp: allow compressed stream passthough
If the input is already compressed, try to pass it further. Initialize
the compression just if receiving uncompressed data.

This is implemented in the same way as it already is in vrxtx/sdp.

refers to GH-433
2025-03-05 16:09:05 +01:00
Martin Pulec
924453e5b0 use get_stat_color also for FPS
select the color automatically (lime for +- 2-5%, brown for >5% diff)

This simplifies the code by sharing the logic in common; also exceeding
FPS is now colored (until this just lower than nominal was colored).
2025-02-11 14:19:11 +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
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 Piatka
4682cf6506 main: Allow multiple --capture-filter options 2024-08-19 14:38:12 +02:00
Martin Pulec
5f90324328 tx: pass parent in common_opts 2024-08-13 12:59:51 +02:00
Martin Pulec
41b0388624 rtsp server: fixed audio props
Do not deduce audio properties from command-line parameters but from
the actual format that is being to sent.

Until now, the properties like ch_count and sample rate was deduced from
command-line parameters (ch_count from `-a channels=` and sample rate from
`-A xxx:sample_rate`). However, this is a bit fragile - the source may not
respect the `-a` parameters and also the `-A sample_rate` doesn't need
to be set, like in the following case:
```
uv -x rtsp -A A-law -a sample_r=8000 -s testcard
```

Here the capture sample_rate is set to 8000 but not parsed from parameters
(it must have been in `-A`). So SDP parameeters for RTSP was set
incorrectly (48000).
2024-08-09 09:22:59 +02:00
Martin Pulec
78f2a30f12 main: set audio data always
The audio state is always present (even if no audio rx/tx is used),
so set this always.

This will allow setting the data also for tx (the vrxtx) - the check if
either audio tx or rx is unnecessary (as indicated above).
2024-08-09 09:22:59 +02:00
Martin Pulec
0d143d3789 main: pass video_rxtx pointer to audio
will be used to register actual audio format for RTSP
2024-08-09 09:22:59 +02:00
Martin Pulec
e75d1f2591 renamed rtsp_types_t audio and video
renamed to rtsp_type_audio and rtsp_type_video

Although not causing probles by now, the name itself (which is as a
part of unscoped struct global) is very common so it could have caused
conflicts in future.
2024-08-09 09:22:58 +02:00
Martin Pulec
c637644b72 vrxtx/ihdtv: use argc/argv from global option 2024-08-09 09:22:58 +02:00
Martin Pulec
44e4946b22 main: removed unused rxtx param a_tx_port 2024-08-09 09:22:58 +02:00
Martin Pulec
603a0c39a3 audio_register_display_clks: use struct for params 2024-08-09 09:22:58 +02:00
Martin Pulec
1ab725d575 moved some common transmission opts to struct 2024-08-09 09:22:55 +02:00
Martin Pulec
b785c3d845 audio_options: do not duplicate def initialization
It should be either in audio/audio.h or main.cpp but not both because
it is unclear which will be used in the end.
2024-08-08 11:16:19 +02:00
Martin Pulec
9a2c632d16 removed av from enum rtsp_types_t
use rather the bit sum of `audio | video`
2024-08-06 16:25:12 +02:00
Martin Pulec
ea958702ea rtsp_utils: fixed a typo (rtSP instead of rtPS) 2024-08-06 16:25:12 +02:00
Martin Pulec
1efc15cfa0 main: print exception errors with logger
The problems are definitely fatal if caught on top-level.
2024-08-02 15:52:58 +02:00
Martin Pulec
5c48277b10 BasicRTSPOnlySubsession: basic support for IPv6
\+ do not force IPv4 for RTSP
2024-07-19 12:03:27 +02:00
Martin Piatka
ef8c7d4993 main: Allow multiple --audio-filter arguments 2024-07-16 12:44:39 +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
f379547fce main: capture_thread: early return if tx_frame==0
just a refactor, no functional change

\+ the same in print_fps()
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
4d82b59bb3 parse_bitrate: use also for hd-rum-transcode 2024-05-13 12:56:52 +02:00
Martin Pulec
cf2314de28 uv: make some shortopts as in hd-rum-transcode
to be consistent
2024-05-13 12:56:51 +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
84a9083c7b fixed video RX port explicit setting
Fixed the commit cb0f7fea (2023-05-09) which caused that -P <vrx>:<vtx>
didn't set the video bind port.
2024-04-18 12:37:56 +02:00