Commit graph

1174 commits

Author SHA1 Message Date
Nicolas Dufresne
45b6514f33 v4l2: Fix type compatibility issue with glibc 2.30
From now on, we will use linux/types.h on Linux, and use typedef of the
various flavour of BSD.

Fixes #635
2019-08-10 11:01:26 +01: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
Song Bing
f49d610ebe v4l2videodec: Fix drain() function return type
Return right type for drain() function.
2019-06-24 14:43:21 +00:00
Tim-Philipp Müller
92e4ecef4c v4l2: fix compiler warning due to c99-ism 2019-06-24 09:42:31 +00:00
Philippe Normand
4fb749d99f v4l2: Fix H.264 level 3 string representation
The string_to_level function handles "3" so the level_to_string function should
do the same, to prevent caps negotiation issues.
2019-06-05 10:23:40 +01:00
Philippe Normand
6ce195e9d1 v4l2: Profile and level probing support for encoders and decoders
There used to be some profile/level support in encoders. This code was moved to
GstV4l2Codecs and is now also used for decoders. The caps templates for the
H.264, H.265, MPEG4, VP8 and VP9 encoders and decoders should now reflect the
profiles and levels advertised by the kernel.
2019-06-05 10:23:40 +01:00
Damian Hobson-Garcia
a493bcd549 v4l2object: Orphan buffer pool on object_stop if supported
Use V4L2 buffer orphaning, on recent kernels so that
the device can be restarted immediately with
a new buffer pool during renogatiation.
2019-06-03 19:09:24 +00:00
Damian Hobson-Garcia
50dfbf1c0d v4l2bufferpool: Free orphaned allocator resources when buffers are released
Allocator resources cannot be freed when a buffer pool is orphaned
while its buffers are in use. They should, however, be freed once those
buffers are no longer needed. This patch disposes of any buffers
belonging to an orphaned pool as they are released, and makes sure
that the allocator is cleaned up when the last buffer is returned.
2019-06-03 19:09:24 +00:00
Damian Hobson-Garcia
1b9a0f1c2d v4l2bufferpool: return TRUE when buffer pool orphaning succeeds
When trying to orphan a buffer pool, successfully return and unref
the pool when the pool is either successfully stopped or orphaned.
Indicate failure and leave the pool untouched otherwise.
2019-06-03 19:09:24 +00:00
Mathieu Duponchelle
f554369ed5 doc: remove xml from comments 2019-05-29 22:20:40 +02:00
Thibault Saunier
38c5ba90b3 doc: Fix some docstrings 2019-05-13 17:00:00 -04:00
Thibault Saunier
af01988534 doc: Port documentation to hotdoc 2019-05-13 11:34:56 -04:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04: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
603c7a52fd v4l2: remove __user define from types-compat.h
Remove the now unused __user define.
2019-04-05 16:01:55 +00:00
Philipp Zabel
40db843efd v4l2object: use opRGB colorspace and xfer func defines
AdobeRGB defines have been renamed to opRGB in the kernel headers,
use the new names.
2019-04-05 16:01:55 +00:00
Philipp Zabel
e2ff87732d v4l2videodec: support orphaning
Recent kernels allow REQBUFS(0) on a queue that still has buffers in
use (mmapped or exported via dmabuf), orphaning all buffers on the queue.
If this is supported, the v4l2videodec element does not have to send a
drain request downstream.
2019-04-05 16:01:55 +00:00
Philipp Zabel
dfc20013cc v4l2bufferpool: support orphaning
Now that the v4l2allocator allows orphaning the V4L2 buffer queue, add
support for orphaning in the v4l2bufferpool. gst_v4l2_buffer_pool_orphan
can be used as a replacement for gst_v4l2_buffer_pool_stop, without
having to wait for buffers to be returned to the pool.
2019-04-05 16:01:55 +00:00
Philipp Zabel
0948ce0478 v4l2allocator: support orphaning
Recent kernels allow REQBUFS(0) on a queue that still has buffers in
use (mmapped or exported via dmabuf), orphaning all buffers on the queue.

Orphaning the allocator causes it to release all buffers with
REQBUFS(0), even if they are still in use. An orphaned allocator can
only be stopped. It can not be restarted or create new buffers.
2019-04-05 16:01:55 +00:00
Philipp Zabel
5d904530c1 v4l2: update kernel headers to latest from media tree
Update to the latest installed headers (output of make headers_install)
from the media tree, keeping the slight modifications to the includes.

This includes new HEVC controls, the AdobeRGB -> opRGB rename, a new
capabilities field for v4l2_requestbuffers and v4l2_create_buffers, new
32-bit YUV formats, and request_fd changes.
2019-04-05 16:01:55 +00:00
Guillaume Desmottes
e3c4b80750 v4l2src: preserve features when fixating caps
The caps features were lost when sorting caps structures in
gst_v4l2src_fixate(). This was breaking alternate as
GST_CAPS_FEATURE_FORMAT_INTERLACED was removed from the caps.
2019-04-05 13:22:58 +00:00
Philipp Zabel
16e5b32bc1 v4l2videoenc: set GstVideoCodecFrame sync point flag
The V4L2 elements already set the delta unit buffer flag when dequeueing
the buffer, but gst_video_encoder_finish_frame overwrites it from the
passed codec frame's sync point flag. Set the flag correctly.
2019-03-21 18:05:51 +00:00
Philippe Normand
75f26bc954 v4l2: Set Hardware classifier on encoders 2019-03-18 10:51:15 +00:00
Philippe Normand
3296a4b7e2 v4l2: Set Hardware classifier on video decoders 2019-03-18 10:51:07 +00:00
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
Philipp Zabel
8b068fb78b v4l2sink: fix pool-less allocation query handling
This fixes a critical warning if the last-sample property is enabled:

  (gst-launch-1.0:391): GStreamer-CRITICAL **: 01:12:57.428: gst_object_unref: assertion 'object != NULL' failed

