Commit graph

1714 commits

Author SHA1 Message Date
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
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
4bcec1b190 v4l2object: Fix colorimetry validation
While not documented, gst_video_colorimetry_matches() only accepts well
known names. Looking at the code and unit test, this seems to be on
purpose, so fixing by parsing the string and compating the colorimetry
structures.
2017-07-21 23:34:59 -04:00
Nicolas Dufresne
ef633e28f8 v4l2encoder: Fix negotiation error handling
The subclass negotiated function will call set_format, if that fails the
pool will not be created. We ended up with an assertion.

GStreamer-CRITICAL **: gst_buffer_pool_set_active: assertion 'GST_IS_BUFFER_POOL (pool)' failed
2017-07-21 15:40:24 -04:00
Nicolas Dufresne
b3e089d415 v4l2src: Speedup camera startup by skipping try_fmt
In this commit, we enabled skip_try_fmt_probes quirk in order to speed
up the start which is known to be disastrously slow with certain USB
cameras.

This has the side effect that we needed to rewrite the entire
negotiation process in a way that we iterate over the possible caps
until we find one that works.

The new negotiation method consist of extracting a preferred structure
from the peer caps and using this to fixate and sort the caps. To
reflect the old behaviour, we sort all resolution strictly bigger
to the preferred one with the closes one first. The rest is appended,
keeping the same order. We then normalize the caps in case there was
some list of interlace-mode or colorimetry left. We finally iterate
over all fixed caps and try it. 99% of the time, the first or the
second one should work, whit the result of a single S_FMT being issues.

From there, it will be relatively easy to introduce new negotiation
algorithm. The current algorithm is made for optimal image quality
with a scaling sink that sets it's window resolution as preference.
This the case if for:

  v4l2src ! videoconvert ! videoscale ! ximagesink

Other strategy would be needed to optimize for non-scaling sink like
ximagesink or kmssink when the driver does not scale.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
cae0b9a2d2 v4l2object: Introduce quirk to skip slow probes
skip_try_fmt_probes quirk is set, V4L2 object will not probe for
interlace-mode and colorimetry to avoid relying on try_fmt. This quirk
will be used by v4l2src to avoid desastrous startup time with slow
USB webcams.

When this quirk is enabled, caller will have to iterate over the
negotiated caps as it may contains unsupported formats. If the peer
didn't choose a specific interlace-mode, or colorimetry, the value
chosen by the driver is set into the caps. For this reason, when this
mode is enabled, gst_v4l2_object_set_format() will require writable
caps.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
7d3b2628df v4l2object: always set the GstV4l2Error on error
Some of the error case were conditional to using try_fmt or not.
This is slightly unexpected, always set the error so the caller
can decide.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
059ccf9749 v4l2object: Minor style fix and useful trace
https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
c00d4cae3c v4l2object: Fix try/s_fmt errors
According to the spec,TRY_FMT cannot return EBUSY, though it can
return EINVAL if it was not possible to update the format to
something supported.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
558e9f4e57 v4l2object: Validate colorimetry in S/TRY_FMT
This is in preparation for removing slow TRY_FMT probes for
colorimetry. As we won't have tried that colorimetry we cannot
assume the driver will accept it.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
336c8a7dad v4l2object: Validate field in S/TRY_FMT
This is in preparation from removing the slow TRY_FMT probes for
interlacing. As we won't have tried that interlace-mode already
we need to validate that the driver isn't refusing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
2017-07-21 15:29:10 -04:00
Nicolas Dufresne
a3545637de directsound: Fix .c file name in Makefile
This was broken by accident, bad search and replace.
2017-07-20 17:21:05 -04:00
Nicolas Dufresne
7edf41b470 waveform: Fix DLL name to match plugin name
https://bugzilla.gnome.org/show_bug.cgi?id=785168
2017-07-20 15:46:38 -04:00
Nicolas Dufresne
608abe4a7f directsound: Fix DLL name to match plugin name
https://bugzilla.gnome.org/show_bug.cgi?id=785168
2017-07-20 15:46:38 -04:00
Nicolas Dechesne
52c017caca v4l2videodec: add some useful debug messages
Add a couple of useful debug traces , they happened to be useful to
debug/investigate a 4K video playback issue with v4l2, so let's make these
changes more permanent.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>

