Commit graph

120 commits

Author SHA1 Message Date
Nicolas Dufresne 25696203c3 v4l2rc: Add DV_TIMINGS query and locking
This adds support to DV_TIMINGS query and locking. The timing width and
height is then used as a preference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne 1b21c1b15b v4l2: Subscribe source_change for the current input
When we subscribe for source-change event, we need to specify for which
input. Make sure we subscribe for the current input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne 293abe0675 v4l2: Add helper to query input status
This is a wrapper around ENUM_INPUT renamed for readability.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne ba3eddebc8 v4l2: Fix input/output index sign
This is an unsigned integer in the kernel API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Nicolas Dufresne 4be9bf4085 v4l2object: Add event helpers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/870>
2021-02-19 16:02:02 -05:00
Víctor Manuel Jáquez Leal 078560e70a v4l2: use GstV4l2Error in gst_v4l2_open()
gst_v4l2_open() is called by gst_v4l2_device_provider_probe_device(),
where the GstV4l2Object is created without an associated GstElement.

If gst_v4l2_open() fails, it raises a bus message, but without an
element, a precondition check fails on
gst_element_message_full_with_details() generating a crash if running
with fatal-warnings debug mode.

GstV4l2Error is a helper to raise error bus messages when it is
appropiated. This patch changes the direct bus messages to this
helper, and the elements will actually send the error message.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/694>
2020-08-11 01:44:17 +00:00
Haihua Hu 0a453cc4a4 v4l2: enhance v4l2 control interface to support string type CID
add string type cid support for v4l2 implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/676>
2020-07-22 14:21:42 +08:00
Aaron Boxer 46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Mauro Carvalho Chehab 55c1274dba v4l2: fix a typo on a debug message at v4l2_calls
suppored -> supported
2019-02-26 13:59:46 +00: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
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
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
Nicolas Dufresne 31d8a1d929 v4l2: Add run-time environment to enable libv4l2
The library has started preventing a lot of interesting use cases,
like CREATE_BUFS, DMABuf, usage of TRY_FMT. As the libv4l2 is totally
inactive and not maintained, we decided to disable it. As a convenience
we added a run-time environment that let you enable it for testing.

  GST_V4L2_USE_LIBV4L2=1

This of course only works if you have enabled libv4l2 at build time.
2017-07-24 14:19:02 -04:00
Nicolas Dufresne a6d224521e v4l2: UVC driver is named uvcvideo these days
The quirk to avoid probing interlacing didn't work anymore as the driver
is now name uvcvideo. This should slightly speed up camera startup.
2017-07-17 20:48:28 -04:00
Nicolas Dufresne 9b9cba3798 v4l2: Make gst_v4l2_get_capabilities static
It's not used outside of v4l2_calls.c
2017-07-17 20:48:28 -04:00
Nicolas Dufresne bec03858fa v4l2: Merge v4l2_calls.h into gstv4l2object.h
First step of a larger cleanup, all function from v4l2_calls are in fact
methods on GstV4l2Object. This split makes the code really confusing.
This also remove no longer unused macros.
2017-07-17 20:48:28 -04:00
Edgard Lima 8635258046 Update Edgard Lima's email
https://bugzilla.gnome.org/show_bug.cgi?id=779230
2017-02-27 00:34:19 +00:00
Nicolas Dufresne 5a9c0aa9f5 v4l2: Also copy device_caps in gst_v4l2_dup
This fixes regression where M2M error out saying they have no output
format (the V4L2 CAPTURE side).

https://bugzilla.gnome.org/show_bug.cgi?id=768195
2016-07-10 21:37:24 -04:00
Luis de Bethencourt eaa01071e0 v4l2: fix multiplanar capture
After switching to using V4L2_CAP_DEVICE_CAPS we lost support for
multiplanar device types. After some research, it looks like
vcap.capabilities treated the multiplanar flag of output and capture
devices equally, but not the new device_caps.

https://bugzilla.gnome.org/show_bug.cgi?id=768195
2016-07-08 19:03:51 +01:00
Reynaldo H. Verdejo Pinochet 4b16b16aaf v4l2: use opened device caps instead of physical device ones
The same physical device can export multiple devices. In
this case, the capabilities field now contains a union of
all caps available from all exported V4L2 devices alongside
a V4L2_CAP_DEVICE_CAPS flag that should be used to decide
what capabilities to consider. In our case, we need the
ones from the exported device we are using.

