Commit Graph

70 Commits

Author SHA1 Message Date
Barnabás Pőcze
7674b15fab pipewire-v4l2: move open*() flag check into function
This commit moves the check that determines whether the mode
argument of `open*()` exists into a separate function.

With that, the check is fixed because previously it failed to
account for the fact that `O_TMPFILE` is not a power of two.

Furthermore, add `assert()`s in the fortified variants that
ensure that no mode is required by the specified flags.
2024-06-25 19:10:13 +02:00
Barnabás Pőcze
354387ca58 pipewire-v4l2: redirect to correct functions from fortified variants 2024-05-16 01:53:38 +02:00
Wim Taymans
1c900707a8 v4l2: add bus_info in v4l2_capability if we have it 2024-05-08 17:48:00 +02:00
Steve Langasek
4af8b0f5a7 v4l2: unset _TIME_BITS in addition to _FILE_OFFSET_BITS
The v4l2 build unsets _FILE_OFFSET_BITS, which is not allowed when setting
_TIME_BITS=64.  Having verified that nothing in this module is sensitive to
64-bit time_t (none of the functions it intercepts handle time), we also
unset _TIME_BITS to allow this to build as before.

Signed-off-by: Steve Langasek <steve.langasek@canonical.com>
Reviewed-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-03-16 09:25:27 +01:00
Jan Alexander Steffens (heftig)
43db03909b ci: ShellCheck preprocessed scripts separately
Change the shellcheck job so that we configure the build and check the
preprocessed versions of the scripts, not the bare ones, which might not
be syntactically valid yet.
2023-09-15 08:49:36 +00:00
Wim Taymans
950c2d2675 v4l2: check for format support 2023-08-01 12:59:35 +02:00
Wim Taymans
0501ef165a spa: add atomic.h and port macros to it 2023-07-13 12:25:22 +02:00
Wim Taymans
1c18e8aa69 handle some error cases 2023-03-16 12:28:29 +01:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Dmitry Sharshakov
09f00b5086 v4l2: support setting target source 2023-01-11 11:43:37 +00:00
Dmitry Sharshakov
395749fea9 v4l2: cleanup and simplify
Co-authored-by: Barnabás Pőcze <pobrn@protonmail.com>
2023-01-09 12:27:17 +00:00
Dmitry Sharshakov
996f8a5832 v4l2: ignore symlinks in case of openat passthrough 2023-01-09 12:27:17 +00:00
Dmitry Sharshakov
549e543444 v4l2: report framerate using VIDIOC_G_PARM 2023-01-08 09:12:33 +00:00
Wim Taymans
ed9d3e7320 v4l2: fix some compiler warnings
Compare poiters with NULL and without ordering.
2023-01-06 10:32:25 +01:00
Dmitry Sharshakov
bb23fd787e v4l2: support setting controls 2023-01-03 12:19:14 +00:00
Dmitry Sharshakov
08107f1a02 v4l2: support querying controls 2023-01-03 12:19:14 +00:00
Dmitry Sharshakov
5c96928d12 v4l2: follow symlinks 2023-01-03 12:19:14 +00:00
Dmitry Sharshakov
bb24c8545d pw-uninstalled: make v4l2 easily available 2022-11-08 20:45:50 +00:00
Wim Taymans
8a2e154bae v4l2: turn some info to debug again 2022-11-08 16:37:22 +01:00
Wim Taymans
0d24f6b35f v4l2: Use the node format when available
When the node we try to link to already has a format, return that to the
application because we can't renegotiate to a new format.
2022-11-08 16:25:21 +01:00
Wim Taymans
53796a45cd v4l2: mark the fd as closed instead of -1
Or else we won't be able to close the fd later.
2022-11-08 15:47:55 +01:00
Wim Taymans
332fc0d9a5 v4l2: improve debug 2022-11-07 12:29:54 +01:00
Wim Taymans
6cffabd09d v4l2: don't mmap when the buffer has data already
When the buffer has data (but no fd), don't mmap the buffer but simply
use the data pointer directly.

This makes v4l2 work with inlined buffer memory.
2022-11-07 11:52:02 +01:00
Wim Taymans
6bae31e519 v4l2: pretend a dupped fd is the same as the original one
This makes it possible to reqbufs on a dupped fd with previously
reqbufs.
2022-11-07 11:50:35 +01:00
Wim Taymans
492920ca35 test: add another 6.1 channelmix test
Reorder the bitmask in the natural channel order to avoid confusion.
Add another test with RL/RR/RC channels.

