Commit graph

339 commits

Author SHA1 Message Date
Guillaume Desmottes
1840fa9363 v4l2object: fix caps leak
gst_v4l2_object_probe_caps() was taking an extra ref on the returned
caps for no reason.

https://bugzilla.gnome.org/show_bug.cgi?id=766610
2016-05-25 13:40:54 -04:00
Wim Taymans
c9c051d53d v4l2: avoid leaking GValues
unset the GValue if we don't use it any more to avoid leaks.
2016-04-12 11:56:08 +02:00
Aurélien Zanelli
c163250f0d v4l2object: probe all colorspace supported by device
A device can support more than one colorspace for a given image
dimension and pixel format. So we have to probe all the supported
colorspace and not only rely on the default one. Otherwise we could end
up with negotiation failure if the caps colorimetry field don't match
the v4l2 device default one even if the v4l2 could support such
colorimetry.

This patch enable probing if colorspace for both capture and output
device. It really makes sense for output device since the colorspace
shall be set by the application and a little less for capture device
which, at the moment, shall provide the colorspace; ie: the v4l2
specification seems to not take into account the fact that a capture
device could do colorspace conversion.

As a side effet, probing takes some times and so sligthly delay v4l2
initialization. Note that this patch only probe colorspace and not all
colorspace, matrix, transfer and range combination to avoid taking too
much time, especially with low-speed devices as full probing do 1782
ioctl.

https://bugzilla.gnome.org/show_bug.cgi?id=755937
2016-03-24 14:05:45 -04:00
Alban Bedel
d746e1ef51 v4l2object: fix capture with bayer formats other than bggr
gst_v4l2_object_get_caps_info() always return V4L2_PIX_FMT_SBGGR8
for all bayer formats. This is obviously broken if the device use
another ordering. Fix this by properly reading the format parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=763318
2016-03-08 11:15:08 -05:00
Josep Torra
c65b66432e v4l2: fix colorimetry for NV12
Replicate V4L2_MAP_QUANTIZATION_DEFAULT macro behavior.
At #v4l it was described that documentation might be wrong and that
we should trust this macro instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762529
2016-03-07 11:36:59 -05:00
Nicolas Dufresne
0569178ca7 v4l2: Re-add colorimetry field for RGB formats
This time, check if it's an RGB format and sets the transformation
matrix to identity. The rest of the colorimetry information is
meaningfull and shall be kept.

https://bugzilla.gnome.org/show_bug.cgi?id=759624
2016-01-22 14:17:24 -05:00
Wim Taymans
710ab7f083 v4l2: fix sRGB colorspace definition
V4l2 can also use the sRGB colorspace for YUV formats and thus needs a
default matrix.
2016-01-22 10:05:01 +01:00
Wim Taymans
681bab62e5 v4l2: Add adobe colorspace support
Use the new primaries and transfer function for Adobe RGB.
Explicitly list the colorimetry instead of using the default GStreamer
ones. The defaults for BT2020, for example, do not match.
Explicitly set the matrix of SRGB to RGB.
2016-01-21 10:49:44 +01:00
Nicolas Dufresne
496137854b v4l2object: Cleanup uneeded return statement 2016-01-19 15:17:50 -05:00
Nicolas Dufresne
fd32440609 v4l2object: Don't set colorimetry for non YUV formats
Setting colormetry in caps for RGB have no meaning, but worst it
confuses the converters downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=759624
2016-01-19 15:17:50 -05:00
Nicolas Dufresne
2538fee2fd v4l2object: Update formats table
This change add all the new RGB based format. Those format removes the
ambiguity with the ALPHA channel. Some other missing multiplanar format
has been added with some additional cleanup.
2015-12-18 15:58:01 -05:00
Philipp Zabel
cf29e6c0b7 v4l2: add gst_v4l2_object_probe_caps
Add a variant of gst_v4l2_object_get_caps that bypasses the probed_caps cache.