https://bugzilla.gnome.org/show_bug.cgi?id=768195
2016-07-07 17:46:06 -04:00
Dimitrios Katsaros df9eed0ab5 v4l2: Change warning handling to break infinite message loop
v4l2src can cause an "infinite message loop" when a base control exposed as a
property is not provided by the device. In these cases, if in the warning message
handling for the bus, the GST_DEBUG_BIN_TO_DOT_FILE* category of functions are used,
the src lookup causes a new warning to be posted on the bus, causing a loop.

This patch changes the warning for these controls so they are not posted on the bus.

https://bugzilla.gnome.org/show_bug.cgi?id=758703
2016-04-16 16:36:25 -04:00
Luis de Bethencourt dad26043c3 v4l2: cast unused return to void
Quell unchecked return value defect by casting the return value to void and
making it explicit it is going to be ignored.

CID #206031
2015-04-21 15:21:37 +01:00
Luis de Bethencourt 7ca7b1cd9a Revert "v4l2: fraction is reversed"
This reverts commit b91fe36644.
2015-02-18 19:18:00 +00:00
Luis de Bethencourt b91fe36644 v4l2: fraction is reversed
In the fraction 1 / 2. 1 is the numerator and 2 is the denominator.
The arguments of fraction gst_value_set_fractions() are value,
numerator and denominator.
Also, gst_value_set_fraction() fails if denominator is 0 for obvious
reasons.
2015-02-18 17:49:31 +00:00
Nicolas Dufresne e2fd7e274e v4l2bufferpool: Port to bufferpool flush_start/stop method
Port the buffer pool to use the new flush_start/flush_stop virtual
methods added to GstBufferPool.

https://bugzilla.gnome.org/show_bug.cgi?id=727611
2014-05-26 13:43:30 -04:00
Nicolas Dufresne 2e89f4ecff Revert "v4l2bufferpool: Port to bufferpool flush_start/stop method"
This reverts commit 2e0fb42e86.

Conflicts:
	sys/v4l2/gstv4l2allocator.c
	sys/v4l2/gstv4l2bufferpool.c
	sys/v4l2/gstv4l2videodec.c
2014-05-24 20:00:14 -04:00
Nicolas Dufresne 2e0fb42e86 v4l2bufferpool: Port to bufferpool flush_start/stop method 2014-05-24 15:38:53 -04:00
Nicolas Dufresne a8e81bd81e v4l2: Expose RGB32 formats with and without alpha
As soon a the alpha component can be set, we can expose the RGB32 and BGR32
format as ARGB and BGRA as long we can deterministically set the alpha padding
value.
2014-05-08 15:56:35 -04:00
Vincent Penquerc'h 4d0e1a4536 v4l2: attempt to fix infinite (for small version of infinite) loop 2014-03-29 17:09:02 -04:00
Nicolas Dufresne 418a4940a8 v4l2: Use a copy of videodev2.h header
With years the amount of ifdef have grown up and we are not even sure if the
old code path compiles. Each time we need to update the v4l2 framework to add
the new feature, we break compilation on older kernel. With exception of two
controls in the video orientation control, this patch get rid of all ifdef by
including the latest version of videodev2.h inside GStreamer.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723446
2014-03-15 13:54:47 +01:00
William Manley 4f47442c7f v4l2: Fix typo contol -> control
https://bugzilla.gnome.org/show_bug.cgi?id=725632
2014-03-08 19:29:58 -05:00
William Manley d3bd3ecc3e v4l2: Normalise control names in the same way as v4l2-ctl
V4L2 kernel drivers allow configuration of the hardware settings via a
mechanism called controls.  These can be referred to by name such as
"Brightness" and "White Balance Temperature".  The user-space command line
client for setting these controls (v4l2-ctl) normalises these names such
that they only contain lower case alphanumeric characters and the
underscore '_'.  e.g:

    Kernel                     v4l2-ctl
    ----------------------------------------------------
    Brightness                 brightness
    White Balance Temperature  white_balance_temperature
    Focus (absolute)           focus_absolute

GStreamer seems to want to follow this pattern but failed for controls with
more than one consecutive non-alphanum character.  e.g. GStreamer would
produce "focus__absolute_" rather than "focus_absolute".

This commit fixes that issue.  Backwards compatibility is preserved by
normalising all control names before comparison.

https://bugzilla.gnome.org/show_bug.cgi?id=725632
2014-03-08 19:27:54 -05:00
Nicolas Dufresne a1db7e8c6c v4l2: CAPTURE_MPLANE is well tested now
https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -05:00
Nicolas Dufresne 61183670c0 v4l2videodec: Implement v4l2videodec
Implement an element that can driver V4L2 M2M decoder device.

