Commit Graph

6294 Commits

Author SHA1 Message Date
Martin Pulec
2e424d50ca replaced instances of color_out with color_printf
+ reindent vidcap/file help ("where" keyword)
2022-08-04 14:07:45 +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
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
c20b41dd2d color_out: simplify style resetting
The reset code seems to reset everything including boldness and colors,
so no need to reset each individually
2022-08-03 10:43:44 +02:00
Martin Piatka
e6d1a36409 color_out: output using Log_output
This makes the color functions work correctly when used together with
other log functions (will not overwrite the "Last msg repeated", etc.)
2022-08-03 10:43:43 +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
33c8ac5c90 logging: log_msg(): Write directly to Log_output 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 Pulec
d2c5ca065d fixed vc_copylineRGBAtoUYVY
- the required space for intermediate result was actually 2x larger than
  dst buffer could provide
+ make arguments of vc_copylineRGBAtoUYVY restrict again -- no longer
  used in situ, thus it can be restricted again
2022-08-02 15:03:55 +02:00
Martin Pulec
1b7291e492 lavc: cache AVPacket in compress state
This avoids AVPacket allocation/free for every frame.
2022-08-02 11:37:58 +02:00
Martin Pulec
facbf05608 lavc: increment pts directly, do not use static var
Since the in_frame is recycled, there is no need to store sequential
number separately.
2022-08-02 11:25:04 +02:00
Martin Pulec
f67aa7c2e2 lavc: repl. av_image_alloc with av_frame_get_buffer
Replace av_image_alloc call wit av_frame_get_buffer.

The use of the former caused significant performance degradation (see
GH discussion CESNET/UltraGrid#241).
2022-08-02 11:14:39 +02:00
Martin Pulec
c7db9c12b8 lavc: configure_with codec opening in sep. func.
Moved FF codec selection to a separate function.
2022-08-02 11:14:39 +02:00
Martin Pulec
7d8f2a5017 lavc: configure_with - simplify a bit 2022-08-02 11:14:39 +02:00
Martin Pulec
3bd2a96087 lavc: moved swscale creation to configure_swscale 2022-08-02 11:14:39 +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
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 Piatka
1ba26d4f91 conference: control port info command 2022-07-29 13:03:26 +02:00
Martin Piatka
3cba9cf0e1 deltacast: remove duplicit include 2022-07-29 13:03:26 +02:00
Martin Piatka
b71c4e633d audio/utils: Add missing include for std::clamp() 2022-07-29 13:03:25 +02:00
Martin Pulec
517c27fa18 format_in_si_units: don't take parameter suffix
This is perhaps unneeded -- caller can append the units by itself.
2022-07-29 11:48:48 +02:00
Martin Pulec
c69fd8a076 lavc: print bitrate using SI-prefix
With SI-prefix, the value is human readable.
2022-07-29 10:53:30 +02:00
Martin Pulec
12c1b37121 lavc nvenc: set delay to 2
This improves throughtput by factor of 2 at the expense of possibly
increased latency (up those 2 frames).
2022-07-29 10:15:33 +02:00
Martin Pulec
f7746f97a7 parse_cuda_device: updates
- document return code (non-intuitive)
- set cuda devices even if GPUJPEG is not compiled in. The code is used
  to enumerate CUDA devices but now not only GPUJPEG uses the value, it
  is eg. used to identify GPU for NVENC
- restructuralize (exit in help block) + return EXIT_FAILURE instead of
  EXIT_FAIL_USAGE if GPUJPEG not compiled in (perhaps more eligible --
  the usage is actually correct, just GJ is not compiled in)
2022-07-29 08:09:04 +02:00
Martin Pulec
1bdf147a20 main.cpp: moved --cuda-device code to sep. func 2022-07-29 08:09:04 +02:00
Martin Pulec
e21c28a6cf Added r10k_to_x2rgb10le but don't use
The codec seems currently not working correctly for nvenc from
libavcodec side.
2022-07-29 08:08:57 +02:00
Martin Pulec
8681c8220e vidcap import: color usage 2022-07-28 10:56:51 +02:00
Martin Pulec
0a8bd533b8 vidcap import: opt to limit number of frames used 2022-07-28 10:56:35 +02:00
Martin Pulec
791b101625 lavc: simplify a bit
Just removed one level of indention (if avcodec_frame_send fails, return
immediately).
2022-07-28 10:11:29 +02:00
Martin Pulec
40bcc8f6c6 lavc: performance debug print 2022-07-27 13:46:33 +02:00
Martin Pulec
3b4a0d7511 tools/convert: compilation fixes 2022-07-27 10:23:50 +02:00
Martin Pulec
ad5c6bd2c2 AppImage: bundle libjack.so.0 again
This effectively reverts 3c9b8293.

libjack.so.0 is a dependency also for different modules like portaudio
so if we do not want to depend on instance in the system, we must ship
our version.
2022-07-27 09:05:56 +02:00
Martin Pulec
356b622889 testcard: get rid of SDL_mixer
SDL_mixer has some nasty dependency on JACK so remove it altogether
since it is perhaps seldom used (the MIDI playback may be added later
eg. as a standalone audio capture).

(see GH discussion #241)
2022-07-27 09:05:56 +02:00
Martin Pulec
46746286ec export.c: use color_printf for help 2022-07-27 09:05:55 +02:00
Martin Pulec
1ab53bacf4 dummy video display: simplify
- use generic FPS indicator
- default member intializer for video_frame instead of member
  initializer list
2022-07-27 09:05:55 +02:00