https://bugzilla.gnome.org/show_bug.cgi?id=733827
2015-11-25 14:32:28 -05:00
Reynaldo H. Verdejo Pinochet
8ef6ecc244 v4l2/object: remove unnecessary NULL check before g_free() 2015-11-15 01:43:08 -08:00
Aurélien Zanelli
aaab7b6ab1 v4l2object: add support of NV16, NV61 and NV24 formats
Mapped respectively to V4L2_PIX_FMT_NV16/V4L2_PIX_FMT_NV16M,
V4L2_PIX_FMT_NV61,V4L2_PIX_FMT_NV61M and V4L2_PIX_FMT_NV24 v4l2 formats.

https://bugzilla.gnome.org/show_bug.cgi?id=758058
2015-11-13 10:29:01 -05:00
Dimitrios Katsaros
a55b9060f8 v4l2: Allow framerate to be large then 100pfs
This limit was arbitrary. We still fixate near 100pfs for compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=752825
2015-07-25 10:40:51 -04:00
Luis de Bethencourt
600942788d v4l2: document fallthrough cases
Pacify coverity and document fallthrough cases in switch statements.

CID #1308948, #1308947, #1308946
2015-06-29 16:05:48 +01:00
Nicolas Dufresne
0f81b2e99c v4l2: Also set colorimetry on output devices
This completes the code that set the colorimetry on output
device.
2015-06-08 19:14:41 -04:00
Nicolas Dufresne
87a4884acd v4l2: Add missing SMTP240M matrix
This is missing in the doc, but was in the header.
2015-06-08 19:14:41 -04:00
Nicolas Dufresne
b5d66d68ce v4l2object: Fully implement colorimetry support
This fixes wrong mapping for sRGB as in GStreamer sRGB correctly
apply to RGB formats, while in V4L2 it's an alias for sYCC. Also
add support for the new quantization (range), ycbcr_encoding (matrix)
and xfer_func (transfer) enumeration.
2015-06-08 17:56:48 -04:00
Nicolas Dufresne
0196fdb5ec v4l2: Don't warn when optional CID are not implement
gst_v4l2_get_attributre() shall only be used when the CID is expected
to be supported. Otherwise, we get unwanted warning posted to the bus.
2015-06-05 15:34:12 -04:00
Wim Taymans
8c116cfcd8 v4l2: don't add the same interlace mode twice
Some drivers modify the interlace mode to progressive, no matter what
input you give them, make sure that we don't add the same interlace mode
twice.
2015-04-22 18:05:24 +02:00
Tobias Modschiedler
8390288a6e v4l2: Ask the driver about its requirements for min_buffers before initiating buffer pool.
If propose_allocation() had not been called yet, it was possible that the driver was not asked at all.
In buffer pool: Consider minimum number of buffers requested by driver when setting config.

https://bugzilla.gnome.org/show_bug.cgi?id=746834
2015-04-02 17:29:19 -04:00
Thiago Santos
6cfa6c0da8 v4l2object: add gst_v4l2_object_try_format
Similar to set_format but it uses TRY_FMT instead of S_FMT

https://bugzilla.gnome.org/show_bug.cgi?id=682770
2015-03-13 18:47:55 +00:00
Aurélien Zanelli
88703ae585 v4l2: query crop configuration after each call of S_CROP
S_CROP ioctl is write-only and the device can adjust crop rectangle so
we query back the crop configuration after each S_CROP to know what has
been done.

https://bugzilla.gnome.org/show_bug.cgi?id=736133
2015-02-26 08:38:32 -05:00
Aurélien Zanelli
7a1613b9e1 v4l2object: set colorspace in caps for capture devices
This information is set by the driver for a capture device, and so could
be forwarded to pipeline by setting the colorimetry in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=743186
2015-02-25 14:48:20 -05:00
Aurélien Zanelli
600027a1ee v4l2bufferpool: fix import_userptr() in single-planar API when n_planes > 1
In the V4L2 single-planar API, when format is semi-planar/planar,
drivers expect the planes to be contiguous in memory.
So this commit change the way we handle semi-planar/planar format
(n_planes > 1) when we use the single-planar API (group->n_mem == 1).

