Commit graph

1909 commits

Author SHA1 Message Date
Guillaume Desmottes
d1501f0952 v4l2: add alternate interlace mode
When using this mode each frame is split in two fields, each one being
transferred using its own buffer.
This is implemented with the V4L2_FIELD_ALTERNATE field format in v4l2.

This mode is enabled using a caps filter such as
"v4l2src ! video/x-raw\(format:Interlaced\)"

Here are the main changes related to this feature:

- use the INTERLACED caps feature with this mode.

- in this mode both fields of a given frame have the same sequence/offset
so adjust the algorithm checking for lost field/frame accordingly.

- double pool's min number of buffers as each frame requires 2 buffers.

Fix #504
Co-authored-by: Zeeshan Ali <zeenix@collabora.co.uk>
2020-03-25 12:42:12 +01:00
Guillaume Desmottes
0834ef15ce v4l2: display field when setting or trying format
Ease debugging interlacing pipelines.
2020-03-25 12:14:41 +01: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
00893baef9 v4l2: use GST_VIDEO_INFO_FIELD_HEIGHT()
Use GST_VIDEO_INFO_FIELD_HEIGHT() instead of GST_VIDEO_INFO_HEIGHT()
when we actually want the field height rather than the frame height.
So far both are equals but that won't longer be the case when
implementing alternate interlace mode.
2020-03-25 12:14:41 +01:00
Seungha Yang
b0f4831481 v4l2bufferpool: Use unique name for v4l2bufferpool object
Assign unique sequence number to an object name for better debugging
2020-03-23 17:48:19 +00:00
Gordon Hart
05e8dd42e7 v4l2src: decrease gst_v4l2src_create log verbosity
Lower the verbosity of the 'sync' log message emitted
each buffer from gst_v4l2src_create down to LOG(6)
from INFO(4). This brings the logging behavior of
v4l2src closer to the GStreamer guidelines, which
recommend the INFO level be reserved for rare or
one-off messages.
2020-03-10 20:33:04 +00:00
Guillaume Desmottes
48a7381602 v4l2: map GST_VIDEO_FORMAT_BGR15
The GstVideoFormat to v4l2 conversion was missing for BGR15.
2020-02-05 18:22:20 +05:30
Guillaume Desmottes
0f907205de v4l2: fix crash on invalid caps
gst_v4l2_object_set_format_full() was returning FALSE without setting
an error. Caller code (gst_v4l2src_fixate()) was then derefing a
NULL pointer when trying to handle the error.
2020-02-05 18:22:20 +05:30
Stéphane Cerveau
b928517f1e good: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-20 09:30:26 +00:00
Olivier Crête
f66fc2a694 osxaudio: Remove deprecated GTimeVal 2019-12-18 19:48:34 +00:00
Nicolas Dufresne
3bd544418c v4l2bufferpool: Queue number of allocated buffers to capture
Before we do streamon, we queue all capture buffers by calling
resurrect. When the driver supports CREATE_BUFS, this would lead
to buffers being allocated till the maximum of 32 is reached.

Instead, we now save the number of allocated buffers and queue this
amount.
2019-11-20 11:03:19 -05:00
Nicolas Dufresne
23089e9cc3 v4l2object: Workaround bad TRY_FMT colorimetry implementation
libv4l2 reset the colorpace to 0 and does not do any request to the
driver. This yields an invalid colorspace which currently cause a
negotiation failure. This workaround by ignoring bad values during the
TRY_FMT step.
2019-11-18 18:29:48 +00:00
Niels De Graef
7cf4ab6229 Don't pass default GLib marshallers for signals
By passing `NULL` to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-17 15:32:30 +00:00
Guillaume Desmottes
e9c10713a3 v4l2object: update match_buffer_layout() debug messages
It's no longer used only to try importing buffers.
2019-11-05 14:54:40 +05:30
Guillaume Desmottes
91002389b9 v4l2object: try matching buffer layout from downstream
Ask v4l2 to produce buffers matching the buffer layout requested
downstream.
2019-11-05 14:54:40 +05:30
Guillaume Desmottes
31c753a3fb v4l2object: factor out gst_v4l2_object_match_buffer_layout()
No semantic change.
2019-11-05 14:52:22 +05:30
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
Guillaume Desmottes
a92000ebb9 v4l2object: add support for vertical padding when importing buffers
We were already supporting horizontal padding by setting bytesperline to
the buffer stride but not vertical one.

