Commit Graph

357 Commits

Author SHA1 Message Date
Martin Pulec
edc39dbe90 set default audio ch count to 1 for RTSP/SDP
needed for SDP
2024-01-08 17:06:54 +01:00
Martin Pulec
6e637c37cb opt protocol: old protocol opts fixes
fixed legacy --video-protocol and --audio-protocol handling
2024-01-08 11:36:16 +01:00
Martin Pulec
40a7d04ec1 unit_evaluate[_dbl]: added endptr param 2023-11-29 15:27:32 +01:00
Martin Pulec
bfb7a1d232 removed no longer needed check_audio_codec 2023-11-29 14:58:16 +01:00
Martin Pulec
288b2c5804 refactor audio codec fmt parse
Should be almost functional equivalent as the previous version.
2023-11-29 14:58:14 +01:00
Martin Pulec
61cd13d3c6 add short opt -i for audio filter 2023-11-21 14:10:21 +01:00
Martin Pulec
fb0c6d5796 main usage: fixed short opts
- '-A' is now for audio codec; original is now --audio-host (without short opt)
- '-V' for verbose
2023-11-21 14:10:21 +01:00
Martin Pulec
6b12ca5231 write_all: take the fd as 1st arg
Make the function more universal by not writting implicitly to
STDERR_FILENO.
2023-11-13 16:48:22 +01:00
Martin Pulec
11fd6830be add opt --audio-channel-map shortcut -U 2023-11-06 13:28:18 +01:00
Martin Pulec
624b34f7bd screen win uninitialize elevated: do not coinit
For uninit, screen-capture-recorder-x86.dll calls CoInitialize(0) and
fails because it fails.

Curiously this doesn't occur for register, which should be equivalent.
2023-10-26 16:11:49 +02:00
Martin Pulec
06956f0544 print caught signal desc in verbose 2023-10-26 08:44:43 +02:00
Martin Piatka
a1ac44a2e2 holepunch: add bind_ip option 2023-10-06 14:00:48 +02:00
Martin Pulec
87e0c61416 renamed video_rxtx hdrs from .h to .hpp
clang-tidy doesn't like naming C++ headers with .h
2023-10-02 08:44:17 +02:00
Martin Pulec
afd0f217de signal_handler: ignore next SIGPIPE signals
We will end anyways and do not produce additional SIGPIPE on eventual output.
2023-09-19 13:34:11 +02:00
Martin Pulec
9e80a018fe main: handle also SIGPIPE
SIGPIPE signals may be delivered externally if user uses a named pipe
eg. as file capture input or file display output. We want to exit
gracefully in this case.
2023-09-01 13:50:57 +02:00
Martin Pulec
6735bcf6ab main: catch also out_of_range exception
catches eg. the case of int overflow:

`uv -s testcard -a ch=012345678901`
2023-08-07 16:38:00 +02:00
Martin Pulec
6780691b4e modernize playback APIs
modernized video display, audio playback and vo postprocess APIs

THe APIs were already recently updated so modernize it by using bool
where the return value is semantically boolean value. Using TRUE/FALSE is
inherently ambiguous because it is not obvious from the prototype if
success is 0 or TRUE (1).
2023-07-18 16:43:37 +02:00
Martin Pulec
d4d80de459 main: compat message for '-A'
Semantics of '-A' parameters has changed from audio receiver address
(distinct than video) to audio codec. It is, however, doubful if someone
uses it, but just in case.

