Commit graph

57 commits

Author SHA1 Message Date
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
Guillaume Desmottes
8a69e26f16 v4l2: pass v4l2object to GST_V4L2_MIN_BUFFERS()
Will be used to double the number of buffers in alternate interlace
mode.
2020-03-25 12:14:41 +01:00
Guillaume Desmottes
a195d5a4a6 v4l2transform: use alignments from upstream when importing on sink
Try configuring the v4l2 output with the alignments from upstream when
importing its buffers. This allows us to support importing with
non-standard strides and/or heights if supported by the driver.
2019-11-02 12:47:43 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Seungha Yang
dbb4849a32 v4l2: Remove misleading comments
gst_pad_template_new() does not take ownership of the caps
2019-07-09 19:51:20 +09:00
Song Bing
c74a5d870d v4l2transform: set right buffer count.
Set right buffer count to avoid one buffer.
2019-07-04 17:37:30 +00:00
Guillaume Desmottes
443c16e1e3 v4l2: fix use after free when handling events
The sink_event parent function may consume the event so we shouldn't use
it after having calling it.
2019-04-16 14:53:15 +05:30
Philipp Zabel
cdf15e9032 v4l2transform: don't segfault if flushed without pools
The v4l2output and v4l2capture v4l2objects can have pool == NULL if they
have been stopped before.
2019-03-17 13:17:21 +00:00
Guillaume Desmottes
bb2063f632 v4l2transform: fix cdata caps leaks
The cdata structure was freed but not its caps.
It was already done in gst_v4l2_video_dec_subclass_init() and
gst_v4l2_video_enc_subclass_init().
2019-01-17 15:05:45 +00: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
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
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
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
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
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
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
Nicolas Dufresne
3b5cac3659 v4l2: Add an error return to _try/_set_format
This way one can easily ignore errors. Previously, error were always
posted ont he bus.

https://bugzilla.gnome.org/show_bug.cgi?id=766172
2016-06-07 17:02:43 -04:00
Nicolas Dufresne
f9e01a53d8 v4l2transform: Use looser caps for upstream
When we fixate for upstream, try to not introduce new fields when not
needed. This was imported from videoconvert element.
2016-06-06 17:54:10 -04:00
Enrico Jorns
5829f326b0 gstv4l2transform: format fixation for preferring passthrough
* If outgoing format is unfixated, try to set it to input format.

* Call gst_caps_fixate () at end of fixation routine

https://bugzilla.gnome.org/show_bug.cgi?id=766719
2016-06-06 17:53:02 -04:00
Philipp Zabel
3eeef5fa09 v4l2transform: allow to change pixel aspect ratio
Scalers may change width and height independently,
allow to change pixel aspect ratio.

https://bugzilla.gnome.org/show_bug.cgi?id=766712
2016-06-06 17:50:41 -04:00
Philipp Zabel
89a2f0a647 v4l2transform: fix scaling in case of fixed pixel aspect ratio
To change pixel aspect ratio from DAR to PAR, the necessary scaling factor
is DAR/PAR, not DAR*PAR.
For good measure, add debug output similar to the fixed-width and
fixed-height cases.

https://bugzilla.gnome.org/show_bug.cgi?id=766711
2016-06-06 17:45:38 -04:00
Pablo Anton
927ba9332f v4l2-*: Configuring output pool correctly for using drivers min_buffer if present.
Signed-off-by: Pablo Anton <pablo.anton@vodalys-labs.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755736
2016-01-04 16:32:28 -05:00
Nicolas Dufresne
4ecd25d267 v4l2: Fix capture/output-io-mode properties
There was some miss-match in the implementation. This makes it
concistent, though functionally it worked, except the video decoder
output-io-mode getter.
2015-11-19 15:35:36 -05:00
Jean-Michel Hautbois
dd45e45e30 v4l2transform: fix pad closing
Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@veo-labs.com>

