Commit Graph

151 Commits

Author SHA1 Message Date
Martin Pulec
735c4fb1d2 logging: override env with param
Set verbose according to ULTRAGRID_VERBOSE parameter only if no
verbosity was given from command-line (otherwise '-V' would mean
'debug').
2022-09-23 11:10:32 +02:00
Martin Pulec
b1f0e004f4 fixed new Coverity bugs
Fixed some of (easy) newly detected Coverity bugs. Those are mostly
innocent ones (performance) and not new (detected because of new release
of Coverity).
2022-08-22 09:57:16 +02:00
Martin Pulec
a9bc710a73 respect ULTRAGRID_VEBOSE environment variable
Previously it was errorneously checked while setting log level from the
command-line opt. If no was given, the particular function was not run.
2022-08-17 17:24:35 +02:00
Martin Pulec
0b8cc39f9c removed perf tool
It was almost never used since added.
2022-08-17 17:24:34 +02:00
Martin Pulec
128150288b logger: removed preinit
no longer needed to initialize rang here
2022-08-10 10:00:07 +02:00
Martin Piatka
213ce5e20f output buffering: Disable buffering in GDB
Since the style reset escape codes are generally after the newline, the
otput of GDB would stay colored without this change
2022-08-09 11:48:58 +02:00
Martin Piatka
e0245aeda5 host,keyboard_control: Move gdb detection to a function 2022-08-09 11:48:58 +02:00
Martin Piatka
d1fbb7cb34 output buffering: Set _IONBF for stdout on WIN32 in all cases
Setting line buffering does not appear to work correctly on Powershell nor
cmd.exe and instead behaves like full buffering (lines do not appear
util flush).
2022-08-03 14:09:17 +02:00
Martin Piatka
65d7cf69b8 logging: Split timestamp and repeat functionality into its own class
This will eventually allow better integration with other formatting
functions like color_out, color_printf
2022-08-03 10:41:14 +02:00
Martin Piatka
d18fb0300e logging: Call preinit before parsing log config
Since help text containing ANSI escape codes can be shown during parsing
(i.e. on error or help text), preinit should be called sooner
2022-07-29 13:03:28 +02:00
Martin Piatka
e1b51bda18 logging: separate config parsing from setting log level 2022-07-29 13:03:27 +02:00
Martin Piatka
07f245c5ec logging: Use enum for timestamp mode 2022-07-29 13:03:27 +02:00
Martin Pulec
d8e9f5bd5c Set _IONBF for stdout in MSYS term
This partially reverts d4775e37 which changed the output buffering from
_IONBF to _IOLBF.
2022-07-27 09:05:55 +02:00
Martin Pulec
9e10a385b6 color_out: new API
Use inline ANSI escape sequences instead of modifiers.

This allows more convenient formatting without the need to use multiple
calls (possibly interleaving).

ANSI escape sequences are nowadays supported also in Windows terminals
(PS, cmd).
2022-07-27 09:05:55 +02:00
Martin Pulec
309973738f parse_params: do not modify optarg
Since parse_params is now run twice, subsequent call must not be influenced by
the first run (in particular the parameter optarg).
2022-07-19 09:19:32 +02:00
Martin Pulec
9cf14ef683 parse_params: fixed validation
Validated parameter was not "<key>" but "<key>=<val>".
2022-07-19 09:11:07 +02:00
Martin Pulec
e561e45933 Fixed "--param" handling
The parsing was done early before dynamic modules that export own
parameters were loaded.

Now, the parsing is done in 2 steps -- first scan only for already known
parameters (output buffer settings is needed for preinit), ignore
"help".

The second step is to do the full parse (in main), when there are all
modules loaded (latter in common_preinit()).

Fixes #237.

The regression was introduced by 1dc89920.
2022-07-18 10:32:43 +02:00
Martin Pulec
1d30604a7a parse_params: optarg must not be NULL - don't check 2022-07-18 10:15:58 +02:00
Martin Pulec
b8766991ae host.{cpp,h}: make some param-related funcs static
Marked some param-related functions as internally linked.
2022-07-18 10:12:00 +02:00
Martin Pulec
5ce89a2dc9 host.cpp: validate parameters before assign 2022-07-18 10:08:23 +02:00
Martin Pulec
727841f3bc set_output_buffering: small improvements
- show usage with "help"
- print error if setvbuf fails (but do not return an error - there may
  be some platform problem but the setting is done always, so it would
  unconditionally prevent UltraGrid from running)
- if usage error (or help) occurs, exit UltraGrid
2022-07-01 15:22:54 +02:00
Martin Pulec
67c4bad83b param help: added usage warning
--params should not be considered a part of standard options provided to
users but rather a developer/expert mode.
2022-07-01 14:49:56 +02:00
Martin Pulec
1dc899209d set output buffering early
setvbuf() should be called on a stream prior to any operation with the
stream. Previously it was to late -- it was even after configuration
summary was printed to stdout.
2022-07-01 14:49:32 +02:00
Martin Pulec
8e1369f21f setvbuf: set size=BUFSIZ
The value 0 is mentioned in man setvbuf(3) and indeed glibc
implements setlinebuf as:

    _IO_setvbuf (stream, NULL, 1, 0);