To check that planes are contiguous and have expected size, ie: no
padding. We test the fact that plane 'i' start address + plane 'i'
expected size equals to plane 'i + 1' start address. If not, we return
in error.

Math are done in bufferpool rather than in allocator because the
former is aware of video info.

https://bugzilla.gnome.org/show_bug.cgi?id=738013
2015-02-25 14:25:01 -05:00
Philippe De Muyter
61a5e5af95 v4l2object: recognize and distinguish all bayer arrangements
Up to now, v4l2src recognized only "bggr" amongst the bayer arrangements.
Recognize now also the "rggb", "gbrg" and "grbg" arrangements.

https://bugzilla.gnome.org/show_bug.cgi?id=742363
2015-02-25 14:14:59 -05:00
Nicolas Dufresne
6afd1c5d57 v4l2: Enable copy when no known allocation params
When there is no allocation parameters in the query, enable copy
threshold. When this threshold is reached, the buffer pool will start
copying when the pool reaches a critical level. If the driver supports
CREATE_BUFS, this will be used instead.
2015-02-19 23:16:00 -05:00
Peter Seiderer
c88e042458 v4l2object: reuse caps framerate if not overwritten by v4l2 device
Enables duration setting in v4l2src.

https://bugzilla.gnome.org/show_bug.cgi?id=740403
2015-01-22 18:52:44 -05:00
Nicolas Dufresne
3dae65ede8 v4l2object: Always set format
Right now we try to be clever by detecting if device format have
changed or not, and skip setting format in this case. This is valid
behaviour with V4L2, but it's also very error prone. The rational
for not setting these all the time is for speed, though I can't
measure any noticeable gain on any HW I own. Also, until recently,
we where doing get/set on the format for each format we where
probing, making it near to impossible that the format would match.
This also fixes bug where we where skipping frame-rate setting if
format didn't change.

https://bugzilla.gnome.org/show_bug.cgi?id=740636
2014-12-15 18:38:00 -05:00
Nicolas Dufresne
43d5a523f1 Revert "v4l2: move vb_queue probing from allocator to v4l2object"
This reverts commit ec6b8b84af.
2014-11-24 10:36:30 -05:00
Nicolas Dufresne
3591a91067 Revert "v4l2object: allow to automatic selection of dmabuf"
This reverts commit e6c2ad5571.
2014-11-24 10:33:29 -05:00
Benjamin Gaignard
e6c2ad5571 v4l2object: allow to automatic selection of dmabuf
If the v4l2 queue support dmabuf select this buffer pool mode
and update the query with allocator.
This patch only concern exporting dmabuf and not importing dmabuf
fd from downstream element.

https://bugzilla.gnome.org/show_bug.cgi?id=699382
2014-11-21 11:29:04 -05:00
Benjamin Gaignard
ec6b8b84af v4l2: move vb_queue probing from allocator to v4l2object
The goal is to make those information available in v4l2_object
to be able later to select the best allocation method for the pool

https://bugzilla.gnome.org/show_bug.cgi?id=699382
2014-11-21 11:28:18 -05:00
Tim-Philipp Müller
cde3ce38e1 v4l2src: fix a couple of minor leaks 2014-11-02 23:41:24 +00:00
Simon Farnsworth
02040d507c v4l2: Clean up interlace support
Rather than try and guess interlace support as part of checking supported
sizes, look for interlace support specifically in its own function.

As a cleanup, use V4L2_FIELD_ANY when probing sizes, which should result in
the driver doing the right thing.

With my capture setup, this gets me the following sample caps:

For 1080i resolution:
video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)interleaved, framerate=(fraction){ 25/1, 30/1 }

For 720p resolution:
video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, framerate=(fraction){ 50/1, 60/1 }