https://bugzilla.gnome.org/show_bug.cgi?id=753875
2015-08-20 13:44:46 -07:00
Luis de Bethencourt
911f7b38b9 v4l2transform: fix memory leak
tmp needs to be freed before going out of scope in 'done'.

CID #1308954
2015-07-02 14:37:41 +01:00
Enrico Jorns
3067a60d8e v4l2: Allow scaling in the v4l2*convert element
This is inspired of videoscale and videoconvert elements.

https://bugzilla.gnome.org/show_bug.cgi?id=742917
2015-06-09 18:50:25 -04:00
Nicolas Dufresne
b9992e4347 v4l2: Handle corrupted buffer with empty payload
This allow skipping buffer flagged with ERROR that has no payload.
This is typical behaviour when a recovererable error occured during
capture in the driver, but that no valid data was ever written into that
buffer. This patch also translate V4L2_BUF_FLAG_ERROR into
GST_BUFFER_FLAG_CORRUPTED. Hence decoding error produce
by decoder due to missing frames will now be correctly marked. Finally,
this fixes a buffer leak when EOS is reached.

https://bugzilla.gnome.org/show_bug.cgi?id=740040
2014-11-21 11:29:19 -05:00
Nicolas Dufresne
de6db03b53 v4l2transform: Don't rank it for now
This will prevent the converter to be picked automatically in case
someone implement dynamic converter selection support. I'd like this
to be ranked only for known device, as it's hard to be sure a device is
a converter suited for general purpose. Re-negotiation is also needed
before we can rank it.

https://bugzilla.gnome.org/show_bug.cgi?id=733607
2014-09-09 19:03:50 -04: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
077fcbcf15 v4l2: Cleanup M2M properties
M2M devices were sharing the same properties as src and sink. Most of
these made no sense. This patch reduces the number of propeties and
makes io-mode clearer by having capture-io-mode and output-io-mode. This
also accidently fixed a bug in gstv4l2transform io-mode code, where the
capture io-mode could not be set.

https://bugzilla.gnome.org/show_bug.cgi?id=729591
2014-05-15 19:06:52 -04:00
Nicolas Dufresne
5f10d2b4e2 v4l2transform: Don't leak pool if activation failed
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:48 -04:00
Nicolas Dufresne
a4b5811d22 v4l2: Split flush in start/stop_streaming
This allow calling start streaming later for capture device. Currently it breaks
in dmabuf-import because downstream is holding a buffer that will only be
released after stream-start.

https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:44 -04:00
Nicolas Dufresne
c1792de95e v4l2transform: Flush buffer pools on flush stop
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:40 -04:00
Nicolas Dufresne
a270dc79d9 v4l2transform: Fix NULL check copy paste error
CID 1212129
2014-05-09 12:14:23 -04:00
Nicolas Dufresne
bf1918481d v4l2transform: Fix potential deadlock due to missing break
CID 1212131
2014-05-09 12:12:12 -04:00
Nicolas Dufresne
82a806e63b v4l2: Replace miss-use of crop meta in favour of proper offset
This moves away from copying information and store everything inside
the GstVideoInfo structure. The alignement exposed by v4l2 api
is now handled using proper offset.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
01feadc2e7 v4l2transform: Initilialize debug category 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
6f5edb3b4b v4l2transform: Handle FLUSH_STOP event 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
deb40de4b8 v4l2transform: Add more traces 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
3500e44f17 v4l2transform: Enabled QoS 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
783417ee9f v4l2transform: Implement open/close 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
23e273acb2 v4l2transform: Ensure output pool is configured 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
026f79b5bd v4l2transform: Check if caps have changes before asserting
In set_caps, now checks if caps actually changed and succeed if they didn't
change.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
f6d425bf0f v4l2transform: Install PROP_CAPTURE_IO_MODE with right ID 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
1635697f7e v4l2transform: decide_allocation returns a boolean 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
527df8b888 v4l2transform: Add propose_allocation
This should remove 1 copy between the decoder and the transform.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
f810196b3e v4l2transform: Fixup caps query 2014-05-08 15:56:36 -04:00