Commit graph

1174 commits

Author SHA1 Message Date
Nicolas Dufresne
43c5db3c72 v4l2object: Fix indentation 2018-09-12 20:49:41 -04:00
Nicolas Dufresne
4d0f5f056e v4l2object: Protect against zero PAR num/demu
This fixes an assertion when the driver implement CROPCAP but does
not set the PAR.
2018-09-12 20:49:41 -04:00
Nicolas Dufresne
66351255f7 v4l2object: Only offer MMAP/DMABUF pool
The propose allocation was offering a pool even in DMABUF_IMPORT or
USERPTR mode. These pool are internal only.
2018-08-31 15:44:02 -04:00
Nicolas Dufresne
fe5236be87 v4l2transform: Add "disable-passthrough" property
This allow forcing going through the transform driver even if there
isn't an conversion happening. This is usedful when the m2m driver can
be used to adapt the type of memory between two drivers.
2018-08-31 15:43:53 -04:00
Nicolas Dufresne
480a7bcab8 v4l2bufferpool: Validate stride/offset when importing
This will prevent situation where buffer size allow importing but rendering
goes wrong due to a miss-match in expected stride and offset.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
1c729be537 v4l2object: Add a method to try and import buffers
This method will check if a buffer, base on it's video meta,
can be imported. It will also try and adapt the request stride
in case this is the only that miss-match.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
d6d8187345 v4l2allocator: Trace the buffer index we import to
https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
73555b5440 v4l2bufferpool: Fix typo in error message
https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
77c052f0e8 v4l2bufferpool: Only queue buffer if preparation worked
The preparation code imports the buffer, doing bunch of
validation. Only queue the buffer in the driver if the
importation worked. This way we don't rely on the driver
to validate.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
24368c1162 v4l2object: Only allow DMABuf export for STREAMING device
DMABuf exportation requires mmap, which requires STREAMING
capabilities.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
90a70e08b7 v4l2bufferpool: Activate the other pool first
This change has no effect. We will need to acquire a buffer from the
pool later in order to validate / adapt with the video alignment for
the downstream buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
fe3a70fefd v4l2src: Simplify format handling
Always initially use try_format(), delaying set_format() to when the
allocation is being negotiated. This avoid having two code paths, and
will be help adding support for properly importing buffers of specific
strides and offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Philipp Zabel
00143ca554 v4l2object: complete colorspace info in debug log
The desired colorimetry is logged with all parameters (colorpsace,
range, matrix, and transfer function), but of the values actually
set by the driver, only colorspace is logged. Complete the debug
log message to display all colorimetry parameters:

  Desired colorspace is 8:1:1:1
  Got format of 640x480, format YU12, nb planes 1, colorspace 8

->

  Desired colorspace is 8:1:1:1
  Got format of 640x480, format YU12, nb planes 1, colorspace 8:0:0:0

https://bugzilla.gnome.org/show_bug.cgi?id=796940
2018-08-21 12:01:41 -04:00
Philipp Zabel
91dd9c1929 v4l2object: fix typo in comment
https://bugzilla.gnome.org/show_bug.cgi?id=796940
2018-08-21 12:01:41 -04:00
Philipp Zabel
02d3f9748b v4l2object: improve colorspace handling for JPEG sources
gstjpegdec sets 1:4:0:0 colorimetry (full range BT.601 YCbCr encoding
with unknown primaries and unknown transfer function). This currently
gets translated to bt601 or bt709 depending on resolution.
Both cases result in a negotiation failure:

    ERROR: from element /GstPipeline:pipeline0/v4l2video0convert:v4l2video0convert0: Device '/dev/video0' does not support 1:4:0:0 colorimetry

Improve the guessing game by selecting JPEG colorimetry (JPEG colorspace
with sRGB transfer function) under these specific conditions, and loosen
the matching so that 1:4:0:0 input gets accepted if the device is
actually configured to 1:4:7:1 (V4L2_PIX_FMT_JPEG default).