For 576i/p resolution (both possible at the point of query):
video/x-raw, format=(string)YUY2, width=(int)720, height=(int)576, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string){ progressive, interleaved }, framerate=(fraction){ 25/1, 50/1 }

This, in turn, makes 576i work correctly; with the old code,
the caps would be interlace-mode=progressive for interlaced video.

https://bugzilla.gnome.org/show_bug.cgi?id=726194
2014-11-01 11:46:13 -04:00
Aurélien Zanelli
cfb4c02187 v4l2object: set colorspace for output devices
When the v4l2 device is an output device, the application shall set the
colorspace. So map GStreamer colorimetry info to V4L2 colorspace and set
on set_format. In case we have no colorimetry information, we try to
guess it according to pixel format and video size.

https://bugzilla.gnome.org/show_bug.cgi?id=737579
2014-09-29 21:23:01 -04:00
Nicolas Dufresne
743c6a4475 v4l2: Merge min_buffers_for* variable into one
Reuse the same min_buffers variable for both capture and output, this
reduce the length of lines and make the code more readable.

https://bugzilla.gnome.org/show_bug.cgi?id=736072
2014-09-09 18:39:23 -04:00
Aurélien Zanelli
3afec4dd01 v4l2: set min_latency for output device according to required minimum number of buffers
Since we can get the minimum number of buffers needed by an output
device to work, use it to set min_latency which will determine how many
buffers are queued.

https://bugzilla.gnome.org/show_bug.cgi?id=736072
2014-09-09 18:39:23 -04:00
Hans de Goede
116649371e v4l2: get_nearest_size: Fix "Unsupported field type" errors
Most V4L2 ioctls like try_fmt will adjust input fields to match what the
hardware can do rather then returning -EINVAL. As is docmented here:
http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-fmt.html

EINVAL is only returned if the buffer type field is invalid or not supported.

So upon requesting V4L2_FIELD_NONE devices which can only do interlaced
mode will change the field value to e.g. V4L2_FIELD_BOTTOM as only returning
half the lines is the closest they can do to progressive modes.

In essence this means that we've failed to get a (usable) progessive mode
and should fall back to interlaced mode.

This commit adds a check for having gotten a usable field value after the first
try_fmt, to force fallback to interlaced mode even if the try_fmt succeeded,
thereby fixing get_nearest_size failing on these devices.

https://bugzilla.gnome.org/show_bug.cgi?id=735660
2014-08-29 16:15:11 -04:00
Hans de Goede
8ad0509a1c v4l2: get_nearest_size: Always reinit all struct fields on retry
They may have been modified by the ioctl even if it failed. This also makes
the S_FMT fallback path try progressive first, making it consistent with the
preferred TRY_FMT path.

https://bugzilla.gnome.org/show_bug.cgi?id=735660
2014-08-29 16:14:56 -04:00
Nicolas Dufresne
3df949c745 v4l2object: Don't share own pool if min exceed V4L2 capacity
If the minimum required buffer exceed V4L2 capacity, don't share down
pool. This allow support very high latency, like with x264enc default
encoding settings.

https://bugzilla.gnome.org/show_bug.cgi?id=732288
2014-07-25 14:18:47 -04:00
Aurélien Zanelli
010272a796 v4l2object: query minimum required buffers for output
Some v4l2 devices could require a minimum buffers different from default
values. Rather than blindly propose a pool with min-buffers set to the
default value, it ask the device using control ioctl.

https://bugzilla.gnome.org/show_bug.cgi?id=733750
2014-07-25 13:43:09 -04:00
Aurélien Zanelli
57ae11ac6f v4l2: set debug messages according to device type and IO mode
https://bugzilla.gnome.org/show_bug.cgi?id=733616
2014-07-25 13:42:00 -04:00
Nicolas Dufresne
e196906b99 v4l2object: Remove is_active checks
These checks are no longer required with recent change to the bufferpool. This
should allow changing the configuartion, hence the way forward renegotiation
support.