We are now updating the format height with the padded height and crop to
the actual video resolution if needed.
2019-11-02 12:47:43 +01:00
Guillaume Desmottes
07930aea73 v4l2object: fix debug message if driver rejects stride
The 'want' and 'got' strides were inversed.
2019-11-02 12:47:43 +01:00
Guillaume Desmottes
3a05ef4798 v4l2: improve logs when importing buffers
Log strides and offsets from upstream.

Also fix a typo.
2019-11-02 12:47:43 +01:00
James Cowgill
51b83d5ca1 v4l2videodec: ensure pool exists before orphaning it
In commit e2ff87732d ("v4l2videodec: support orphaning") support for
orphaning the capture buffer pool was added when the format is
renegotiated. However, the commit forgot to check that a pool existed
before doing this. This is needed because it's possible for the format
to be renegotiated before a capture pool is allocated, which would
result in trying to orphan a NULL pool and lead to a NULL pointer
dereference.

Fix this by checking a pool exists first. If the pool doesn't exist,
there are no buffers to be reclaimed, so skip the allocation query in
that case.
2019-10-29 14:46:22 +00:00
Edward Hervey
8e1c224fbc good: Avoid usage of deprecated API
GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26
2019-10-16 07:46:58 +00:00
Javier Celaya
3f21c89bb0 osxaudio: misspelled dependency
When building osxaudio, the required 'AudioToolbox' dependency is
misspelled as 'AudioToolBox', which crashes the build with error:
ld: framework not found AudioToolBox
2019-10-14 15:33:30 +00:00
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Tim-Philipp Müller
6e8e3910d3 v4l2videoenc: fix wrong type cast
Follow-up to commit 1b752c0f !361
2019-10-13 12:46:58 +01:00
HuQian
9dcb626e3a is a typo here? gstv4l2object.c 2019-10-12 15:26:40 +00:00
Kevin Song
9d42b2dd5d v4l2videodec: Check stop in flush() to avoid race condition.
Backward playback will drain and flush every frame. Stop playback
when backward playback have race condition between exit thread and
streaming thread flush. Add one check to avoid it.

Fixes #639
2019-10-11 12:27:12 +00:00
Fuwei Tang
1b752c0fa8 v4l2videoenc: fix type conversion errors 2019-10-11 10:45:58 +08:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Philipp Zabel
5c8d8723d2 v4l2: Add MPEG-2 profile and level support
Add support for V4L2 MPEG-2 decoders reporting supported profiles and
levels.
2019-09-27 08:47:20 +02:00
Philipp Zabel
2b1658fca2 v4l2object: add support for ABGR, xBGR, RGBA, and RGBx formats
Map them to the new V4L2_PIX_FMT_{BGRA32,BGRX32,RGBA32,RGBX32} pixel
formats.
2019-09-25 10:44:13 +02:00
Philipp Zabel
06a084d70c 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 typo fixes in enum v4l2_mpeg_video_multi_slice_mode,
MPEG-2 level and profile enums, new FWHT and H.264 Qp controls, new
RGB(A) formats, and new continuous bytestream and dynamic resolution
format flags.
2019-09-25 10:44:13 +02:00
Matthew Waters
b0522aa8f7 osxvideosink: call superclass in reshape
Fixes macos werror build

../sys/osxvideo/cocoawindow.m:437:1: error: method possibly missing a [super reshape] call [-Werror,-Wobjc-missing-super-calls]
}
^
2019-08-30 14:12:29 +10:00
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
Tim-Philipp Müller
bf14759477 dv, gtk, qt, osxaudio, osxvideo, waveform: add to plugins list
Makes sure the paths for these plugins are included in the
uninstalled plugin paths list. And also for the docs.

Fixes #604
2019-05-29 14:56:37 +00: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
Dan Kegel
dfe1f6d803 osxvideo: fix mac os 10.14 build
lockFocusIfCanDraw is deprecated in mac os 10.14.  Apple suggests a
different way to do what that does, but for now, just suppress the deprecation.

There's no way to disable just that deprecation, so shut them all down.

OpenGL is also deprecated in mac os 10.14.  There is a gentle way to
turn off just those deprecations (GL_SILENCE_DEPRECATION), but since
this commit turns them all off, that's moot.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/577
2019-04-08 16:27:13 -07:00