Commit graph

192 commits

Author SHA1 Message Date
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
Hugues Fruchet
a2d00122ed v4l2object: do not emit "parsed" caps for vp8
VP8 doesn't require parsing (vp8parse doesn't exist, so negotiation with demux fails
if "parsed" is set in caps).

https://bugzilla.gnome.org/show_bug.cgi?id=724636
2014-02-25 16:11:23 -05:00
Nicolas Dufresne
82f2bf052a v4l2: Don't require parser for VP8
Until GStreamer has one (see bug722760), we should not require a parser for VP8.

https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:11 -05:00
Benjamin Gaignard
2a870d7d9b v4l2videodec: Create one element per device
For each videoCdevice probe it input/output capabilities
if it match with video decoder requirement register a new element.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -05:00
Nicolas Dufresne
bd51c37196 v4l2videodec: Calculate latency from device information
Decoders or other devices that expose a minimum buffers required produce
an first output. We use this information to calculate latency.

https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -05:00
Nicolas Dufresne
4cffae36e3 v4l2: Add NV12_64Z32 support
https://bugzilla.gnome.org/show_bug.cgi?id=722127
2014-01-14 16:51:52 -05:00
Nicolas Dufresne
b39c838ece v4l2object: Add parsed=1 field for encoded output
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:20:21 -05:00
Nicolas Dufresne
5be7d39a3f v4l2object: Don't leak empty caps
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:20:21 -05:00
Nicolas Dufresne
986e5b460d v4l2object: Don't enforce dimension field on encoded formats
Don't enforce having width, height and framerate in template caps for encoded
formats. These don't always need to be exposed and may break negotiation for
decoder and decoding sink. If needed, these field will be automatically added
when probed caps are known.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:20:21 -05:00
Julien Isorce
ba81eeb16b v4l2object: unref downstream pool
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:20:21 -05:00
Benjamin Gaignard
062f4f8710 v4l2object: Add vp8 support
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
e017666645 v4l2object: Don't force framerate field for OUTPUT
If there is nothing that seems to force a certain framerate on output device, it is
preferable to simply not set that feild. This allow negotiation with tsdemux in a
decoder for example.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
97cf8f4d17 v4l2object: _v4l2fourcc_to_structure() can be static
This function is not used anymore outside v4l2object.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
fdd7bcc78c v4l2object: Add MPEG1/2 support
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
0c8ec43a12 v4l2object: Ask for a decent buffer size when dealing with encoded formats
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Julien Isorce
79f2c06883 v4l2object: check if translated format is valid
Also add a FIXME in gst_v4l2_object_setup_format
to note that the whole function has to be improved
in order to support ENCODED formats.
It requires to have an encoder device which we do not
have right now.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
520dda092a v4l2object: Validate returned dimensions
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
61ce7b1a62 v4l2object: Ensure max is not smaller then min in decide_allocation
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
b261287745 v4l2object: Don't keep the max paramter when using our own pool
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
a77d2a64c1 v4l2object: Allocate pool if needed in decide_allocation
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
d79eea15fa v4l2object: Add V4L2_CID_MIN_BUFFERS_FOR_CAPTURE support
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
3cf85c9083 v4l2: Move decide allocation into v4l2object
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
34a8cb09c8 v4l2object: Implement _setup_format()
This method allow setting up the object from the currently configured format on the
device. This is useful for M2M element where input data decides the format that will
be set on capture side.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
41c37a2c6c v4l2object: Split out saving format from set_format()
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Julien Isorce
582f913667 v4l2object: set only one plane for encoded format
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
e2c32ec997 v4l2object: Move code block where it belongs
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:23 -05:00
Nicolas Dufresne
689672ef17 v4l2object: Don't check format specific information
The number of plane, and the stride does not represent a capability change. Same caps
can have different stride from the default GstVideoInfo and the number of planes will
never change for 1 format.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
5faa20b044 v4l2object: Move the extrapolation of stride at the right place
Now that we have a stride array, we should extrapolate only when
eeded (non multi-planar buffer).

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
5f1e47da24 v4l2object: Move back assertions where they should be
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
a64de44a0c v4l2object: Move mplane logic into gst_v4l2_object_get_caps_info()
It makes the gst_v4l2_object_set_format() slightly simplier and will make that
logic reusable. Note that gst_v4l2_object_has_mplane() will always return the
same value for one device. There is no need to check against the caps as this
has already been done by _open.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
4956b46bab v4l2object: Split _v4l2fourcc_to_video_format
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
b80169a16a v4l2object: Don't validate dimension for encoded format
We set the dimensions just in case but don't validate them
afterwards. For some codecs the dimensions are *not* in the
bitstream, IIRC VC1 in ASF mode for example.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
4a85f90c79 v4l2object: Quirks for dev without initial format
Most M2M have undefined behaviour initially when VIDIOC_G_FMT is called.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
080f58166e v4l2object: Add gst_v4l2_object_open_shared()
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
7fd6dc08b9 v4l2object: make IO_MODE enum public
This is to allow adding a second io-mode property on M2M device like decoder so
input and output can be controlled separatly.

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
Nicolas Dufresne
092e7605d3 v4l2: Fix h264 caps
V4L2_PIX_FMT_H264 is documentated as byte-stream (with start code). The ensure proper
negotiation with element like h264parse.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:22 -05:00
Nicolas Dufresne
e821de3494 v4l2object: Split caps in different categories
This is need to correctly expose capabilities on specialized devices
like decoders and encoders.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:13:13 -05:00
Sebastian Rasmussen
3f8b423516 v4l2: Handle v4l2_ioctl() errors even in error handling
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=721268
2014-01-03 10:59:57 +01: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
Nicolas Dufresne
90ac945dcc v4l2object: Use space instead of tabs
https://bugzilla.gnome.org/show_bug.cgi?id=712754
2013-11-25 13:44:50 -05:00
Michael Olbrich
f8f2fc3e86 v4l2: clear cached caps on close
A different device with different caps may be used for the next open.