https://bugzilla.gnome.org/show_bug.cgi?id=728268
2014-07-25 13:39:50 -04:00
Nicolas Dufresne
0126e75676 v4l2object: Pool might be NULL in decide allocation
If special stride is needed and downstream don't support VideoMeta,
pool might be NULL in order to let the baseclass create a generic
pool­. This would lead to assertion with on Exynos with:

gst-launch-1.0 -v filesrc location=mov ! qtdemux ! h264parse ! \
                    v4l2video8dec ! fakesink

https://bugzilla.gnome.org/show_bug.cgi?id=732707
2014-07-03 15:30:01 -04:00
Tim-Philipp Müller
a016f19de8 v4l2: fix probing and enumeration of stepwise frame sizes
The code enumerating STEPWISE framesizes would start from
(min_w, min_h) and then add (step_w, step_h) to get the
next framesize. However, it should really allow any width
from min_w to max_w with step_w and same for heights.
Secondly, we would add and probe each individual stepped
frame size to the caps as separate structure, which would
lead to hundreds if not thousands of structs ending up in
the probed caps. Use integer ranges with steps instead.

This was particularly noticable with the Raspberry Pi Cam.

https://bugzilla.gnome.org/show_bug.cgi?id=724521
https://bugzilla.gnome.org/show_bug.cgi?id=732458
https://bugzilla.gnome.org/show_bug.cgi?id=726521
2014-07-01 20:23:58 +01:00
Daniel Drake
f9eb4dd206 v4l2object: drop workaround for misbehaving TRY_FMT
This workaround from 2011 was causing 25 S_FMT ioctls to be sent
to my UVC webcam from under gst_v4l2_object_get_caps as it probes
all the formats. In total, this adds up to about 5 seconds of
execution time, or a 10 second delay while starting up cheese.

These ioctls come from a workaround from 2011 where TRY_FMT might
make changes to hardware settings, so S_FMT was used to restore
the original config:
https://bugzilla.gnome.org/show_bug.cgi?id=649067

The driver bug is now assumed fixed. Remove the workaround to fix the
long startup delay.

https://bugzilla.gnome.org/show_bug.cgi?id=732326
2014-07-01 12:36:27 -04:00
Nicolas Dufresne
e2fd7e274e v4l2bufferpool: Port to bufferpool flush_start/stop method
Port the buffer pool to use the new flush_start/flush_stop virtual
methods added to GstBufferPool.

https://bugzilla.gnome.org/show_bug.cgi?id=727611
2014-05-26 13:43:30 -04:00
Nicolas Dufresne
ffb7a78798 v4l2object: Simply read back the config to update the query
It's easy to get the min/max outdate when hacking decide allocation. In
order to avoid this, simply read back the choosen value from the config.
2014-05-25 00:05:56 -04:00
Nicolas Dufresne
2e89f4ecff Revert "v4l2bufferpool: Port to bufferpool flush_start/stop method"
This reverts commit 2e0fb42e86.

Conflicts:
	sys/v4l2/gstv4l2allocator.c
	sys/v4l2/gstv4l2bufferpool.c
	sys/v4l2/gstv4l2videodec.c
2014-05-24 20:00:14 -04:00
Nicolas Dufresne
ba10cb14ea v4l2object: Fix configuration of other_pool and importation case
Fix the choice of min/max, don't override the min/max with own pool selected
size, correct other_pool is_active check, start from other_pool config when
configuring the other pool and finally validate the configuration.
2014-05-24 18:56:32 -04:00
Nicolas Dufresne
4aa5d42184 v4l2object: Use proposed allocator as default 2014-05-24 18:45:30 -04:00
Nicolas Dufresne
43643b8e26 v4l2object: Don't leak config structure 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
2e0fb42e86 v4l2bufferpool: Port to bufferpool flush_start/stop method 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
077fcbcf15 v4l2: Cleanup M2M properties
M2M devices were sharing the same properties as src and sink. Most of
these made no sense. This patch reduces the number of propeties and
makes io-mode clearer by having capture-io-mode and output-io-mode. This
also accidently fixed a bug in gstv4l2transform io-mode code, where the
capture io-mode could not be set.