This compat message could (and should) be deleted later.
2023-07-17 10:43:03 +02:00
Martin Pulec
fc491d02ec removed play/pause stuff
this stuff is no longer used (has been used by CoUniverse)
2023-06-29 16:30:30 +02:00
Martin Pulec
a5f3953168 shortopt for --audio-codec 'u'->'A'
'A' seems to be better but it was originally used by --audio-host. This
argument isn't supposed to be important and isn't perhaps used, anyways,
so use this and for the --audio-host keep only the long opt.
2023-06-20 13:37:48 +02:00
Martin Pulec
ca9948449b shortopts for --record/--playback
It is '-E' and '-I' (Export and Import; R/P not viable because 'P' is
already taken for port so the shortcuts won't be consistent then).
2023-06-20 13:37:46 +02:00
Martin Pulec
ea64814da6 main: added audio-codec shortopt
Most prospective shorcuts (A/C/a/c) were already takem, so using
'u' as in aUdio-codec.
2023-06-13 14:21:06 +02:00
Martin Pulec
a25b285e25 main: make audio cap opt relative to video
`-s` parameter now sets audio only to following video capture, just like
`-F` (capture filter) does.

This allows different setting for different audio connectors for
different video sources, namely for switcher, eg.:

    uv -t switcher -s analog -t decklink:device=1 -s embedded -t \
      decklink:device=2

refer to GH-318
2023-06-09 16:13:11 +02:00
Martin Pulec
4afc487dee main.cpp: use shortopts repl for deprecated opts
Print available shortopts when recommending replacement for deprecated
opts. With short opts, the new version is actually shorter than the
original (--audio-capture-channels -> -a channels), while with the long
opt (--audio-capture-format) it was not. Similarly for --rtsp-server.
2023-06-08 15:06:17 +02:00
Martin Pulec
3985fa3479 getopt_long: added postprocess
postprocess had only shortopt until now, add the long option for
consistency (there are still some, like -4/-6 that doesn't have its long
counterpart)
2023-06-07 15:51:36 +02:00
Martin Pulec
b05589f923 main: rxtx proto handling updated
- added 'x' shortopt for protocol (xfer)
- deprecate {--audio,--video}-protocol in favor of --protocol [A:|V:]
  (similarly to FEC)
2023-06-07 15:23:41 +02:00
Martin Pulec
04b4bf6599 parse_protocol: simplified 2023-06-07 15:00:29 +02:00
Martin Pulec
525b48f768 main: use parse_protocol 2023-06-07 14:51:58 +02:00
Martin Pulec
4a8e81dc05 main: added couple of shortcuts for common opts
- 'a' - audio-capture-format
- 'e' - encryption
- 'D' - cuda-device
- 'H' - fullhelp
- rtsp-server was set for long getopt value 'H' but was reused by
  fullhelp. It wasn't allowed as a short getopt anyways.
2023-06-07 14:43:24 +02:00
Martin Pulec
90b37ef574 main: sort getopt options
sorted to avoid duplicities (especially short opts)
2023-06-07 14:28:04 +02:00
Martin Pulec
5b91957c7d allow capture filter spec (-F) after single vidcap
When only one vidcap device given, allow capture filter specification
following the capture because it is unambigous.
2023-06-01 15:41:16 +02:00
Martin Pulec
aa24e65598 parse_options: ensure audio device given once
avoid unintended audio playback/capture devices given

refer GH-316
2023-05-31 12:21:08 +02:00
Martin Pulec
cb0f7feafc parse_port: fixed Coverity complaint
CID 407267

handle correctly vicious inputs like "-P :" or "-P 1:"
2023-05-10 08:52:02 +02:00
Martin Pulec
64688bb4c7 hd-rum-transcode: share signal callbacks with UG
The crash and freeze signal handlers may be useful also for the
reflector.
2023-04-28 13:12:35 +02:00
Martin Pulec
c9ba1d2260 main: fail if multiple displays given
UltraGrid cannot handle multiple displays anyways and since only the
last one is used, it is perhaps better to notice user on this error.

Also, user might have given something like '-d decklink:device=2' and
then '-d decklink', supposing that the second is correct but decklink
would use device #2, although it was given in first decklink setting
(opts are not overriden by the second decklink specification).
2023-04-28 10:15:11 +02:00
Martin Pulec
dc9f3f910a RTSP/SDP: disable interlaced dct for H.264 stream 2023-04-27 15:21:18 +02:00
Martin Pulec
d330520d59 SDP: refactor - use global state
Until now, `uv -s testcard --protocol sdp` didn't generate the SDP file
(nor output) because the all SDP state initialization was handled in
video_rxtx/h264_sdp.
2023-04-27 15:21:16 +02:00
Martin Pulec
48219758ea use Opus, not OPUS
For audio codecs, we respect its native capitalization of letters, eg.
AAC, speex. So do it also for Opus. This should not affect existing
applications since the Opus name is parsed case-insensitively.

Only exception is SDP (rtpmap) where is usually used lower-case (at
least in rfc7587).
2023-04-26 09:53:10 +02:00
Martin Pulec
1ed549df4a separated some common root mod handling to host.cpp
The management of should_exit events should be also be shared with the
transcoding reflector that uses some parts that may depend upon this
functionality.

This is not purely a refactorization but slightly changes behavior,
namely the shared state cleanup is done in a destructor, not by
`uv.stop()` as it used to be.

see GH-307
2023-04-12 16:35:55 +02:00
Martin Pulec
737a27270e FEC help: excess second %
perhaps a relict from printf printout
2023-04-04 16:33:07 +02:00
Martin Pulec
811938ed8c main: call regiesterd should_exit callback if exit
If registering a should_exit callback but should_exit has already been
broadcasted, it wasn't ever run, leading likely to a freeze.

Steps to reproduce the fixed problem:

    uv -t swmix:512:512:2 -t invalid

Fixed by immediately calling the registered callback if should_exit has
been already issued.
2023-03-31 14:16:47 +02:00
Martin Pulec
2317819400 CUDA: do not use gpujpeg for dev list
Query directly, without help from GPUJPEG (although the code is actually
borrowed from there).

This enables device listing also if GPUJPEG is not compiled in and it
simplifies main.
2023-03-30 14:01:10 +02:00
Martin Pulec
a3daa89ef6 displays: changed api for mainloop
- removed `needs_mainloop` attribute and deduce if mainloop is needed
  from the presence of _run callback (the information is now redundant
  only displays needing/running mainloop should announce _run callback)

- run the custom mainloop (currently only Syphon!) only when display
  doesn't run its mainloop. This allows running Syphon and GL/SDL
  display because it connects to the display mainloop.
2023-03-29 13:39:48 +02:00
Martin Pulec
449251ac3e get rid of global should exit variable 2023-03-24 14:06:50 +01:00
Martin Pulec
03c7d5043f parse_bitrate: fixed parsing of spec vals
fixes 03f70eade

closes GH-300
2023-03-07 08:27:15 +01:00
Martin Pulec
de91c41a14 optstring: added missing letter 'F' (capture filter) 2023-02-28 16:17:36 +01:00
Martin Pulec
d04fff8c9e main: catch stoi exceptions
Using short getopt options, a user may make a mistake in parameter name
resulting in passing a non-numeric string to stoi, which leads to crash
on not-nice uncaught exception crash.

+ remove try/catch from parse_port (no longer needed due the above)
2023-02-28 16:17:36 +01:00
Martin Pulec
0f12915298 main.cpp: unnecessary TTL check
the RTP library does the check as well
2023-02-27 10:40:17 +01:00
Martin Pulec
98805677eb --conv-policy help - improvements 2023-02-23 09:06:49 +01:00
Martin Pulec
fa062a3fee port parsing: be more user friendly
- catch stoi invalid_argument exceptions for non-numeric input
- on 'help' redirect user to UG main --fullhelp
2023-02-17 11:09:29 +01:00