Commit Graph

71 Commits

Author SHA1 Message Date
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 Piatka
aa0adb152e logger: Add missing initialization
Doesn't really matter since it's set in host.cpp
2023-05-23 13:05:14 +02:00
Martin Pulec
183d175d73 fixed some of new Coverity issues 2023-05-10 08:52:02 +02:00
Martin Pulec
04a0bf581b removed ATTRIBUTE macros
This was unnecessary compat macro, since we always build with a compiler
that understands __attribute__ except of the AJA module in MSW, which
uses MSVC compiler
2023-05-02 15:22:55 +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
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
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
6233c170dd debug_dump: (const void*) instead of (void*) param 2022-11-10 09:17:39 +01:00
Martin Pulec
6c88f3b971 logger: fixed non-interactive crash when msg size < sizeof TERM_RESET 2022-11-02 10:20:09 +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 Pulec
ab152abb04 audio testcard: error on WAV reading error
If WAV is used, error if size is 0 - it doesn't make any case to
continue and it will fil on floating point exception, anyways.
2022-10-10 09:28:37 +02:00
Martin Pulec
771637a91e added log_vprintf 2022-09-23 15:01:20 +02:00
Martin Pulec
f4f7b0c426 Logger: switch order of TERM_RESET and '\n'
If logged message ends with '\n', put TERM_RESET before it (it prevents
keeping the color if someone writes to stderr directly).
2022-09-15 10:59:40 +02:00
Martin Pulec
383a00844f DEBUG_TIMER: use time_ns_t 2022-08-10 13:45:07 +02:00
Martin Pulec
cf58ff3948 added missing includes 2022-08-10 13:45:07 +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
812bcbfc78 logger: remove ANSI seqences if not terminal
This allows use of raw ANSI sequences instead of the rang stuff.
2022-08-10 08:14:07 +02:00
Martin Pulec
7719e8aa47 logger: get rid of rang references 2022-08-10 08:14:07 +02:00
Martin Piatka
ca0421787a keyboard_control: use getter&setter for repeat skipping 2022-08-05 13:44:35 +02:00
Martin Piatka
386ea3ec16 logging: reset style only on tty 2022-08-03 13:16:03 +02:00
Martin Piatka
853015ecec logging: work around stringstream cast
The << operator for stringstream casts the result to basic_ostream
which does not have the .str() method on some compilers. (See C++ defect
report 1023).
2022-08-03 12:00:14 +02:00
Martin Piatka
ddcf2bf399 logging: Add submit_raw 2022-08-03 10:43:43 +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
04fbcddfed logging: expose styles as strings 2022-08-03 10:43:42 +02:00
Martin Piatka
c439b05887 logging: Log_out: nicer interface 2022-08-03 10:43:41 +02:00
Martin Piatka
d108c068f4 logging: Log_output: avoid using streams
Avoids an allocation and copy for timestamp
2022-08-03 10:43:41 +02:00
Martin Piatka
b4144ffa5b logging: put style reset into the msg buffer 2022-08-03 10:43:41 +02:00
Martin Piatka
241c930299 logging: Flush stream on msg repeat
Since the repeat msg does not contain a newline we need to flush the
stream to make sure it appears when stream buffering is used
2022-08-03 10:43:40 +02:00
Martin Piatka
e031547a1d logging: use mutex for repeated msg checking
The previous implementation using atomics was not entirely correct,
since the following situation could happen:

1. Thread 1 detects a msg repeat
2. Thread 2 prints a message before thread 1 could print repeat notice
3. Thread 1 outputs "last msg repeated" for the msg from step 1

The stdout stream uses locking internaly anyway, so this should not have
any significant overhead. On the other hand this simplifies the code,
eliminates an allocation and fixes the leak on exit.
2022-08-03 10:43:40 +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
44294ef0c6 logging: Logger: set color&style in constructor 2022-08-03 10:13:31 +02:00
Martin Pulec
ec20f7877c logger: trigger flush on repeated messages
When the output is line-buffered, the repeated message isn't immediately
printed.
2022-08-03 09:51:07 +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
d496f738f2 logging: setters for timestamp and skip_repeat 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
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
940399988a Lavd: option to dump decompressed frame 2021-10-22 09:21:52 +02:00
Martin Pulec
7510652dd6 Audio performance measurements
Added DEBUG_TIMER_START and DEBUG_TIMER_STOP to debug.h to for
performance measurements. If DEBUG is not defined, the code is not
compiled (doesn't impose any runtime overhead).
2021-08-04 11:01:22 +02:00
Martin Pulec
96844d7119 Audio: periodically display cumulative statistics 2021-07-27 16:13:24 +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
dd49b48b69 Added log_perror
Same as perror but uses the logger
2021-04-21 14:42:02 +02:00
Martin Pulec
dbc071fe81 Logger: fixed a leak 2021-04-19 16:59:25 +02:00
Martin Pulec
b888e09800 Key control: shortcut to control repeating of msgs 2020-11-13 14:50:29 +01:00