https://bugzilla.gnome.org/show_bug.cgi?id=729591
2014-05-15 19:06:52 -04:00
Nicolas Dufresne
cff050884c v4l2object: Fix regression in offset extrapolation
When extrapolating the offset, we need to use the extrapolate
stride rather then the base stride. This should fix support for format
with more then two planes (I420, Y42B, etc).
2014-05-13 13:44:20 -04:00
Tim-Philipp Müller
2e5daf15e7 v4l2src: minor GValue handling optimisation in probing code 2014-05-12 17:23:19 +01:00
Tim-Philipp Müller
f63bdd0483 v4l2src: avoid lists with one single framerate in probed caps
Simplify framerate field if possible, so we don't end up with
e.g. framerate = (fraction) { 30/1 }. Maybe the helper function
should be moved to core, but we can do this later.
2014-05-12 17:21:43 +01:00
Nicolas Dufresne
e45b1fd9e6 v4l2object: Don't leak config structure
this fixes a leak of the config structure and take care of making sure
caps can't reach ref 0 before we are done doing our check.

CID 1212144
2014-05-09 12:10:04 -04:00
Nicolas Dufresne
5284aca559 v4l2object: Remove uneeded cast for code clarity 2014-05-09 12:08:11 -04:00
Nicolas Dufresne
68953d8026 v4l2object: Fix use of unitilized pool pointer
CID #1212173
2014-05-09 11:52:11 -04:00
Nicolas Dufresne
ab465bd162 v4l2object: Readback pool config if used within the baseclass 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
82a806e63b v4l2: Replace miss-use of crop meta in favour of proper offset
This moves away from copying information and store everything inside
the GstVideoInfo structure. The alignement exposed by v4l2 api
is now handled using proper offset.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
7f8eff7845 v4l2object: Improve selecton of min/max in decide allocation 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
92bdd596f2 v4l2: Add DMABUF and USERPTR importation 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
d3383f9d4c v4l2object: Don't leak downstream pool in propose_allocation
parse_nth_allocation_pool() give a ref on the pool, we need to unref it
when done.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
eee61f39e5 v4l2: Introduce DMABUF_IMPORT IO mode 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
83f053e980 v4l2object: Always set a size when deciding allocation 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
acebdd86da v4l2object: Improved decide allocation
Improve decide allocation so it properly configure both local and downstream
buffer pools. Also read back the pool config if it was changed to to driver
limitations.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
db3d2f35f0 v4l2bufferpool: Early catch short allocation
Catch short allocation after saving the format. This is not a catch all, but should catch
most of the miss-behaving drivers when doing S_FMT/G_FMT and avoid potential crash.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
1b4561cf35 v4l2object: Don't advertise crop meta
Currently we advertise crop meta, but not element handle support this meta.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
a721e54922 v4l2object: Setup pool already send element error 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
409cccb477 v4l2object: Workaround decoder that set num_planes to 0 in the format
Some well known decoder wrongly set num_planes to 0 in their format instead of
one. In this case we would endup with no size when deciding buffer allocation.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
46ffef798c v4l2object: Ensure size before configuring the pool 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
8f6bd0dbc0 v4l2object: Don't hardcode min/max use default instead 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
0488984f82 v4l2: Move propose allocation to v4l2object 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
d4c24cc52f v4l2transform: Setup cropping if needed 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
b781156625 Implement GstV4l2Transform
Implement a v4l2 element that wraps HW video converters.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
0028de808b v4l2: Probe for CREATE_BUFS in order to correctly set pool min/max
In order to correctly set the pool min/max, we need to probe for CREATE_BUFS
ioctl. This can be done as soon as the format has been negotiated using a
count of 0.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
49065b1693 v4l2object: Fix support for planar format in 1 v4l2 mplane
So far we where only setting saving the first plane stride in the meta. This was
leading to wrong values in GstVideoMeta.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
a8e81bd81e v4l2: Expose RGB32 formats with and without alpha
As soon a the alpha component can be set, we can expose the RGB32 and BGR32
format as ARGB and BGRA as long we can deterministically set the alpha padding
value.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
403909d873 v4l2: Correctly check if video meta is needed
Correctly check if video meta is needed. In buffer pool, trust need_video_meta
flag in order to decide if configuration should succeed.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
f70bb08411 v4l2object: Fix tiled stride request
Fix stride request for tiled format and improve logging.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
36dfdff84c v4l2object: Ensure video and crop meta are enabled if needed
In certain cases we cannot live without video meta and/or crop meta
being enabled in our internal buffer pool. Ensure this is always the case,
regardless of having support for allocation query.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
efe68f086f v4l2object: don't use own pool if downstream don't support video meta 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
f3ce6fd25b v4l2object: Fix handling of contiuous vs non-contiguous support
The complex mechanic to try and choose the right thing did not work. Instead,
simply probe the non-contiguous format first and then the contiguous one.
This is in fact very low overhead, as there is a relatively small number of
pixel format supported by each devices.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
a7286563ee v4l2: Add initial support for alignment and cropping 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
70e7868f18 v4l2object: Rename setup_format() method into acquire_format()
The setup_format() was confusing since it does not set anything, in fact
it reads the setup from the driver and save it.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
8cf1c330d5 v4l2object: Move type declaration to the top 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
b5dde037b4 v4l2object: Fail cleanly if pixel format is unkown or not raw video
Certain decoder has been found to not choose a format automatically. Running
v4l2videodec on these would assert. This patch will make it fail cleanly
instead.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
aa74871080 v4l2: Use single pass iterator for M2M probe
Instead of having each M2M class do their own probing, use the
GstV4l2Iterator and probe all devices in a single pass.