https://bugzilla.gnome.org/show_bug.cgi?id=796940
2018-08-21 12:01:41 -04:00
Philipp Zabel
9595fd08e3 v4l2object: stop V4L2 from zeroing extended colorimetry for non-mplane
Setting the priv field to a magic value stops V4L2 core from zeroing
the extended colorimetry fields quantization, ycbcr_enc, and xfer_func
for non-mplane queues.

https://bugzilla.gnome.org/show_bug.cgi?id=796940
2018-08-21 12:01:41 -04:00
Zeeshan Ali
af27ecae3f v4l2: Remove a trailing whitespace
Otherwise, the latest gst-indent check doesn't pass.
2018-08-19 15:39:16 +02:00
Iñigo Huguet
3f360e8f15 v4l2src: fix first input used is always used next times
The input from an v4l2 device that was used the first time was
remembered for next times, and set again always the pipeline is
set to READY state. This was making that users wasn't able to
select a different input without having to create a new pipeline.

This patch makes that v4l2src element forget previous used input
when going to NULL state, so it will check again for the current
selected input when going again to READY state. Users can change
to NULL state, select a new input with a VIDIOC_S_INPUT ioctl
and change to PLAYING again.

https://bugzilla.gnome.org/show_bug.cgi?id=796908
2018-08-02 08:00:44 -04:00
Nirbheek Chauhan
1c645f83f6 meson: Fix missing variable in v4l2 build 2018-08-01 01:11:05 +05:30
Nirbheek Chauhan
8f807477eb meson: Add feature options for all plugins
Checks for GL, Qt5, and C++ are still automagic. FIXMEs have been
added for these so they can be fixed later.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:42:54 +05:30
Nicolas Dufresne
9e79821b1d v4l2bufferpool: Validate that capture buffers were queued
When the pool is started, we allocate and release buffer, expecting
the pool release-buffer handler to queue them. Though, as we rely
on release function, there is no direct way to detect that this
process didn't work.

To check this, validate that the number of queued buffer is the same
as the number of allocated buffers. This allow returning an error
when buffer importation was refused by the driver.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-07-13 23:13:44 -04:00
Nicolas Dufresne
3b364cea94 v4l2bufferpool: Only return eos for M2M devices
This will avoid sending EOS on v4l2src when a driver sends an empty
buffers. This case would be a bug in the driver, but yet the camera
should keep running.

This also removes the check for corrupted buffers, as this check is
already done later.

https://bugzilla.gnome.org/show_bug.cgi?id=794842
2018-07-13 22:58:57 -04:00
Nicolas Dufresne
3735e57fb2 v4l2: Add a macro to check for M2M
https://bugzilla.gnome.org/show_bug.cgi?id=794842
2018-07-13 22:58:57 -04:00
Nicolas Dufresne
0649b0ab0f v4l2allocator: Fix userptr importation
The length passed to the driver was always 0 instead of the size of
the memory. This would fail validation in videobuf2.
2018-07-13 22:58:35 -04:00
Nicolas Dufresne
38b68cbbd7 v4l2bufferpool: Remove duplicate check
We were calling gst_v4l2_is_buffer_valid() before and inside
gst_v4l2_buffer_pool_qbuf() as we needed to access the group. The second
check failed since the writability of the buffer get inherited from the
GstMemory, which lead to pipeline failure. As we cannot avoid the extra
ref, it would be racy otherwise, just pass the group to _dbuf() so it
does not have to call gst_v4l2_is_buffer_valid() again.

https://bugzilla.gnome.org/show_bug.cgi?id=796692
2018-07-12 15:17:44 -04:00
Nicolas Dufresne
b12b8b0b22 v4l2src: Try to avoid TRY_FMT when camera is streaming
Some camera firmware crash is TRY_FMT is called during streaming. As a
side effect. This try and detect that the same format as currently
running is about to be tried, and skip renegotiation.