See #2809
2022-11-06 10:57:25 +01:00
Wim Taymans
59f9ed41fb v4l2: use param_info to track param updates 2022-11-05 14:01:27 +01:00
Wim Taymans
11ab47e4c9 v4l2: suggest stride in Buffer param 2022-11-05 13:12:24 +01:00
Wim Taymans
c3206fa687 v4l2: release ref after adding file to maps 2022-11-05 13:12:01 +01:00
Wim Taymans
46123cfcec v4l2: improve debug 2022-11-05 13:11:43 +01:00
Wim Taymans
0e8ea21098 v4l2: fix compilation on older versions 2022-11-04 21:26:19 +01:00
Wim Taymans
b6f1935cfb v4l2: fix streaming compliance test
Add sequence number to frames.
Fix mmap tracking.
Improve debug.
Set right flags on dupped fds.
Handle blocking dqbuf.
Set timestamp and field on buffers.
Dequeue buffers in streamoff.
2022-11-04 17:34:04 +01:00
Wim Taymans
503bb94645 v4l2: we can request just 1 buffer perfectly fine 2022-11-04 15:21:32 +01:00
Wim Taymans
4186e3da6b v4l2: implement G/S_PRIORITY
Return busy when reqbufs is called from an fd that is not the owner
of the current reqbufs.
2022-11-04 13:14:46 +01:00
Wim Taymans
5a299e5685 v4l2: improve debug 2022-11-04 11:00:56 +01:00
Wim Taymans
4a92f355ad v4l2: fix enum_input, don't clear the index 2022-11-04 11:00:19 +01:00
Wim Taymans
8900722f55 v4l2: only accept CAPTURE buffer types in try_fmt 2022-11-04 10:59:39 +01:00
Wim Taymans
5a262b4bd3 v4l2: return a default format from G_FMT 2022-11-04 10:59:13 +01:00
Wim Taymans
73ad5d9057 v4l2: set colorspace 2022-11-04 10:58:50 +01:00
Wim Taymans
0f13d5a65e v4l2: reuse fd when opening the same path
When we open the same device multiple times, reuse the file structure
and dup the fd.
2022-11-04 10:36:49 +01:00
Wim Taymans
4cb1c790a4 v4l2: set the description correctly
The description needs to match what is expected by the compliance
test.
2022-11-03 17:36:55 +01:00
Wim Taymans
9aff5dfc8f v4l2: make bus_info compliant
It needs to start with something accepted by the compiance test.
2022-11-03 17:35:48 +01:00
Wim Taymans
2c4b574b8f v4l2: handle errors better
Only store the eventfd when valid or else we will try to close an
invalid fd.
Keep the errno value around, just in case it gets overwritten by
the free_file call.
2022-11-03 17:34:00 +01:00
Wim Taymans
faab559568 v4l2: handle multiple /dev/videoX nodes
Associate each PipeWire video source to a video device and let
applications probe and open multiple sources.
2022-11-03 13:27:49 +01:00
Wim Taymans
fbd3885ff1 v4l2: small cleanups
Improve size scoring.
Check video size after parsing.
2022-11-03 13:25:44 +01:00
Wim Taymans
866ef2ef21 v4l2: improve debug of fourcc 2022-11-03 13:25:10 +01:00
Wim Taymans
a6e3ac68d2 v4l2: use the node description as the card name 2022-11-03 13:23:26 +01:00
Wim Taymans
cd9dc974f5 v4l2: improve error debugging 2022-11-03 13:22:38 +01:00
Wim Taymans
d2aa240767 introspect: handle NULL result from info updates 2022-10-27 20:06:54 +02:00
Wim Taymans
d22feab92a spa: add macro to simplify array iterations some more
uint32_t i;
	for (i = 0; i < SPA_N_ELEMENTS(some_array); i++)
		.. stuff with some_array[i].foo ...

   becomes:

	SPA_FOR_EACH_ELEMENT_VAR(some_array, p)
		.. stuff with p->foo ..
2022-09-30 16:24:26 +02:00
Pauli Virtanen
240d212822 pipewire-v4l2: disable _FORTIFY_SOURCE when defining override functions
_FORTIFY_SOURCE defines always_inline versions of open etc. functions,
which conflict with our exported override versions.  Disable it for the
file that defines the override functions.
2022-07-10 16:05:27 +03:00