https://bugzilla.gnome.org/show_bug.cgi?id=727925
2014-05-03 23:11:35 -04:00
Nicolas Dufresne
7ff514fec6 v4l2: Correctly map RGB32 format
In v4l2 specification, RGB32 has the alpha, or pading, first, not last.
See http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html .

https://bugzilla.gnome.org/show_bug.cgi?id=540941
2014-04-30 15:36:07 -04:00
Nicolas Dufresne
e5ef2db489 v4l2: Fix support for caps without width, height, framerate or format
For format like mpegts, width and height is rarely in the negotiated caps. This
patch fixes failure when setting format, and prevent introducing width, height,
framerate and format to the caps when fixating.

https://bugzilla.gnome.org/show_bug.cgi?id=725860
2014-04-01 14:28:08 -04:00
William Manley
517f50f54f v4l2src: Fix support for mpegts streams
It seems that GStreamer's mpegts elements (tsdemux, tsparse) require caps
`video/mpegts,systemstream=true`.  As far as I can see the significance
of systemstream is to indicate that this is a container format rather than
an elementary stream.  As this is the case (and I can't understand how it
could not be the case with mpegts) I add systemstream=true to v4l2src's
caps.

This allows v4l2src to be linked with tsdemux for playback from my
Hauppauge HD-PVR with the pipeline:

    v4l2src ! queue ! tsdemux ! video/x-h264 ! decodebin ! xvimagesink

In combination with the next commit this fixes using Hauppauge HD-PVR with
GStreamer 1.0+.
2014-03-29 17:21:17 -04:00
Olivier Crête
fdceedb77c v4l2: Remove GstPropertyProbe leftovers 2014-03-16 19:24:59 -04:00
Nicolas Dufresne
11103c6c47 v4l2: Remove XV support
XV support for v4l2 never became upstream and ended up being
commented out with an undef for a long time now.
2014-03-15 13:54:47 +01:00
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