Commit Graph

5065 Commits

Author SHA1 Message Date
Martin Pulec
702220f650 udp_port_pair_is_free: print port number
+ use the even port for getaddrinfo
2023-02-21 09:53:14 +01:00
Martin Pulec
27dc4c6a92 macOS warning fixes 2023-02-21 09:52:58 +01:00
Martin Pulec
da3a55f3df screen_pw: remove rang.hpp dependency 2023-02-21 08:59:44 +01:00
Martin Pulec
d7ae5c41f1 screen_pw: fixed hang when declined record
Fixed hanging on thread::join if user disallows screen recording (wrong
command order).
2023-02-21 08:59:44 +01:00
Martin Pulec
f2566fabce added screen_linux abstraction
User can still select `-t screen` and screen capture will be intialized
according to environment variables (if both pipewire and X11 is
present).
2023-02-21 08:59:41 +01:00
Martin Pulec
dd60dd2540 screen_pw: replaced moodycamel with synchronized_queue
There doesn't seem to be any significant advantage of using the
readerwriterqueue so replace it with a generic UG one.

If needed, this change can be easily reverted (the API is similar).
2023-02-21 08:55:48 +01:00
Martin Pulec
eef7170d01 Linux screen cap. compile fixes
+ mark the original X11 as such (alongside with PipeWire)
2023-02-21 08:55:48 +01:00
Martin Pulec
183cb3298a Merge branch 'screen_pw_rebased' of https://github.com/MatejHrica/UltraGrid.git 2023-02-21 08:53:52 +01:00
Martin Pulec
240f512b7e from_lavc_vid_conv: removed unneeded memsets
The relevant members are already empty-initialized by the caller.

For some reason, this fixes the test crash:

     https://github.com/CESNET/UltraGrid/actions/runs/4220022764/jobs/7325933580
2023-02-20 14:34:23 +01:00
Martin Piatka
c54313f6e5 file vidcap: print error insted of crashing on unavailable conversion
see GH-296
2023-02-20 12:26:00 +01:00
Martin Piatka
adf0c30ae2 file vidcap: Fix inverted condition
We don't want to use swscale if we have a valid conversion. Fixes GH-296
2023-02-20 12:21:53 +01:00
Martin Piatka
803d2c45a9 swmix: Fix possible leak 2023-02-20 10:39:49 +01:00
Martin Pulec
bebdbadbf8 lavc QSV: set async_depth = 1
this setting has positive impact on latency

refer to GH-294
2023-02-17 14:36:44 +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
Martin Pulec
24b8b8c186 main: short opt 'F' for capture filter 2023-02-17 11:09:28 +01:00
Martin Pulec
738efa12b9 added vc_copylineRGBAtoR12L
modified vc_copylineRGBtoR12L to work for both RGB and RGBA

+ data fetching as a macro
2023-02-17 11:09:27 +01:00
Martin Pulec
a843dd36c6 aggregate vicdap: fixed a leak 2023-02-14 10:51:48 +01:00
Martin Pulec
6fe06421d3 get_intermediate_codecs_from_uv_to_av: common comp
Use common sorting routine for get_intermediate_codecs_from_uv_to_av.
2023-02-14 09:49:50 +01:00
Martin Pulec
927842cf43 added pixfmt conversion policy opt
+ changed the default policy to keep bit-depth over color-space

pixfmt_conv_pref is defined in video_codec.c, otherwise tools/convert
won't compile.
2023-02-14 09:49:48 +01:00
Martin Pulec
93997ea810 get_available_pix_fmts: small refactor
* moved complex condition to macro - although it is inherently simple
  (just checking constraints if given, it is quite long, which hurts
  readibility)
* function prototype - signalize that expecting array of AV_PIX_FMT_NB
  members (better would be 'static AV_PIX_FMT_NB', but it's C only)
* improve comments
2023-02-10 16:09:34 +01:00
Martin Pulec
8aae9caa2b lavc: rewritten sorting
use generic compare_pixdesc()

+ rewritten to C (get_available_pix_fmts() will eventually be moved to
  to_lavc_vid_conv.c)
2023-02-10 15:38:49 +01:00
Martin Pulec
0aaf9fff99 qsort_s compat: relax requirement to include first
If includer defines __STDC_WANT_LIB_EXT1__ to 1, it is no longer needed
to include this header first.
2023-02-10 15:13:17 +01:00
Martin Pulec
d9d7889598 lavc qsv: set nint_ref_cycle_size + scenario 2023-02-10 13:53:48 +01:00
Martin Pulec
86ae693117 text textcard pattern: updates
- accept bg/fg options without need to alter (default) text
- print error on wrong option
- use #CC00CC (pink) - although looking less decent, the subsampling
  artifacts should be more observalble with this color
2023-02-10 11:52:40 +01:00
Martin Pulec
8e80a60889 lavc vid: only pixfmt is relevant for conv selection
Do not pass whole video_desc structure because other members don't
matter.
2023-02-10 11:22:15 +01:00
Martin Pulec
467056530c lavd vid conv: added some mappings
FFmpeg's Y210 and Y212 can be directly mapped to UG Y216 (have
just lower bits unused). This shouldn't, however, be given directly to
uv_to_av_pixfmts, because the mapping isn't 1:1. If it would, for
encoder, eg. the conversion Y216->Y210 will be considered as lossless
but it is reducing depth 16->10 b. So added just dummy conversions for
them.