https://bugzilla.gnome.org/show_bug.cgi?id=785109
2017-07-19 10:25:11 -04:00
Nicolas Dufresne
6d0a9abdf0 v4l2: Fix 4K colorimetry
Since 1.6, the transfer function for BT2020 has been changed from BT709
to BT2020_12. It's the same function, but with more precision. As a side
effect, the V4L2 colorpsace didn't match GStreamer colorspace. When
GStreamer ended up making a guess, it would not match anything supported
by V4L2 anymore. This this by using BT2020_12 for BT2020 colorspace and
BT2020 transfer function in replacement of BT709 whenever a 4K
resolution is detected.
2017-07-18 12:03:17 -04:00
Nicolas Dufresne
08643993df v4l2object: Only check CROPCAP for par once
The pixel aspect ratio is documented to not change unless the TV
Standard is changed. So this mean that this will be uniform across all
possible format and resolutions.

https://bugzilla.gnome.org/show_bug.cgi?id=784674
2017-07-18 12:03:17 -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
83cb5ef957 v4l2object: Remove unused defines 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
Nicolas Dufresne
3bbd43f7eb v4l2object: Trace unknown fourcc as text
This makes it easier to find out what is not supported.
2017-07-14 13:31:30 -04:00
Nicolas Dufresne
06424c438e v4l2: Don't probe for unneeded format
For v4l2videodec/enc, we generate elements per formats, and in
this case we can speed up the start up by only probing the format
we care about.
2017-07-14 13:31:30 -04:00
Nicolas Dufresne
724a3ceec5 v4l2videodec: Implement stable element names
Before that, each m2m node would be wrapped as a single, multi-format
decoder element. As a unique name was needed, we where using the device
name, which changes between re-boots. This led to unpredictable element
names. In this patch, we generate an element per codec, using
v4l2<codec>dec name. If there is multiple decoder for the same format,
the following elements will be named v4l2<node><codec>dec.

https://bugzilla.gnome.org/show_bug.cgi?id=784908
2017-07-14 13:31:30 -04:00
Matt Fischer
52a5658030 v4l2: Block recursive calls to resurect_buffer
When resurrecting a buffer, the subsequent free call can result
in the group-released handler being called again, which causes
a recursive loop.  This patch blocks the signal handler during
the time that it executes, ensuring that the loop will not occur.

https://bugzilla.gnome.org/show_bug.cgi?id=759292
2017-06-29 15:54:42 -04:00
Guillaume Desmottes
47ca2ce499 v4l2: increase by one the number of allocated buffers
Increasing this number fix a buffer starvation problem I'm hitting
with a "v4l2src ! kmssink" pipeline.

kmssink requests 2 buffer as it keeps a reference on the last rendered
one. So we were allocating 3 buffers for the pipeline.
Once the first 2 buffers have been pushed we ended up with:
- one buffer queued in v4l2
- one being pushed
- one kept as last rendered

If this 3rd buffer is released after that v4l2 used the first one to
capture we end up with a buffer starvation problem as no buffer is currently
queued in v4l2 for capture.

Fixing this by adding one extra buffer to the pipeline so when one
buffer is being pushed downstream the other can already be queued to
capture the next frame.

We were already adding 3 buffers if downstream didn't reply to the
allocation query. I reduced this number to 2 to compensate the extra
buffer which is now always added.

https://bugzilla.gnome.org/show_bug.cgi?id=783049
2017-06-29 15:13:18 -04:00
Matt Fischer
e8a4678738 v4l2allocator: Fix memory leak with dmabuf
This patch fixes a memory leak that is caused if the dmabuf file
descriptor dup fails.  Previously, _cleanup_failed_alloc() would
not unref the memory because mems_allocated had not yet been
incremented.