https://bugzilla.gnome.org/show_bug.cgi?id=712611
2013-11-21 14:14:24 -05:00
Tim-Philipp Müller
d506409af5 docs: get rid of 'Since: 0.10.x' markers
And some gtk-doc markup fixes.
2013-11-18 14:47:35 +00:00
Marc Leeman
be01e80e6b v4l2object: print FOURCC_FORMAT when enumerating
https://bugzilla.gnome.org/show_bug.cgi?id=712206
2013-11-13 13:52:49 +01:00
Tim-Philipp Müller
51ff79842d v4l2src: print probed caps as caps again in debug log
This got lost during refactoring.
2013-10-03 18:33:01 +01:00
Olivier Crête
d595c08aca v4l2: Add forward declaration for gst_v4l2_object_get_format_list 2013-08-19 13:19:42 -04:00
Olivier Crête
48caa1712a v4l2: De-duplicate caps probing between src and sink 2013-08-19 13:08:18 -04:00
Michael Olbrich
5c99fefa04 v4l2: don't extract data from caps twice
gst_video_info_from_caps() always extract width, height, interlace mode and
framerate now. It is no longer necessary to do it again for encoded
formats.

https://bugzilla.gnome.org/show_bug.cgi?id=703399
2013-07-02 10:08:46 +02:00
Michael Olbrich
74d217c44b v4l2: improve pixel aspect ratio handling
Instead of just assuming a aspect ratio of 1/1 use VIDIOC_CROPCAP to ask
the device.
This also add a pixel-aspect-ratio property to overwrite the value from the
driver and a force-aspect-ratio property to ignore it.

https://bugzilla.gnome.org/show_bug.cgi?id=700285
2013-06-04 17:37:15 +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