https://bugzilla.gnome.org/show_bug.cgi?id=796789
2018-07-11 19:05:00 -04:00
Nicolas Dufresne
c87f9eb37b v4l2videodec: Protect double calls to set_format()
In some cases, set_format() may get called twice before the output
format is set. Running an allocation query in this case is both not
needed and will cause assertion due tot he NULL caps.
2018-07-09 14:01:00 -04:00
Michael Tretter
442c377b87 v4l2transform: Implement stable element name
The first converter to be found will now gain the name v4l2convert.
Other converters will be named after the m2m dev node end point they are
attached to.

https://bugzilla.gnome.org/show_bug.cgi?id=784958
2018-07-01 15:45:53 -04:00
Nicolas Dufresne
6704fbb044 v4l2videoenc: Only renegotiate with upstream
When the decoder get linked further, it will receive a renegotiation
event from downstream. This case is not supported and should be ignored.

This fixes issues when this encoder is used inside an GstRtspServer
pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=796525
2018-06-29 10:39:04 -04:00
Peter Seiderer
8ab3b91a8b v4l2transform: fold property set/get PROP_OUTPUT_IO_MODE case into default
https://bugzilla.gnome.org/show_bug.cgi?id=796714
2018-06-28 16:50:28 -04:00
Nicolas Dufresne
5fc67b248b v4l2videoenc: Don't set colorimetry on capture
The colorimetry will be set along with the raw format and those fields
will then be copied from sink to src caps by the gst encoder.

https://bugzilla.gnome.org/show_bug.cgi?id=791471
2018-06-27 17:06:30 -04:00
Nicolas Dufresne
b677ae3cb6 v4l2object: Really always set colorimetry
This fixes patch dd1c5aed65 which
pretended to always set colorimetry but the patch was incomplete.
This is again best effort considering the spec says that for CAPTURE
you may only read this value.
2018-06-27 16:57:29 -04:00
Michael Tretter
35ab185d75 v4l2videodec: do not call streamon while pool is flushing
gst_v4l2_buffer_pool_flush() executes streamoff for the output, but
streamoff->streamon for the capture of the decoder.
gst_v4l2_buffer_pool_streamon() on capture assumes that is able to
resurrect the buffers from the pool, but acquiring buffers fails if the
buffer pool is still flushing.

The decoder needs to stop flushing the pools before calling
gst_v4l2_buffer_pool_flush() to restart the v4l2 device. Otherwise
starting the decoding thread might fail, because there are no buffers in
the capture pool.

This fixes a regression that was introduced in 97985a335c
("v4l2videodec: Add dynamic resolution change support").

https://bugzilla.gnome.org/show_bug.cgi?id=796681
2018-06-27 16:32:23 -04:00
Philipp Zabel
32fa1e7a65 v4l2object: use S_SELECTION instead of S_CROP in gst_v4l2_object_set_crop
The S_CROP call doesn't work on mem2mem output queues. Use the
S_SELECTION call to set the crop rectangle and only fall back to
S_CROP for ancient kernels.
This will allow v4l2videoenc to set the coded size on the output
queue via S_FMT and then set the visible size via the crop rectangle,
as required by the V4L2 codec API.

https://bugzilla.gnome.org/show_bug.cgi?id=796672
2018-06-27 16:31:39 -04:00
Marian Mihailescu
58e9341384 v4l2videoenc: activate capture pool after output pool
Some drivers need output buffers set before capture buffers.
CODA cannot set output format if capture is streaming.
Exynos MFC fails on output STREAMON if capture is already streaming.
This patch delays capture activation until output is configured and
streaming

https://bugzilla.gnome.org/show_bug.cgi?id=796693
2018-06-27 16:28:10 -04:00
Nicolas Dufresne
90eade28f2 v4l2bufferpool: Drop truncated frames
Drop truncated frames regardless if they have the ERROR flag or not.
Truncated frame causes video frame map failure in many elements
including cluttersink, glupload etc.
2018-06-07 15:26:32 -04:00
Nicolas Dufresne
e943a11bab v4l2bufferpool: Try return input buffer soon
In this patch we use a non-blocking poll in order to return all input
buffers (buffers from v4l2-output queue). This prevent holding too long
on upstreaming buffer in importing.