https://bugzilla.gnome.org/show_bug.cgi?id=784302
2017-06-28 17:03:05 -04:00
Tim-Philipp Müller
dd23afb6d4 sys: remove sunaudio plugin
Even though hooked up to the build system, it's clear that no one
has ever built or used this with GStreamer 1.x. It wants to link
against libgstinterfaces, which no longer exists. And uses 0.10-style
raw audio caps. And the last meaningful change was done in 2009.
Let's just remove it.
2017-06-23 20:02:43 +01:00
Tim-Philipp Müller
2271fee77e meson: build oss4 plugin
https://bugzilla.gnome.org/show_bug.cgi?id=784134
2017-06-23 19:36:03 +01:00
Tim-Philipp Müller
1fa24b0be3 meson: build oss plugin
https://bugzilla.gnome.org/show_bug.cgi?id=784134
2017-06-23 19:34:16 +01:00
Nicolas Dufresne
b9532fc6fb v4l2videoenc: Make sure min_buffers is valid
When upstream does no use the v4l2videoenc pool, we need to activate
that internal pool. Though, we relied the driver to provide a minimum
required buffer, which Qualcomm Venus driver don't currently provide.

https://bugzilla.gnome.org/show_bug.cgi?id=783361
2017-06-05 10:55:28 -04:00
Edward Hervey
246f21ac2f v4l2videoenc: Don't leak VideoCodecState
CID #1409852
2017-05-26 17:52:19 +02:00
Nicolas Dufresne
85218c69b9 v4l2videoenc: Remove unused function 2017-05-24 14:19:27 -04:00
Nicolas Dufresne
9f936c9244 v4l2: Don't redefine __bitwise if already set
https://bugzilla.gnome.org/show_bug.cgi?id=728438
2017-05-24 14:00:22 -04:00
Ayaka
27310365d5 v4l2: Add Video Encoder support
This implements H264 encoding support using generic V4L2 interface. It is
reported to work with Samsung MFC driver, IXM.6 CODA driver and
Qualcomm mainline Venus driver. Other platform should be supported as
none of this work is platform specific.

The implementation consist of a GstV4l2VideoEnc base class, which
implements the core streaming functionality. This base class is implemented
by GstV4l2H264Enc class that implements the caps negotiation specific to
H264 profiles and level. This implementation supports hardware with multiple
H264 encoder. Though, to make it simplier to use, the first discovered H264
encoder will be named v4l2h264enc. Other encoder found during discovery will
have a unique name like v4l2video0h264enc.

This work is the combined work of multiple developpers in the last 3
years. Thanks to all of the contributors:

  Ayaka <ayaka@soulik.info>
  Frédéric Sureau <frederic.sureau@vodalys.com>
  Jean-Michel Hautbois <jean-michel.hautbois@veo-labs.com>
  Nicolas Dufresne <nicolas.dufresne@collabora.com>
  Pablo Anton <pablo.anton@vodalys-labs.com>

https://bugzilla.gnome.org/show_bug.cgi?id=728438
2017-05-24 14:00:22 -04:00
Nicolas Dufresne
7dc57e381b v4l2videodec: Remove unused forward declaration
https://bugzilla.gnome.org/show_bug.cgi?id=728438
2017-05-24 14:00:22 -04:00
Ayaka
17e52f6ac2 v4l2pool: Fix wrong error message
https://bugzilla.gnome.org/show_bug.cgi?id=728438
2017-05-24 14:00:22 -04:00
Ayaka
342de49bf6 v4l2: increase pre-allocated encoded buffer size
As of today, the MFC encoder often need to exceed that 1 MB
size for encoded buffer we fixed earlier for decoding.

https://bugzilla.gnome.org/show_bug.cgi?id=728438
2017-05-24 14:00:22 -04:00
Josep Torra
d699dc615e osxaudio: fixes playback of mono streams with no channel-mask field in caps
Fixes a negotiation error seen when trying to playback of a .MOV file with
a mono AAC audio stream decoded by avcdec_aac that doesn't set channel-mask
field but sink was requiring channel-mask=0x3.
2017-05-20 18:33:42 +02:00
Josep Torra
7348ed5faa osxvideo: fix macOS 10.12 deprecation warnings
Add #defines to allow older versions of macOS to use the new constant names.
2017-05-20 11:37:27 +02:00
Sebastian Dröge
2c6016667b gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:41:01 +03:00
Nicolas Dufresne
b68d936ae0 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:41:19 -04:00
Dustin Spicuzza
a303a7971c directsoundsink: Use GstClock API instead of Sleep() for waiting
It's more accurate and allows cancellation.

https://bugzilla.gnome.org/show_bug.cgi?id=773681
2017-05-08 17:33:38 +02:00