Commit graph

630 commits

Author SHA1 Message Date
Ryan Lortie
a46f667853 v4l2: guard use of ENODATA with #ifdef
Not all systems with v4l have ENODATA defined, so check that we have it
before attempting to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=722953
2014-01-25 18:51:41 +01:00
Michael Olbrich
3978f6ae6c v4l2: set GST_BUFFER_FLAG_DELTA_UNIT when appropriate
https://bugzilla.gnome.org/show_bug.cgi?id=722394
2014-01-17 10:04:34 -05:00
Michael Olbrich
3d2bd4ff49 v4l2bufferpool: don't ref the newly created allocator
Otherwise the allocator will never be deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=712612
2014-01-17 08:32:28 -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
Vincent Penquerc'h
b80e3a4690 v4l2: fix build break using V4L2_CAP_VIDEO_M2M_MPLANE
This may not be defined. Since the previous version used
only the other define (V4L2_CAP_VIDEO_OUTPUT_MPLANE), fall
back on this only when not available.
2014-01-13 09:14:00 +00:00
Julien Isorce
55da3bc885 v4l2bufferpool: check set_config return value in gst_v4l2_buffer_pool_new
https://bugzilla.gnome.org/show_bug.cgi?id=720568
2014-01-10 17:20:21 -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
Julien Isorce
a54b34121f v4l2bufferpool: do not stop a stream not previously started
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
Julien Isorce
c701dcd16c v4l2bufferpool: add gst_v4l2_buffer_pool_flush
STREAMOFF set all v4l2buffers to DEQUEUE state.

Then for CAPTURE we call QBUF on each buffer.
For OUTPUT the buffers are just push back in the GstBufferPool
base class 's queue.
But the loop actually looks like the same.

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
Nicolas Dufresne
86646ce03b v4l2bufferpool: On warn on size change if n_planes > 1
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
994c5d2c93 v4l2bufferpool: Respect the suggested min buffer
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
e1be685c34 v4l2bufferpool: Request buffers only once
VIDIOC_REQBUFS allocates buffer, it has no place inside set_config. Also, some driver do
no allow multiple calls to this ioctl.

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
cf32d6ec43 v4l2object: Implement gst_v4l2_dup()
This will duplicated the FD from another object and copy over the probed result.

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
3c70741e45 v4l2bufferpool: add support for multi-planar V4l2 API in DMABUF mode
Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=712754
2013-12-04 09:28:25 +00:00
Julien Isorce
303cec48db v4l2: refactor by emulating one v4l2_plane in non-MPLANE mode
so that the buffer informations can be retrieved the same way
in both MPLANE and non-MPLANE mode.

Here "emulating" means "manually fill in the plane".

Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=712754
2013-12-04 09:28:08 +00: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
Nicolas Dufresne
f18290226a v4l2object: Fix header indentation so it's readable again
It's unfortunate to have to do this, but with the mix of tabs and space, plus all the random
indentation this header has become very hard to read.

https://bugzilla.gnome.org/show_bug.cgi?id=712754
2013-11-25 13:44:35 -05:00