https://bugzilla.gnome.org/show_bug.cgi?id=794904
2018-06-07 15:26:32 -04:00
Nicolas Dufresne
f72c7131ae v4l2object: Don't open the device in get property
This is both racy and inefficient. This function is still missing some
locking which will be address in later patch.

https://bugzilla.gnome.org/show_bug.cgi?id=796185
2018-05-28 12:58:45 -04:00
Edward Hervey
e555596d48 v4l2: Fix typo in debug messages
It's a decoder, not an encoder :)

https://bugzilla.gnome.org/show_bug.cgi?id=795941
2018-05-12 08:04:03 +02:00
Nirbheek Chauhan
65536f25dd meson: Update option names to omit disable_ and with- prefixes
Also yield common options to the outer project (gst-build in our case)
so that they don't have to be set manually.
2018-05-05 20:31:01 +05:30
Guillaume Desmottes
2bbe877a6e v4l2: rely on gst_v4l2_dup() to set no_initial_format and keep_aspect
gst_v4l2_dup() will now take care of setting
v4l2capture->no_initial_format and keep_aspect instead of doing it
manually.

Fix a typo as keep_aspect was set twice on v4l2output but never on
v4l2capture.

https://bugzilla.gnome.org/show_bug.cgi?id=795028
2018-04-26 15:36:16 -04:00
Xavier Claessens
edd9c8f6b8 Meson: Generate pc file for all plugins in good
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:07:06 +01:00
Whoopie
2d774554e9 v4l2object: Disable DMABuf for emulated formats
libv4l2 does not prevent exporting DMABuf even when emulated formats are
in use. As a side effect, userspace ends up with buffers of the original
formats which will cause issues.

https://bugzilla.gnome.org/show_bug.cgi?id=795097
2018-04-11 22:19:10 -04:00
Nicolas Dufresne
ebf8a6d0c0 v4l2object: Only use BT2020_12 for BT2020 v4l2 colorspace
BT2020_12 is not represented in V4L2, so drivers providing full colority
for BT2020 will set V4L2_XFER_FUNC_709 transfer function. To fix the
issue, we bump this to BT2020_12 if the resoltion is 4K, but we should
only do that if the colorspace is BT2020 to start with, otherwise it's
not possible to use normal BT709 for 4K 8bit formats.
2018-04-11 22:19:10 -04:00
Nicolas Dufresne
dd1c5aed65 v4l2object: Always set the colorimetry in S_FMT
So far we were only setting colorimetry for OUTPUT devices (v4l2sink or
m2m sink pad). This prevented selecting through caps negotiation the
colorimetry for CAPTURE devices (v4l2src or m2m src pad). This is rarely
selectable, but trying is harmless.
2018-04-11 22:19:10 -04:00
Seungha Yang
c4d13683f6 v4l2: Fix unknown type name ‘off_t’ error
Fix following build error

gstv4l2object.h:197:17: error: unknown type name ‘off_t’
       gint fd,  off_t offset);
                 ^

https://bugzilla.gnome.org/show_bug.cgi?id=794533
2018-03-27 13:46:58 -04:00
Nicolas Dufresne
7d4702e2fb v4l2: Fix support for 32bit mmap
https://bugzilla.gnome.org/show_bug.cgi?id=793103
2018-03-07 14:16:24 -05:00
Tim-Philipp Müller
072c070e6c docs: remove pointless Since: 0.10.x markers 2018-02-15 00:58:38 +00:00
Guillaume Desmottes
f7e280bf0d v4l2: fix division by 0 for complex video formats
So complex video formats have 0 as pstride. Don't try to divide the
stride in such cases.