However, except the mention in manual page, this extension doesn't seem
to be anywhere mentioned (not clear if valid with _IOFBF) and it is not
widespread except glibc, since [1] forbids that. Also using _IOLBF+0
behaves in the same way as _IOLBF+BUFSIZ (buffers BUFSIZ bytes).

[1] https://www.ibm.com/docs/en/i/7.1?topic=functions-setvbuf-control-buffering
2022-07-01 09:29:18 +02:00
Martin Pulec
d4775e375e output buffering: set explicitly
Set output buffering to "line" for stdout and "no" for stderr. This is
the case usually but not always (eg. MSYS, GUI console) so make this
explicit to be deterministic.
2022-06-30 16:41:40 +02:00
Martin Pulec
0e900170b5 glfw_init_count: improved documentation 2022-06-29 09:34:04 +02:00
Martin Pulec
1a31999f1a utils/misc: split to misc and macros.h
Some macros are quite common so it is perhaps more wise to use a
separate header.

Also moved ref_count_init_once and ref_count_terminate last to misc.h.
2022-06-06 11:06:06 +02:00
Martin Pulec
89be4a70ef GL,NDI: experimental support for HDR 2022-06-06 11:06:01 +02:00
Martin Pulec
03c024309f GLFW: allow multiple instantiation
For now, use reference counting without any synchronization -
glfwInit/Terminate should be called only from main thread, anyway.
2022-06-01 11:22:01 +02:00
Martin Pulec
5d68388c16 host.cpp: use VIDEO_CODEC_FIRST inst. of magic 1 2022-05-26 10:53:12 +02:00
Martin Pulec
9743625c80 codec, pixfmt listing: added legend 2022-05-26 09:07:28 +02:00
Martin Pulec
57d240dc76 always compile mtrace hooks [Linux]
Unless MALLOC_TRACE environment variable is set, no hook is installed
and the calls have no effect. On the other hand, if we compile it
unconditionally, it can be used without need to recompile UltraGrid.
mtrace(), however, doesn't seem to be much helpful (compared to eg.
valgrind).
2022-05-13 15:32:59 +02:00
Martin Pulec
73c4b13895 Win MSYS2: disable output buffering by default
This looks to be more reasonable - user may not know that s/he actually
wants to set it. The thing is that this may be needed only for stdout -
user than doesn't detect that some output is missing.
2022-05-10 14:49:57 +02:00
Martin Pulec
fdfac34546 x11_error_handler: print stacktrace 2022-05-10 11:16:18 +02:00
Martin Pulec
0275d4e669 register_param: warn if max params reached 2022-05-02 16:12:25 +02:00
Martin Pulec
49eb5219a0 register_param: skip repeating registr. of param
Skip repeating registration of the same parameter.

This allows registration of the param from within more modules (eg.
common file included in multiple plugins). Warning is issued if already
registered param has a different description.
2022-05-02 16:12:25 +02:00
Martin Pulec
0de3402090 Do not load modules for run_tests
Modules are linked statically even for the modular build to test
executable.

See 1386ffe5
2022-03-18 08:52:32 +01:00
Martin Pulec
ae17f406e7 audio/video_offset: document vars 2022-03-04 16:27:49 +01:00
Martin Pulec
a6f80ec2dc common_preinit: Win - set output as UTF-8 2022-01-14 15:53:41 +01:00
Martin Pulec
31721d9200 parse_auduio_capture_format: be more user-friendly
- allow also comma as a delimiter (WLOG - comma cannot be part of
  current set of options)
- print token, that is not understood
- hint that "bps" must be in bits-per-second (% 8 = 0)
2022-01-06 13:56:48 +01:00
Martin Pulec
237f2becfe moved parse_audio_capture_format() to host.cpp 2022-01-06 13:56:48 +01:00
Martin Pulec
7add441e60 Updated version color to bright_blue 2021-11-09 10:43:08 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
2e13a04dff Key control: print version
May be used for quick check if not running an obsolete UG during
runtime.
2021-11-01 09:20:44 +01:00
Martin Pulec
940399988a Lavd: option to dump decompressed frame 2021-10-22 09:21:52 +02:00
Martin Pulec
3b6a1dd160 main: decouple verbosity parsing to host.cpp 2021-07-09 10:20:13 +02:00
Martin Piatka
eab94c12c0 Remove some unused includes
Removes some unused includes reported by include-what-you-use
2021-06-08 15:22:25 +02:00
Martin Pulec
f8fd2f872e Logger: option to enable/disable timestamps 2021-05-26 16:15:39 +02:00
Martin Pulec
bb1405fad3 Added hint to disable output buffering in MSYS terminal 2021-05-21 13:43:56 +02:00
Martin Pulec
986606f1e7 Renamed error() to handle_error()
to avoid clashes with GNU function error()
2021-05-13 09:08:26 +02:00