Commit Graph

78 Commits

Author SHA1 Message Date
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
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
4e13bc903c add MSG_ONCE
refer to GH-411
2024-10-08 12:31:59 +02:00
Martin Pulec
06a3ca6081 debug_dump: early return
Currently, if log_level isn't at least DEBUG, nothing will be printed,
anyways.
2024-09-03 16:41:51 +02:00
Martin Pulec
5aa5261dda debug_dump: improved printout
- use 'h' suffix when len printed in hexa
- for missing bytes at the end (not aligned to 16 B) print 2 spaces
instead of 1, because it stands for 2 nibbles. Otherwise the ASCII
representation would be moved left (the muber of chars didn't match).
2024-09-03 16:41:51 +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
220e8b4744 replace BUG_MSG with bug_msg() fn
used just in DirectShowGrabber
2024-08-14 10:42:01 +02:00
Martin Pulec
9ab54fde00 debug_dump: overflow fix
The printout includes pointer, which was at the time of writting supposed
to be 32, in which case the line length was:

2 /* 0x */ + 8 /* ptr */ + 1 /* : */ + 3 * 16 /* " XX" */ + 16 /* char repr */ + 5 /* additiona separators */ + 1 /* NL */ = 81

(separators - 2 betweeh group of hexa and char repre, 3 between hexa and char represenatation)

With 64 bit pinters, it can be at most 89 bytes. To keep the old length,
removed one space between every pair of hexadecimal byte representation -
it is still good legible, compatibile with xxd, still keeping the 80
long line..
2024-07-19 12:03:49 +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
fea0d10f67 improved UG FFmpeg logger
do not prefix messages not starting on new line by timestamps, eg.:

    $ uv -s embedded -t testcard -d file:n=/dev/null -V
    [1698853041.393] [lavc]   Stream #0:0[1698853041.393] : Video: rawvideo, 1 reference frame (UYVY / 0x59565955), uyvy422, 1920x1080 (0x0), q=2-31, 829440 kb/s[1698853041.393] , [1698853041.393] 25 tbn[1698853041.393]

Flush the output only on NL and before it store it in internal
thread-local buffer.

Locking was removed as static data are now thread-local.

this improves 808b3de3
2023-11-01 17:01:31 +01:00
Martin Pulec
16fa09eebc debug-dump: print usage with "help" 2023-10-06 08:07:20 +02:00
Martin Pulec
d17c5ea24c removed platform_time.c + references
get_time_in_ns() should be used instead time_since_epoch_in_ms(). Having
both may be misleading and may lead to errors when interchanged.
2023-08-08 15:32:29 +02:00
Martin Pulec
7157b102a4 debug.cpp: fixed error in debug_file_dump
Not critical at all - the comma-separated option could not have been
used so far (it was intended to separate modules, but this funcion is
used in only one so far).
2023-05-10 08:52:01 +02:00
Martin Pulec
be4659469b log_msg_once updates
use static, not thread_local storage

This has an implications that the message is indeed printed once, even
though is called from 2 threads (this can happen eg. when printed once
during normal operation and then during module deletion, that may happen
in a different thread).
2023-04-24 13:50:33 +02:00
Martin Pulec
eb63ea9d37 log_vprintf: append TERM_RESET only if needed
It hasn't hurt but it is an extra work and there is no need to issue
clearing esc if no formatting was changed.
2023-04-12 12:52:41 +02:00
Martin Pulec
653cec55ab log_vprintf: return void instead of int
The returned value was actually incorrect (counting also formatting
escape sequences and terminating nul byte).

Since the return value should not be important for the caller, it is
perhaps better not to complicate and don't return anything.
2023-04-12 12:52:08 +02:00
Martin Pulec
c3b19d25da removed needless check/store of vsnprintf ret 2023-04-12 12:52:08 +02:00
Martin Pulec
602095e38a fixed some further snprintf warns
fixes warnings with Xcode 14.3 as in previous commit

+ allocate +1 in Log_output buffer - snprintf(MULL, 0...) returns number
  of bytes without terminating '\0'. std::string storage isn't guaranteed
  to be NULL-terminated (std::string("").at(0) throws an exception). The
  buffer is somewhere preallocated 256 which prevents problem but it's
  better not to rely upon it.
+ comment out some unused function in LDGM that also triggered the
  warning but looked a bit suspicious so it was not clear how to fix
2023-04-12 12:52:07 +02:00
Martin Pulec
cac1d11190 updated copyrights of files changed in 2023 2023-02-09 09:19:50 +01:00
Martin Pulec
2afcdf3c1f print which pixel format cannot be deinterlaced
Needs adding log_msg_once variable arguments (printf-like).

+ print always error in deinterlace - if user explicitly wants
  deinterlace PP, maybe we should notify loudly
2023-01-10 16:41:52 +01:00
Martin Pulec
e3574d3d66 one-shot logger updates
On one-shot second and further calls of one-shot message, no output was
producet, yet empty buffer was submitted to Log_output resulting in
false repeate messages:

    Last message repeated <n> times

To simplify the stuff, C++ API was removed and in the C API the Logger
is taken only if actual message will be output. If someone is willing to
use the C++ API, it can be later readded (not really needed now, only
simple message are presented).
2023-01-10 16:17:37 +01:00
Martin Pulec
9469d6352c document ULTRAGRID_VERBOSE + added some doxygen 2022-11-15 16:13:50 +01:00
Martin Piatka
344ddd5117 string_view_utils: Add sv_contains() 2022-11-10 12:04:41 +01:00
Martin Piatka
7cb9771962 Move tokenize and sv_parse_num into string_view_utils 2022-11-10 12:04:41 +01:00
Martin Pulec
6233c170dd debug_dump: (const void*) instead of (void*) param 2022-11-10 09:17:39 +01:00
Martin Piatka
4b6a048752 logging: Wrap thread local buffer initialization in a function
resolves a crash on RPi
2022-10-26 17:05:26 +02:00
Martin Piatka
7e27491a2b logging: log_vprintf: prune ansi sequences when not interactive
Previously colored output using the inline TERM_* macros from color_out.h was
done only using the color_printf() function. Since there are now places
where they are used with log_msg(), we need to prune ansi codes here
too.
2022-09-27 14:12:18 +02:00
Martin Pulec
771637a91e added log_vprintf 2022-09-23 15:01:20 +02:00
Martin Pulec
78939c21d9 log_msg: switch order of TERM_RESET and '\n'
see also f4f7b0c4
2022-09-19 09:34:14 +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
65557d112d get rid of rang.hpp dependency through color_out.h
Removed indirect dependency on rang.hpp through color_out.h. Now only
remaining dependencies on rang.hpp are direct.

+ fixed escape sequence for foreground magenta
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 Pulec
7719e8aa47 logger: get rid of rang references 2022-08-10 08:14:07 +02:00
Martin Piatka
d395377a5d logging: debug_dump: simplify 2022-08-05 13:44:34 +02:00
Martin Piatka
60e6d00130 logging: remove old dead code 2022-08-05 13:44:34 +02:00
Martin Piatka
386ea3ec16 logging: reset style only on tty 2022-08-03 13:16:03 +02:00
Martin Piatka
332000e4b8 logging: check if output is a terminal only once 2022-08-03 10:43:43 +02:00
Martin Piatka
c0a9db6d0f logging: reserve space in buffer 2022-08-03 10:43:42 +02:00
Martin Piatka
33c8ac5c90 logging: log_msg(): Write directly to Log_output buffer 2022-08-03 10:43:42 +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
b77292d29e logging: modernize config parsing 2022-07-29 13:03:27 +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 Piatka
31b39db713 logging: Add missing assert 2022-07-29 13:03:26 +02:00
Martin Pulec
a22ff7a5f1 lavc: debug dump spot for converted AVFrame
+ change first parameter of serialize callback to (const void *)
+ renamed "lavd-uncompressed" to "lavd-avframe" - uncompressed is vague
  since there are multiple forms of uncompressed - avframe, ultragrid
  pixfmt...
2021-11-26 12:19:17 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
c84d62f4ed Logger: oneshot messages suppport 2021-11-05 10:39:33 +01:00
Martin Pulec
04734e0ebc Define ug_strerror for thread-safe strerror abstraction 2021-10-26 10:49:07 +02:00
Martin Pulec
940399988a Lavd: option to dump decompressed frame 2021-10-22 09:21:52 +02:00