https://bugzilla.gnome.org/show_bug.cgi?id=792596
2018-01-17 13:32:58 -05:00
Guillaume Desmottes
3bbfd15047 v4l2: display stride and width values if stride is too small
https://bugzilla.gnome.org/show_bug.cgi?id=792596
2018-01-17 13:32:58 -05:00
Peter Seiderer
d2f9040e1d v4l2videodec: add property set/get PROP_CAPTURE_IO_MODE error handling
https://bugzilla.gnome.org/show_bug.cgi?id=791841
2018-01-12 09:21:18 -05:00
Peter Seiderer
2cd772b97a v4l2videodec: fold property set/get PROP_OUTPUT_IO_MODE case into default
https://bugzilla.gnome.org/show_bug.cgi?id=791841
2018-01-12 09:21:18 -05:00
Peter Seiderer
f579ece0fb v4l2videoenc: add property set/get PROP_CAPTURE_IO_MODE error handling
https://bugzilla.gnome.org/show_bug.cgi?id=791841
2018-01-12 09:21:18 -05:00
Peter Seiderer
5c0cf56193 v4l2videoenc: fold property set/get PROP_OUTPUT_IO_MODE case into default
https://bugzilla.gnome.org/show_bug.cgi?id=791841
2018-01-12 09:21:18 -05:00
Peter Seiderer
189822350b v4l2videoenc: fix capture-io-mode property get
https://bugzilla.gnome.org/show_bug.cgi?id=791841
2018-01-12 09:21:18 -05:00
Nicolas Dufresne
21b01acef1 v4l2src: Maintain downstream caps order
The g_list_insert_sorted() will behave like prepend when the compare
function returns 0. In our case, we want to maintain the order hence
append. This fixes this issue and improve the sorting algorithm to make
a 10x10 prefered over 10x200 with a preference of 10x8 (and similar
cases which was badly handled). This fixes generally fixes issue were a
sub-optimal format / size is picked.

https://bugzilla.gnome.org/show_bug.cgi?id=792435
2018-01-11 17:51:13 -05:00
Nicolas Dufresne
b3afa0dc1d v4l2videoenc: Also re-enabled paused task
When we only run _finish(), the task is never stopped externally,
instead it's only paused from the inside. We still want to restart
it in this case.
2018-01-11 11:27:38 -05:00
Nicolas Dufresne
d90b6ec459 v4l2videoenc: Call stop on object before renegotiation
Otherwise renegotiation fails as we are still streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=791338
2018-01-08 17:20:52 -05:00
Nicolas Dufresne
a46756bd56 v4l2videoenc: Remove dead code
gst_v4l2_object_stop() will free and nullify the pool, so the
following if will never be true.