If the allocation query does not contain any allocation pools,
gst_query_parse_nth_allocation_pool will leave the local pool,
min, and max variables undefined, so check the array length first.
If pool is NULL, do not call gst_object_unref.
2019-03-08 22:01:14 +01:00
Mauro Carvalho Chehab
dc7bd48326 v4l2: accept Bayer as possible input/output for V4L2 codecs
A V4L2 transform codec may input/output data on Bayer format.

Add support for that.
2019-02-26 13:59:46 +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
Matthew Waters
0acbf40060 v4l2dec: also remove the colorimetry and chroma-site fields
If a different format is chosen, then these values are incorrect.
2019-02-26 07:04:54 +00:00
Guillaume Desmottes
e7b84b0f6c v4l2: mark caps from probe as MAY_BE_LEAKED 2019-01-17 15:05:45 +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
Guillaume Desmottes
dab84b14dd v4l2: Avoid code duplication
The function gst_v4l2_object_add_interlace_mode() has repeating code so
it's best use a loop instead. That will make it easy and simple to add
additional interlace modes in a following patch.
2018-12-17 15:30:47 +00:00
Zeeshan Ali
40fee8eeeb v4l2: Make use of gst_video_interlace_mode_to_string()
Instead of a custom map to translate the interlace modes to strings, let's
make use of the base API provided.
2018-12-17 15:30:47 +00:00
Maciej Wolny
ec655de288 Remove duplicate declarations
This causes 'redefinition of typedef ...' errors on GCC 4.5.3
2018-12-04 11:13:02 +00:00
Jordan Petridis
515ada7e22
Run gst-indent through the files
This is required before we enabled an indent test in the CI.

https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
2018-11-28 05:52:16 +02:00
Nicolas Dufresne
3b22a604b5 v4l2: Properly fix Android build
The previous patch did not even compile on any possible platform or C
standard. That commit also didn't have a proper commit message.

Android ships Linux with a different signature for ioctl. They first
released an ioctl with int as request type, and later "fixed" it by
adding an override with unsign, which is still not matching Linux and
BSD implementation which uses unsigned long int.
2018-11-21 18:58:38 -05:00
Xavier Claessens
0e2d0adac5 Fix ioctl() signature on Android 2018-11-21 16:11:02 -05:00
Nicolas Dufresne
dbaca549ab v4l2object: Read driver selected interlace mode
If there was no interlace-mode field in the caps. Read back the value
selected by the driver. This way, if the driver does not support
progressive, then it will automatically negotiate the returned mode
unless this mode is not supported by GStreamer.

This method was already used for colorimetry. Just like colorimetry, the
interlace mode is not longer probed by v4l2src dues to performance
issues.

Fixes #511
2018-11-07 19:29:51 -05:00
Wonchul Lee
560a6155bd v4l2bufferpool: fix typo resurect to resurrect
https://bugzilla.gnome.org/show_bug.cgi?id=797273
2018-10-24 12:03:13 +01:00
Amit Pandya
15429ee411 v4l2videoenc: Add HEVC support
Add HEVC encoder support.

https://bugzilla.gnome.org/show_bug.cgi?id=797141
2018-10-24 12:01:59 +01:00
Nicolas Dufresne
f2fa61b6c5 vl42allocator: Don't dup exported dmabufs
We can now use the new GstFAllocator to ask the allocator not to close
the wrapped FD. This way the dup is no longer needed.
2018-10-24 11:55:32 +01:00
Nicolas Dufresne
b25a01fab9 v4l2allocator: Don't dup imported DMABuf FD
There is no specific needs to duplicate the FD. Unlike the exportation,
we don't depend on code that will call close. This will make debugging
easyer since the traced FD will match the exporter.
2018-10-24 11:55:32 +01:00
Song Bing
1dc6881a13 v4l2videodec: Add HEVC decoder support
https://bugzilla.gnome.org/show_bug.cgi?id=771686
2018-09-13 20:48:09 -04:00
Nicolas Dufresne
2510b5937d v4l2videodec: Move capture probe after input format is set
This is to support Amlogic CODEC driver which does not provide a full
list of formats when the driver is initially opened. GStreamer does
not strictly need this full list initially, but only later, in order
to negotiate with downstream if multiple format can be selected.

With this change, we will no longer probe twice the device, since the
probed list can be directly used for negotation.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
7f42b12e8c v4l2: Add a debug message beforing waiting for codec stop
Add a debug message right before waiting for the driver.
This is useful in order to debug drivers without a properly
implemented decoder or encoder stop command.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
09f9b37b0b v4l2: Add a debug message indicating probe operation
It's useful to see the v4l2 element running the probe
operation, to confirm it's turned on and working.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
63535d9086 v4l2: Add JPEG encoding support
This commit adds the support for V4L JPEG stateful encoders.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
944debd3db v4l2: Add FWHT codec support
The recently added vicodec (virtual codec) V4L driver
uses the Fast Walsh-Hadamard Transform for encoding
and decoding.

Add support for it.
2018-09-13 20:48:09 -04:00
Nicolas Dufresne
6e1ad47db1 v4l2: Sync kernel header with linuxtv tree
This notably add HEVC and FWHT support, and VP8/9 profiles are now an
enumeration and their control exposed as a menu.
2018-09-13 20:48:09 -04:00