Commit graph

242 commits

Author SHA1 Message Date
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