https://bugzilla.gnome.org/show_bug.cgi?id=791338
2018-01-08 17:20:52 -05:00
Nicolas Dufresne
4aa5298f56 v4l2videoenc: Delay capture pool activation
This is support CODA driver which prevents setting the output format if
the capture is streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=791338
2018-01-08 17:20:52 -05:00
Nicolas Dufresne
97985a335c v4l2videodec: Add dynamic resolution change support
This implements a "big hammer" reallocation method. We effectively
drain and stop both side of the decoder and restart. This though is
the most generic method. This change should enable on most drivers
adaptive streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=752962
2018-01-08 17:16:22 -05:00
Nicolas Dufresne
4632f33334 v4l2deviceprovider: Don't do slow probes
This is problematic in the current design at it seriously slow down
startup of applications. As of now, no known application uses the
colorimetry and the interlace-modes for anything (the two fields that
won't be probed). So let's disable it, in the long term we'll try and
find a way to interact with the provider so applicaiton could opt-in
these slow probing methods for more advance configuration.
2017-12-22 10:30:49 -05:00
Nicolas Dufresne
80815c292a v4l2object: Don't redefine mmap64
On Linux, there exist a case where mmap64 is already a define to mmap,
so avoid the redefine warning here.
2017-12-22 10:30:49 -05:00
Ting-Wei Lan
4026211154 v4l2object: Don't use mmap64 if off_t is 64-bit
The difference between mmap and mmap64 is the type of 'offset' argument.
mmap64 always uses a 64-bit interger as offset, while mmap uses off_t,
whose size can vary on different operating systems or architectures.

However, not all operating systems support mmap64. Fortunately, although
FreeBSD only has mmap, its off_t is always 64-bit regardless of
architectures, so we can simply use mmap when sizeof(off_t) == 8.

https://bugzilla.gnome.org/show_bug.cgi?id=791779
2017-12-22 10:30:49 -05:00
Nicolas Dufresne
24f01944ee Revert "v4l2object: Use mmap64 to match libv4l2 signature"
This reverts commit b61bba4848.
2017-12-22 10:30:13 -05:00
Ting-Wei Lan
784348235a v4l2object: Check for mmap64 before using it
mmap64 is not available on FreeBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=791779
2017-12-21 21:58:29 -05:00
Nicolas Dufresne
e575e4eda8 v4l2object: Use a debug object for tracing
This way we can pass the pad name instead of the element for tracing
which helps identifying which v4l2object is used withing M2M element
like decoder, encoder and transform. For the reference, pads are name
<parent-name>:<pad-name>.
2017-12-13 14:42:25 -05:00
Philipp Zabel
5e05cadb17 v4l2videodec: Handle drivers that only round up height
Commit 1f31715c98 ("v4l2videodec: use visible size, not coded size,
for downstream negotiation filter") added support for removing the
padding obtained as the difference between width/height from G_FMT and
visible width/height from G_SELECTION from the probed caps obtained
via TRY_FMT.
This patch fixes the padding removal for drivers that only round up
height, but not width, to the padded frame size. This might happen
because horizontal padding can be handled by line stride (bytesperline),
but there is no such thing as plane stride in the V4L2 API for
single-buffer planar formats.

https://bugzilla.gnome.org/show_bug.cgi?id=791271
2017-12-06 14:01:02 -05:00
Florent Thiéry
a315810640 v4l2object: Fix dmabuf support detection
This resulted in improper selection of dmabuf on unsupported drivers.
The checked ioctl errno was not correct.

https://bugzilla.gnome.org/show_bug.cgi?id=790940
2017-11-29 10:13:44 -05:00
Jan Alexander Steffens (heftig)
7e4bc6d418 v4l2deviceprovider: Ignore touch sensing devices
With GST_V4L2_USE_LIBV4L2=1, my laptop's touchpad shows up as a video
source device in gst-device-monitor, but attempting to stream from it
fails because the device doesn't actually support any video formats.

name  : Synaptics RMI4 Touch Sensor
class : Video/Source
caps  : video/x-raw, format=(string)I420, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)0, height=(int)0, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1;
        video/x-raw, format=(string)YV12, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)0, height=(int)0, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1;
        video/x-raw, format=(string)BGR, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)0, height=(int)0, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1;
        video/x-raw, format=(string)RGB, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)0, height=(int)0, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1;
properties:
        udev-probed = true
        device.bus_path = /sys/devices/rmi4-00/rmi4-00.fn54/video4linux/v4l-touch0
        sysfs.path = /sys/devices/rmi4-00/rmi4-00.fn54/video4linux/v4l-touch0
        device.subsystem = video4linux
        device.product.name = "Synaptics\ RMI4\ Touch\ Sensor"
        device.capabilities = :capture:
        device.api = v4l2
        device.path = /dev/v4l-touch0
        v4l2.device.driver = rmi4_f54
        v4l2.device.card = "Synaptics\ RMI4\ Touch\ Sensor"
        v4l2.device.bus_info = rmi4:rmi4-00.fn54
        v4l2.device.version = 265480 (0x00040d08)
        v4l2.device.capabilities = 2501902337 (0x95200001)
        v4l2.device.device_caps = 354418689 (0x15200001)
gst-launch-1.0 v4l2src device=/dev/v4l-touch0 ! ...