Also removed RG48 and RGB dummy conversions to corresponding AV pixel
formats. This is the opposite case as mentioned in previous paragraph,
the correspondence is 1:1. Also the conversion/memcpy is dispatched
directly in av_to_uv_convert().
2023-02-10 10:02:34 +01:00
Martin Pulec
8e08c9be13 video testcard: deduce pixfmt from file extension 2023-02-09 16:06:00 +01:00
Martin Pulec
c3e4764914 lavc audio: similar change as in prev commit 2023-02-09 11:51:08 +01:00
Martin Pulec
b7af377936 lavd: accept EAGAIN as success when flushing
this is consistent with FFmpeg examples

+ move common audio and video code to lavc_common.c
2023-02-09 11:50:31 +01:00
Martin Pulec
ec50610493 lavd video: call av_frame_free for input frame 2023-02-09 11:42:02 +01:00
Martin Pulec
c1e1c25c3d testcard: display also 8-bit 4:2:2 Y4M 2023-02-09 10:44:45 +01:00
Martin Pulec
c592d8cbbb Y4M: fixes
- writer: length should no longer be multiplied by 2 (y4m_get_data_len()
  does this already)
- C&P error - 16-bit YCbCr written is 4:4:4, not 4:2:2
2023-02-09 09:52:09 +01:00
Martin Pulec
cac1d11190 updated copyrights of files changed in 2023 2023-02-09 09:19:50 +01:00
Martin Pulec
c34d458d04 PAM: missing newlines
+ improved some error messages
2023-02-08 16:17:25 +01:00
Martin Pulec
ec1a512530 testcard: support for PAM and Y4M 2023-02-08 15:55:31 +01:00
Martin Pulec
3d4bfba352 Y4M: fixed reading of >8 bit files
+ changed prototype of y4m_write() to take metadata in structure
2023-02-08 15:32:14 +01:00
Martin Pulec
7c530b58e7 draw_line: initialize font only once 2023-02-08 12:49:12 +01:00
Martin Pulec
7d8cf2db14 added text testcard pattern
- print printable ASCII characters
- choosed default colors such that 4:2:2 subsampling is observable
2023-02-08 12:49:12 +01:00
Martin Pulec
16659b61ea added simple bitmap font + function to draw RGBA
+ option to annotatne testcard bars
2023-02-08 12:49:12 +01:00
Martin Pulec
e06c1af422 PAM: support for PBM binary images
type P4 is now supported
2023-02-08 12:49:12 +01:00
Martin Pulec
793b9a59c4 factor out get_temp_file
additional improvements for Windows (where tmpnam() is used):

1. pass thread-local storage to store tmpnam result
2. fopen the file exclusively
2023-02-08 12:49:12 +01:00
Martin Pulec
6a8fdff5de pam: fixed data read failure
By incorporating Coverity complains, return value from fread was
incorrectly evaluated - returned nmemb=1 of size instead of size in
bytes. Reversed the order for convenience (to show actual number of
bytes, not only that 0 members were read).
2023-02-07 16:36:03 +01:00
Martin Piatka
429d27a148 SDL2: Clear before rendering
Avoids showing garbage outside of the rendered area when video aspect
doesn't match window size (was observed on macs)
2023-02-07 12:34:16 +01:00
Martin Piatka
2849fb91e0 SDL2: Enable high-dpi support 2023-02-07 12:31:33 +01:00
Martin Piatka
aa29831e7b vulkan: enable hi-dpi support
Allows rendering at native resolution on high-dpi screens (e.g. Mac
retina)
2023-02-07 12:30:12 +01:00
Martin Piatka
83d7a28a32 capabilities: Fix printing incorrect module name 2023-02-07 10:44:23 +01:00
Martin Piatka
553296bff7 vulkan: Fix Y416 conversion
see GH-291
2023-02-07 09:50:01 +01:00
Martin Piatka
b68668b154 vulkan: Fix shader conversions not processing whole image
When the image resolution was not cleanly divisible by the local
workgroup size, the remaining pixels were left unprocessed.
2023-02-07 09:50:00 +01:00
Martin Piatka
ba3755fdc0 vulkan: Fix shader UYVY conversion
There were 2 issues:
1. normalized floating coords causing artifacts (see GH-291)
2. The resulting image width was incorrectly doubled
2023-02-07 09:50:00 +01:00
Martin Pulec
7c5e286834 video_pattern_generator: catch errors + init noexcept
The out of bound access in previous commit was silently suppressed
because the exception was passed and catch(...) didn't print anything.

- init is now noexcept
- while still letting catch(...) without err msg, because when int is
  thrown, it is expected that thrower has already printed a cause (or
  help), catch std::exception
2023-02-07 09:45:49 +01:00