https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -05:00
Mark Nauwelaerts 433d4f902d v4l2: make some more controls configurable
... at least if one tries hard enough using extra-controls property.
2014-02-23 13:06:43 +01:00
Mark Nauwelaerts 43a9c7652b v4l2src: handle old and odd driver behaviour when listing controls 2014-02-22 21:31:43 +01:00
Ryan Lortie a46f667853 v4l2: guard use of ENODATA with #ifdef
Not all systems with v4l have ENODATA defined, so check that we have it
before attempting to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=722953
2014-01-25 18:51:41 +01:00
Vincent Penquerc'h b80e3a4690 v4l2: fix build break using V4L2_CAP_VIDEO_M2M_MPLANE
This may not be defined. Since the previous version used
only the other define (V4L2_CAP_VIDEO_OUTPUT_MPLANE), fall
back on this only when not available.
2014-01-13 09:14:00 +00:00
Nicolas Dufresne cf32d6ec43 v4l2object: Implement gst_v4l2_dup()
This will duplicated the FD from another object and copy over the probed result.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne 203e245134 v4l2: better handle quirks activation
This way we can activate deactivate those quirks all at once at one
place.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Julien Isorce 61ae84b50d v4l2: add support for multi-planar V4L2 API
This api is in linux kernel since version 2.6.39,
and present in all version 3.

The commit that adds the API in master branch of the
linux kernel source is:
f8f3914cf9

v4l2 doc: "Some devices require data for each input
or output video frame to be placed in discontiguous
memory buffers"

There are newer structures 'struct v4l2_pix_format_mplane'
and 'struct v4l2_plane'.
So the pixel format is not setup with the same API when using
multi-planar.

Also for gst-v4l2, one of the difference is that in GstV4l2Meta
there are now one mem pointer for each maped plane.

When not using multi-planar, this commit takes care of keeping
the same code path than previously. So that the 2 cases are
in two different blocks triggered from V4L2_TYPE_IS_MULTIPLANAR.

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=712754
2013-12-04 09:27:20 +00:00
Michael Olbrich 0769a78dd1 v4l2: iterate controls with V4L2_CTRL_FLAG_NEXT_CTRL if possible
In v2.6.18 control classes where added to the v4l2 API.
Iterating over CIDs starting with V4L2_CID_BASE will only find controls for
the first control class.
By iterating with V4L2_CTRL_FLAG_NEXT_CTRL all controls are found.

This is necessary to make controls from other control classes available in
the extra-controls property.

If V4L2_CTRL_FLAG_NEXT_CTRL is not defined at compile time or not supported
at runtime then the old mechanism for iterating is used.

https://bugzilla.gnome.org/show_bug.cgi?id=701540
2013-06-05 13:00:21 +02:00
Stirling Westrup 86405d6ee7 v4l2: Fix compilation with older kernels
https://bugzilla.gnome.org/show_bug.cgi?id=701595
2013-06-04 17:04:11 +02:00
Sebastian Dröge 82e7826af0 v4l2: Only conditionally use V4L2_CTRL_TYPE_INTEGER_MENU, it's not available in older versions 2013-05-29 20:35:41 +02:00
Michael Olbrich 0fb59275b0 v4l2: add a property for arbitrary v4l2 controls
This makes it possible to set any controls that can be set with
VIDIOC_S_CTRL.
The controls are set when the property is set (if the device is open)
and when the device is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=698837
2013-05-29 20:18:11 +02:00
Michael Olbrich d4126ff986 v4l2: also poll for output devices
Note that the V4L2 API defines that for output devices POLLOUT
indicates that a buffer is ready to be dequeued.

https://bugzilla.gnome.org/show_bug.cgi?id=698992
2013-04-27 09:31:29 +01:00
Philipp Zabel 305023fe9d v4l2: handle ENODATA return value for VIDIOC_ENUMSTD
In kernel v3.7-rc1, VIDIOC_ENUMSTD returns ENODATA if the current input
does not support the STD API.

https://bugzilla.gnome.org/show_bug.cgi?id=698827
2013-04-25 15:40:59 +02:00
Tim-Philipp Müller 60302a57a4 v4l2: fix printf format compiler warning in debug message 2013-04-02 23:36:22 +01:00
Bastien Nocera 8e633d2059 v4l2: fix compilation against newer kernel headers as on FC19 2013-03-18 14:59:35 +00:00
Robert Krakora ad2f74afbc v4l2: Also handle the new ENOENT return value of VIDIOC_QUERYCTRL
https://bugzilla.gnome.org/show_bug.cgi?id=691098
2013-01-04 10:04:26 +01:00