v4l2-ctl -d /dev/v4l-touch0 --list-formats reports:

ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'TD16'
        Name        : 16-bit signed deltas

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'TD08'
        Name        : 8-bit signed deltas

        Index       : 2
        Type        : Video Capture
        Pixel Format: 'TU16'
        Name        : 16-bit unsigned touch data

https://bugzilla.gnome.org/show_bug.cgi?id=789197
2017-11-06 19:34:22 -05:00
Nicolas Dufresne
57d7ae8496 v4l2allocator: Add support for data_offset
In MPLANE mode, the driver may set data_offset, which represent some
padding at the start of the buffer used internally. This portion of the
data need to be skipped, though it is included in bytesused.

This patch removes frame size sanity check as the method used will no
longer work. This check was simply there to help detect broken kernel
drivers. It would be re-implement by estimating the plane size, which is
not totally trivial and may be too much work for a simple debug check.

https://bugzilla.gnome.org/show_bug.cgi?id=733501
2017-11-03 15:47:11 -04:00
Nicolas Dufresne
33e595b41c v4l2videoenc: Fix driver capability dectection
Use the right set of caps when checking if caps intersect. That makes
the check only select the supported devices.
2017-10-07 17:33:41 -04:00
Nicolas Dufresne
cebb5baaa6 v4l2videoenc/dec: Don't leak template caps 2017-10-07 17:33:41 -04:00
Nicolas Dufresne
9ad90f3bf2 v4l2videodec: Protect against null pool in _stop
This may happen if the negotiation fails, as we will have never
created the pools.
2017-10-07 17:33:41 -04:00
Tim-Philipp Müller
97285753fc v4l2: fix build without libv4l
https://bugzilla.gnome.org/show_bug.cgi?id=779466
2017-10-07 15:39:47 +01:00
Enrico Jorns
e9c00c083b v4l2object: auto-detect dmabuf export for V4L2_IO_AUTO on capture side
Issue an invalid VIDIOC_EXPBUF ioctl to the driver to check if the
driver supports dmabuf export. If the driver does not implement the
IOCTL, the error is ENOTTY. Any other error codes mean that the driver
implements VIDIOC_EXPBUF.

https://bugzilla.gnome.org/show_bug.cgi?id=779466
2017-10-05 21:20:19 -04:00
Nicolas Dufresne
fb26575b73 v4l2videodec: Don't leak codec name 2017-09-19 17:55:58 -04:00
Nicolas Dufresne
1f902e2f6e v4l2bufferpool: Don't stop streaming when pool is flushing
The purpose of being able to flush the buffer pool is only to
unlock any blocked operation. Doing streamoff/streamon had the
side effect of turning off and on the camera. As we do a flush_start
/ flush_stop sequence when shutting down, that would cause a really
quick sequence of streamoff/streamon/streamoff/close which was
causing some cameras to stop working.

https://bugzilla.gnome.org/show_bug.cgi?id=783945
2017-09-19 17:33:35 -04:00
Nicolas Dufresne
a08d7cdef5 v4l2src: Ensure all caps a fixated
The code relied on the list compare function to fixate the caps
but if the caps only has one structure, the compare function will
never get called. Capture device for which there is only one
structure in the caps would then get some assertion and later
fail badly.

Instead, fixate before inserting into the list and split the reading
and the fixation of the structures.
2017-09-13 16:05:08 -04:00
Nicolas Dufresne
c56eb21a82 v4l2object: Don't leak the par value 2017-09-13 11:52:09 -04:00
Ian Jamison
85ec6430d9 v4l2object: Handle BT2020 for colorspace and transfer
This was not fully handled in switches and
ub gst_v4l2_object_get_colorspace();

https://bugzilla.gnome.org/show_bug.cgi?id=787313
2017-09-06 11:33:53 -04:00
Ian Jamison
fc5d9c34a7 v4l2object: Fix colorimetry transfer lookup for 4K video
https://bugzilla.gnome.org/show_bug.cgi?id=787160
2017-09-06 11:33:53 -04:00
Nicolas Dufresne
05a5ab0e55 v4l2src: Check if caps have changed after try_fmt
try_fmt will update the caps colorimetry and interlace-mode. Before this
call, those field are missing. The caps equality check was always
failing when a spurious reconfigure event was received.
2017-09-06 11:33:53 -04:00
Cyril Lashkevich
f2372b46bc v4l2bufferpool: Don't mark jpeg frames as deltas
JPEG formats are encoded, but they never have keyframe flag. But in
fact they are keyframes

https://bugzilla.gnome.org/show_bug.cgi?id=785990
2017-08-08 11:09:52 -04:00
Nicolas Dufresne
d8b18f6b8f v4l2bufferpool: Don't drop buffer ref on qbuf
This function no longer take ownership of the buffer.

CID 1414800
2017-08-02 17:18:43 -04:00
Nicolas Dufresne
0e9fe263ca v4l2: Enable VP9 format
This was missing, preventing the encoder and decoder to work
properly. This also adds support for camera that would produce
VP9 (if that exists).
2017-08-02 17:13:55 -04:00
Nicolas Dufresne
a13c24dc8c v4l2: Remove spurious CATEGORY_EXTERN
These have been copy pasted all over the place and are not used anymore.
All object have it's own category now. This fixes build warning since
the VP9 decoder had vp8 category declared.
2017-08-02 12:28:38 -04:00
Nicolas Dufresne
783ac9a9f9 v4l2videoenc: Move the profile/level negotation in the base class
This removes duplicated code across different codec.
2017-08-02 11:28:23 -04:00
Nicolas Dufresne
b0fb95b956 v4l2videoenc: Turn gst_v4l2_is_video_enc into a helper
This reduces the amount of code needed in each codec class.
2017-08-02 09:36:08 -04:00
Nicolas Dufresne
040e25218a v4l2: Add VP8/9 encoder support 2017-08-01 16:01:11 -04:00
Nicolas Dufresne
b61bba4848 v4l2object: Use mmap64 to match libv4l2 signature
https://bugzilla.gnome.org/show_bug.cgi?id=785628
2017-08-01 15:05:35 -04:00
Nicolas Dufresne
ba8aa440bb v4l2bufferpool: Copy flags and timestamp when importing
Whenever we import from downstream pool (userptr or dmabuf-import), we
should copy over the flags and timestamp, otherwise downstream will not
get proper synchronization or will not be able to notice frames that has
corruption in it.

https://bugzilla.gnome.org/show_bug.cgi?id=785680
2017-08-01 09:48:46 -04:00
Nicolas Dufresne
2c7dfff047 v4l2: Add H263 Encoder support 2017-07-31 16:46:25 -04:00
Nicolas Dufresne
27cdcaf363 v4l2: Add missing no-inst header 2017-07-27 13:51:25 -04:00
Nicolas Dufresne
c5d0264bc9 v4l2: Add interface for MPEG4 encoding 2017-07-27 12:12:00 -04:00
Nicolas Dufresne
1762c2e713 v4l2: Ignore register issue and keep probing
Don't stop registering the other dynamic plugins if one registration
fails.
2017-07-27 12:12:00 -04:00
Nicolas Dufresne
6fa565247d v4l2: Update external files with latest
This is copied from the linux kernel with only some include changes so
it works outside the kernel headers.
2017-07-26 20:36:15 -04:00
Nicolas Dufresne
5a6fe4ed29 v4l2: Fix compilation without libv4l2 2017-07-24 16:45:40 -04:00
Nicolas Dufresne
2ee90e2b39 v4l2: Keep ref to element in allocator/pool
Removes the FIXME/Question in the buffer pool and add a ref to the
element in the GstAllocator too. This ref is strictly required to keep
the GstV4l2Object structure around.
2017-07-24 16:27:36 -04:00
Nicolas Dufresne
33f508d508 v4l2object: Removed unused members 2017-07-24 14:27:05 -04:00