Commit graph

1562 commits

Author SHA1 Message Date
Nicolas Dufresne
c82052e723 ximagesrc: Add missing return value to Buffer dispose function
Depending ont he build, the method could return FALSE, hence never
free the buffers, or already TRUE and lead to a crash:

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=733695
2014-07-31 09:14:10 -04:00
Thiago Santos
550be3e51b v4l2bufferpool: clear gcond 2014-07-26 12:19:18 -03:00
Nicolas Dufresne
287517d6a9 Revert "v4l2bufferpool: Workaround elements not requesting any buffers"
This was a tempory workaround, we should fix the encoders that do not
negotatiate the amount of buffers they need.

This reverts commit d03bcba3db.
2014-07-25 14:30:33 -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
de799f4d84 v4l2sink: use directly 'obj' instead of 'v4l2sink->v4l2object'
https://bugzilla.gnome.org/show_bug.cgi?id=733616
2014-07-25 13:42:33 -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
d7876e5597 v4l2bufferpool: Fix copy threshold implementation
We cannot allocate new buffer in acquire, otherwise the base class
is not aware and get confused. Instead, copy in _process(). This leads
to crash on finalize.

Fixes regression, see https://bugzilla.gnome.org/show_bug.cgi?id=732912
2014-07-11 13:45:30 -04:00
Nicolas Dufresne
0ac0cbcc0e v4l2allocator: Use qdata instead of parenting to DmabufMemory
Parenting V4l2Memory to DmabufMemory was in conflict with recent
optimization in DmabufMemory to avoid dup(), and didn't work with
memory sharing. Instead, use a qdata and it's destroy notify.

https://bugzilla.gnome.org/show_bug.cgi?id=730441
2014-07-11 09:49:27 +02:00
Nicolas Dufresne
d03bcba3db v4l2bufferpool: Workaround elements not requesting any buffers
This is a workaround for element that don't request buffers when
they should.

https://bugzilla.gnome.org/show_bug.cgi?id=732288
2014-07-10 18:22:10 -04:00
Nicolas Dufresne
12a3bdbd09 v4l2src: Ensure internal pool activation
Before we would hit an assertion "'gst_buffer_pool_is_active (bpool)' failed"
if the internal pool was not used to push buffer downstrea, hence not
given to the baseclass.

https://bugzilla.gnome.org/show_bug.cgi?id=732912
2014-07-09 15:26:12 -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
Nicolas Dufresne
3f15e67923 v4l2bufferpool: Handle FD error during poll
This will ensure we fail earlier if something unrecoverable
happens.
2014-07-03 15:29:54 -04:00
Nicolas Dufresne
652ed3bceb v4l2bufferpool: Wait before polling if queue is empty
In kernel before 3.17, polling during queue underrun would unblock right
away and trigger POLLERR. As we are not handling POLLERR, we would endup
blocking in DQBUF call, which won't be unblocked correctly when going
to NULL state. A deadlock at start caused by locking error in libv4l2 was
also seen before this patch. Instead, we wait until the queue is no longer
empty before polling.

https://bugzilla.gnome.org/show_bug.cgi?id=731015
2014-07-03 15:28:45 -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
Tim-Philipp Müller
f79de9a420 v4l2: fix compiler warnings when compiling with -DG_DISABLE_ASSERT
Compiler complains about uninitialised variables in the impossible
'default' code path in device provider source/sink switch-case.
2014-06-29 17:06:11 +01:00
Olivier Crête
a9c385686a Rename GstDeviceMonitor to GstDeviceProvider 2014-06-26 14:57:36 -04:00
Andoni Morales Alastruey
93653ae5f9 osxvideosink: remove legacy code for passing a window handle
"have-ns-view" and the "embed" property was kept in 0.10 for
backwards compatibility but it's no longer used in favor of
the GstVideoOverlay interface

https://bugzilla.gnome.org/show_bug.cgi?id=703753
2014-06-23 20:40:09 +02:00
Tim-Philipp Müller
dd165a4b1a pulse, v4l2: update for device "klass" -> "device-class" rename 2014-06-21 01:32:03 +01:00
Tim-Philipp Müller
d5b344ba74 oss: simplify probed caps before returning them
Exposes all formats in the first structure if the
rest is the same for all of them.
2014-06-13 09:52:03 +01:00
Tim-Philipp Müller
ffcb884551 oss: make sure 16-bit formats are before 8-bit formats in probed caps
Probe supported formats in order of desirability rather than in
what order they may happen to be in the formats bitmask. Fixes
accidentally exposure of 8-bit formats in caps before 16-bit formats
(in case where U16 was not supported S8 might be listed before S16).

https://bugzilla.gnome.org/show_bug.cgi?id=706884
2014-06-13 09:49:38 +01:00
Nicolas Dufresne
0fb59dbdba v4l2bufferpool: Cleanly handle v4l2_allocator_new failure 2014-06-12 16:41:09 -04:00
Nicolas Dufresne
1648e46f86 v4l2bufferpool: Cleanup poll method and retry on EINTR/EAGAIN
https://bugzilla.gnome.org/show_bug.cgi?id=731015
2014-06-04 15:15:56 -04:00
Julien Isorce
5c07e6b45c v4l2sink: implement gstvideosink.show_frame instead of gstbasesink.render
It allows to show preroll frame. Especially it allows to update the
frame when seeking in PAUSED state.

https://bugzilla.gnome.org/show_bug.cgi?id=722303
2014-05-26 14:07:42 -04:00
Nicolas Dufresne
ea340455ae v4l2sink: Cleanup old pad alloc declaration 2014-05-26 13:43:30 -04:00
Nicolas Dufresne
b3bf4e33d0 v4l2bufferpool: Copy already queued buffer
This is required as during preroll we pass the first buffer twice, hence already
queued. It is also useful, to allow filters replaying a previous rendered buffers.
This will require 1 more buffer in sink if last-sample is enabled, since the last
sample will not be the same as the currently queued buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=722303
2014-05-26 13:43:30 -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
bc002d579f v4l2bufferpool: Don't queue all the buffers before dequeueing first
For output device, we where queuing all the buffers, and then we would
dequeue one. This means we only have 1 buffer for the pipeline, no matter
the size of the queue. Instead, start dequeued when min_latency is reached.
Eventually, this the min_latency should also be affected by control
MIN_BUFFERS_FOR_OUTPUT (use by encoders).
2014-05-25 00:05:56 -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
66519d08b0 v4l2: Cleanup and fix calculation of latency
Calculation of num_buffers (the max latency in buffers) was
up-side-down.  If we can allcoate, then our maximum latency match
pool maximum number of buffers. Also renamed it to max latency. Finally
introduced a min_latency for clarity.
2014-05-25 00:04:44 -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
aff64af8ad v4l2bufferpool: Fix USERPTR map flags
We need to map READ only for output and write only for capture, we where
doing the opposite. This fixing USERPTR with glimagesink

https://bugzilla.gnome.org/show_bug.cgi?id=730698
2014-05-24 18:43:28 -04:00
Nicolas Dufresne
3a7bd8d479 v4l2bufferpool: Prevent num_queued from going negative 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
57726911f8 v4l2videodec: don't stop if loop returned FLUSHING
The decodeing thread returning flushing isn't an error, we should simply
try starting the task again. If it's actually flushing, it will stop again by itself.
2014-05-24 15:38:53 -04:00
Nicolas Dufresne
3acbd9cb99 v4l2videodec: Handle early task stop 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
a65ab6378d v4l2videodec: Handle gst_pad_start_task() failure 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
1e48ad8fa8 v4l2videodec: Add trace for FLUSH_START/STOP handling 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
c9dcc63eb8 v4l2videodec: Fix use of atomic value 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
45b322c2db v4l2bufferpool: Improve debugging
No need to use obj->element, the pool now have a significant name. Also don't
warn if flushing.
2014-05-24 15:38:53 -04:00
Nicolas Dufresne
03ed348d95 v4l2videodec: Fix handle_frame error handling 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
e70173e28a v4l2bufferpool: Add a trace when _start() is called 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
2cb6b9775c v4l2allocator: Add debug assert to detect calls in the wrong state 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
1f70b21926 v4l2allocator: Reset count when stopped 2014-05-24 15:38:53 -04:00
Nicolas Dufresne
6a07e96734 v4l2allocator: Return a GstFlowReturn instead of boolean in alloc 2014-05-24 15:38:53 -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
0746bca190 ximagesrc: Fix ximage leaks when buffer has more then one ximage
From time to time, when the image_pool list has more then 1 element
and I suppose at start, all but 1 pooled ximage are leaked. This is
due to broken algorithm in gst_ximagesink_src_ximage_get(). There was
also a risk of use after free for the case where the ximage size has
changed.

https://bugzilla.gnome.org/show_bug.cgi?id=728502
2014-05-21 12:18:01 -04:00
Sebastian Dröge
32d8eb9f80 v4l2bufferpool: Explicitly cast enum "subtype" to its "supertype"
gstv4l2bufferpool.c:608:18: error: implicit conversion from enumeration type
      'enum _GstV4l2BufferPoolAcquireFlags' to different enumeration type
      'GstBufferPoolAcquireFlags' [-Werror,-Wenum-conversion]
  params.flags = GST_V4L2_POOL_ACQUIRE_FLAG_RESURECT;
               ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2014-05-19 11:26:46 +02:00
Nicolas Dufresne
7df99f7469 v4l2videodec: Handle flush while in start_streaming
We need to handle the case where a flush occure while the streaming
thread is being brought up. In this case, the flushing state of the poll
object is cleared. To solve this, we simply set the capture poll to flushing
again, this way we know the thread will exit. The decoder streamlock
is used to synchronize with handle frame.
2014-05-16 21:49:00 -04:00
Nicolas Dufresne
58716e054f v4l2allocator: Don't trace twice the same message 2014-05-16 21:48:29 -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
Benjamin Gaignard
0d852cf235 v4l2bufferpool: Update pool limit with hardware requiremenst
If the driver need more buffers than requested by the config,
update the pool min/max values. The minimum value for the pool
could be provided either by the driver or by the pool. This is
best effort for drivers that don't support
CID V4L2_CID_MIN_BUFFERS_FOR_CAPTURE.

https://bugzilla.gnome.org/show_bug.cgi?id=730200
2014-05-15 12:55:33 -04:00
Nicolas Dufresne
541a9670d2 v4l2videodec: Handle start_streaming error
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:22:04 -04:00
Nicolas Dufresne
bff156bc57 v4l2videodec: Print the flow return causing the loop to leave
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:59 -04:00
Nicolas Dufresne
f384047be3 v4l2videodec: Don't lock the decoder when stopping task
That src pad task may need to take the lock when being pulled
down. takeing that lock can lead to a deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:54 -04:00
Nicolas Dufresne
5f10d2b4e2 v4l2transform: Don't leak pool if activation failed
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:48 -04:00
Nicolas Dufresne
a4b5811d22 v4l2: Split flush in start/stop_streaming
This allow calling start streaming later for capture device. Currently it breaks
in dmabuf-import because downstream is holding a buffer that will only be
released after stream-start.

https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:44 -04:00
Nicolas Dufresne
c1792de95e v4l2transform: Flush buffer pools on flush stop
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:40 -04:00
Nicolas Dufresne
7986c55dcb v4l2allocator: Fix use of atomic active marker
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:35 -04:00
Nicolas Dufresne
19608ac85b v4l2bufferpool: Don't deactivate otherpool
We should not stop the otherpool unless we also stop our own
pool, otherwise it will never get restarted.

https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:31 -04:00
Nicolas Dufresne
4b2808c310 v4l2bufferpool: Also update num_buffers for import cases
https://bugzilla.gnome.org/show_bug.cgi?id=730207
2014-05-15 12:21:12 -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
Nicolas Dufresne
de7e5e481d v4l2bufferpool: Use default VideoInfo for frame operation
When doing frame operation, we need to use the default VideoInfo
and let the frame API read the video meta in order to get the stride
and offset right. Currently we where using the specialized VideoInfo
which reflects what the HW is setup to.
2014-05-12 18:08:19 -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
a270dc79d9 v4l2transform: Fix NULL check copy paste error
CID 1212129
2014-05-09 12:14:23 -04:00
Nicolas Dufresne
bf1918481d v4l2transform: Fix potential deadlock due to missing break
CID 1212131
2014-05-09 12:12:12 -04: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
16f0c253a3 v4l2pool: Fix leak of config structure in error case
CIDs 1212167 and  1212167
2014-05-09 11:56:52 -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
3e4ed47956 v4l2object: Style fix 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
dfdd1ba9d9 v4l2allocator: Reset imported buffer size with expected size
This ensure that the buffer pool won't always discard buffer with these
memory when they are released.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
1304c74c6a v4l2allocator: Reset flushed group
This ensure that a flushed group memory are the same size as when they
where originally allocated / imported.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
f3ecbeb577 v4l2bufferpool: Get number of allocated buffers from allocator
The value of num_allocated buffer would get confused when
buffer are being discarded.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
7aed4a9806 v4l2allocator: Add a method to read number of allocated group 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
972cf80957 v4l2bufferpool: Improve debugging 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
c7d735a596 v4l2bufferpool: Ensure we don't re-enqueue buffer during flush 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
01feadc2e7 v4l2transform: Initilialize debug category 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
b2dab42ce8 v4l2allocator: Fix libv4l2 support
Need to include config.h, otherwise we endup directly using the
ioct/mmap/munmap calls and need to vall v4l2_munmap.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
428d63c2e5 v4l2allocator: Set the flags on the object
We where not setting the probed flags on the allocator, which mean even if
CREATE_BUFS was supported on some driver, it would endup being ignored.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
cb311d57f5 v4l2bufferpool: Re-enqueue buffer at stream start 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
a946a7cde6 v4l2allocator: There is not group on error 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
6f5edb3b4b v4l2transform: Handle FLUSH_STOP event 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
815c9b7d35 v4l2bufferpool: Acquire cannot return a buffer from another pool
Return a buffer from an otherpool has unwanted side effects that lead to leaks and
prevents deactivating the pool. Instead, we change the _process() API so it can
replace the internal buffer with the buffer from the downstream pool. This implied
moving from _fill() to _create() method in the src.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
97d0ca853e v4l2bufferpool: Remove unreached acquire code
The acquire is done in _prepare now.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
f13331e928 v4l2bufferpool: Sanetize buffer refount handling
Buffer refcounting is a bit hard, because of the duality between CAPTURE and
OUTPUT mode. In the long term, we should consider having two seperate pool
instead of this mess. At least state should be better kept this way.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
deb40de4b8 v4l2transform: Add more traces 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
74a64be001 v4l2-allocator: Add S to REQBUFS/CREATE_BUFS enum
All enum that has REQBUFS and CREATE_BUFS where missing S, which was
confusing since they are supposed to match with associcated ioctl name. This
also fixes the yet unused CAN_REQUEST flag check.
2014-05-08 15:56:37 -04:00
Nicolas Dufresne
3500e44f17 v4l2transform: Enabled QoS 2014-05-08 15:56:37 -04:00
Nicolas Dufresne
62605e11eb v4l2: Fixup USERPTR/DMABUF capture support 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
ba32cf10f3 v4l2bufferpool: Update config if meta is missing
Rather then hard failure, we should update the config with the meta option we
need and return false.
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
a114a32d22 v4l2allocator: Valid FD are bigger or equal to zero 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
1ab90ababa v4l2: Add dmabuf export support
This can be enabled sing io-mode=dmabuf. This will enabled mmap base
drivers to export the buffers as dmabuf.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
7b00d7ac46 v4l2allocator: Guaranty queued state integrety
Because of the buf in videobuf2, dqbuf may leave the DONE flag being,
which would implied that the buffer is queued. As this has been broken
for 4 years, simply guaranty the state flags integrity when doing
qbuf/dqbuf.

See https://patchwork.linuxtv.org/patch/23641/
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
783417ee9f v4l2transform: Implement open/close 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
23e273acb2 v4l2transform: Ensure output pool is configured 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
026f79b5bd v4l2transform: Check if caps have changes before asserting
In set_caps, now checks if caps actually changed and succeed if they didn't
change.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
a89986ebd5 v4l2videodec: Ensure pool is configured 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
cf6c7e9846 v4l2bufferpool: Do not pre-configure the pool
Pre-configuring the pool is error prone, since it may hide a configuration failure and
endup with a pool that is not configured the way it should (e.g. no video meta, wrong
queue size, etc.)
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
fa6cd1d25a v4l2bufferpool: Preserve downstream minimum even in RW 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
7b8bb7188b v4l2bufferpool: Turn cropmeta into a custom option
Turn crop meta into a custom option and make sure it's there is needed.
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
2b0ac06ade v4l2bufferpool: Port to use GstV4l2Allocator 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
fd13e9e96d Implement V4l2 Allocator
This goal of this allocator is mainly to allow tracking the memory.
Currently, when a buffer memory has been modified, the buffer and it's
memory is disposed and lost until the stream is restarted.
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
5a61fb7f25 v4l2object: Set minimum buffers to 2
All the element requires at least two buffers. This is not used for RW mode.
2014-05-08 15:56:36 -04:00
Nicolas Dufresne
3393083497 v4l2object: Remove unused MAX_BUFFERS define 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
f6d425bf0f v4l2transform: Install PROP_CAPTURE_IO_MODE with right ID 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
1635697f7e v4l2transform: decide_allocation returns a boolean 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
cf788c9ec7 v4l2videodec: Install PROP_CAPTURE_IO_MODE with right ID 2014-05-08 15:56:36 -04:00
Nicolas Dufresne
527df8b888 v4l2transform: Add propose_allocation
This should remove 1 copy between the decoder and the transform.
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
f810196b3e v4l2transform: Fixup caps query 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
2676ac9075 v4l2transform: Expose BGRA and ARGB formats 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
10b67e9913 v4l2transform: Ensure output pool is activated
That pool may be different then the internal pool.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
91efa79ed9 v4l2transform: Ensure internal buffer pools actication 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
7a4b076099 v4l2transform: Move subinstance subclass init near other init 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
6d5ffe8da2 v4l2transform: Stop stream before closing the devices. 2014-05-08 15:56:35 -04:00
Víctor Manuel Jáquez Leal
4f7ee5c130 v4l2transform: copy metdata 2014-05-08 15:56:35 -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
8d6e72a299 v4l2: Move capture eos handling in _process()
Now that we might be copying out buffer (e.g. downstream don't support video
meta bug we need it) we need to move the EOS handling inside the process
method.
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
a6a8c2b5eb v4l2videodec: Cleanly fail if set_format is never called 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
e9eba56cd3 v4l2videodec: Ensure internal pool are activated 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
a8024fef04 v4l2videodec: Check that pool where allocated before flushing them
Upon error, the pools might not have been allocated yet, hence we should not
try and flush them (even though we still want to make sure the processing thread
is fully stopped).
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
6196026c76 v4l2bufferpool: Enforce activation outside of process
Enforce pool being activate from before calling pool process. This should
help catching basic errors in the usage of buffer pool.
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
2f00119e3b v4l2bufferpool: Use obj->n_v4l2_planes for correct number of planes
Buffer pool was guessing wrongly the number of planes rather
then reading the value from obj->n_v4l2_planes. This was causing
format YU12 (I420) to fail upon check.
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
b4d89b9809 v4l2videodec: Protect NULL pool while going to READY
When the pipeline fails early, the pool might be unset before the processing
thread has run once. Add protection against that.
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
7e379e8fff v4l2videodec: Clear the input state pointer after unref
If caps are set again, we have a risk od returning from set_format with a
input_state pointing to dead memory. Clearing the pointer after unref fix
this issue.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
7101c4341a v4l2videodec: handle stop being called without flush
Uppon certain downstream error, stop() is called without a flush(). This mean that
the streaming thread may still be running even though unlock has been called.
Now calling flush to reset the decoder state if we are processing.
2014-05-08 15:56:35 -04:00
Nicolas Dufresne
fb852669de v4l2videodec: Default to template in caps query 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
27a617d75f v4l2videodec: Ensure processing thread has stopped when draining 2014-05-08 15:56:35 -04:00
Nicolas Dufresne
6f48c74f2a v4l2videodec: Don't drain if processing thread is inactive 2014-05-08 15:56:35 -04:00
Tim-Philipp Müller
17c107d4e4 v4l2: minor fix for closing the fd
The fd returned by open() could theoretically be 0 as well.

Coverity CID 1211823.
2014-05-05 12:07:25 +01:00
Nicolas Dufresne
717bbbbe70 v4l2devicemonitor: Port to use GstV4l2Iterator
https://bugzilla.gnome.org/show_bug.cgi?id=727925
2014-05-03 23:11: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
726fc3b524 v4l2: Add a common device enumerator
This will allow removing code duplication (hence bugs duplication).

https://bugzilla.gnome.org/show_bug.cgi?id=727925
2014-05-03 23:11:35 -04:00
Nicolas Dufresne
f7d34bd237 v4l2videodec: Simplify sub-instanciation mechanism
Simplify sub-instanciation by defining an absract type and using subtype
class and instance init callback. This also fixes a bug where the template
pads get initialized too late.

https://bugzilla.gnome.org/show_bug.cgi?id=727925
2014-05-03 23:11:34 -04:00
Nicolas Dufresne
e06c9f7fce v4l2: Cleanup plugin registration
There is no plan to introduce special sources for jpeg, te v4l2src works fine
for this.

https://bugzilla.gnome.org/show_bug.cgi?id=727925
2014-05-03 23:11:34 -04:00
Vincent Penquerc'h
81d2e9333d oss4: remove dead mixer code
This was partly removed in the port to 0.11. If still needed,
it's still there in the history.

Coverity 1139687
2014-05-02 09:41:19 +01:00
Vincent Penquerc'h
1062992b4a oss4: fix a missing unlock and a return-only-when-assertions-enabled
Spotted on the side while looking at another issue.
2014-05-02 09:33:51 +01: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
Tim-Philipp Müller
c9597298f9 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:35:17 +01:00
Sebastian Dröge
ab02b1db6c v4l2videodec: Initialise ioctl struct with zeroes before passing it to ioctl() 2014-04-16 17:23:52 +02:00
Edward Hervey
da39a0bae7 oss4: Maximum number of channels support is 8
Avoids doing potential overwrites in ch_layout (which only has 8
fields).

CID #1139826
2014-04-13 09:03:41 +02:00
Sebastian Dröge
7c006edf8d osxvideosink: Set rank to MARGINAL
If available we prefer using glimagesink over osxvideosink. It supports
more formats and in general has more features than osxvideosink.
2014-04-12 22:17:30 +02:00
Matthieu Bouron
7ac0204625 osxvideosink: use the video frame API instead of the video meta API
https://bugzilla.gnome.org/show_bug.cgi?id=726738
2014-04-08 13:56:10 +02:00
Matthieu Bouron
c6dcd3689d osxvideosink: advertize video meta API support
https://bugzilla.gnome.org/show_bug.cgi?id=726737
2014-04-08 13:55:53 +02: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
Vincent Penquerc'h
4d0e1a4536 v4l2: attempt to fix infinite (for small version of infinite) loop 2014-03-29 17:09:02 -04:00
Rico Tzschichholz
f3caba6847 v4l2: fix distcheck
Make sure ext/*.h are dist'ed
2014-03-28 19:35:53 +00:00
Tim-Philipp Müller
39fc394254 ximagesrc: only extrapolate alpha mask for 32-bit depth
Instead of passing bogus alpha mask values when there's no alpha.

https://bugzilla.gnome.org/show_bug.cgi?id=726833
2014-03-27 16:32:13 -04:00
Nicolas Dufresne
0918662624 ximagesrc: Add ARGB/BGRA support 2014-03-27 15:10:12 -04:00
Olivier Crête
cfa5877899 v4l2: Implement GstDeviceMonitor subclass
https://bugzilla.gnome.org/show_bug.cgi?id=678402
2014-03-16 20:37:54 -04:00
Olivier Crête
fdceedb77c v4l2: Remove GstPropertyProbe leftovers 2014-03-16 19:24:59 -04:00
Nicolas Dufresne
155d666845 v4l2: Add types compatiblity for other OS
Adds type compatiblity with other OS like BSD. This uses types mapping macro to
avoid conflict with existing defined types. We resuse glib types as these are
already available on supported platforms. This is GCC only because of the
le32 type that uses bitwise attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=726453
2014-03-16 17:32:03 +01:00
Nicolas Dufresne
0ad67fc404 v4l2: Fix typo V4L_DIR intead of V4L2_DIR 2014-03-15 18:41:16 +01:00
Nicolas Dufresne
478c9578f7 v4l2: Actually build the plugin
The checks were removed inadvertedly in previous patch and not replaced.
Re-introduce the configure checks and some of the checks in order to enable
this plugin again. We only check if videodev2.h exist on the platform to
avoid building on Windows or OSX, though we build against our own copy. This
was breaking the build on built-bot.
2014-03-15 16:48:08 +01: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
William Manley
4f47442c7f v4l2: Fix typo contol -> control
https://bugzilla.gnome.org/show_bug.cgi?id=725632
2014-03-08 19:29:58 -05:00
William Manley
d3bd3ecc3e v4l2: Normalise control names in the same way as v4l2-ctl
V4L2 kernel drivers allow configuration of the hardware settings via a
mechanism called controls.  These can be referred to by name such as
"Brightness" and "White Balance Temperature".  The user-space command line
client for setting these controls (v4l2-ctl) normalises these names such
that they only contain lower case alphanumeric characters and the
underscore '_'.  e.g:

    Kernel                     v4l2-ctl
    ----------------------------------------------------
    Brightness                 brightness
    White Balance Temperature  white_balance_temperature
    Focus (absolute)           focus_absolute

GStreamer seems to want to follow this pattern but failed for controls with
more than one consecutive non-alphanum character.  e.g. GStreamer would
produce "focus__absolute_" rather than "focus_absolute".

This commit fixes that issue.  Backwards compatibility is preserved by
normalising all control names before comparison.

https://bugzilla.gnome.org/show_bug.cgi?id=725632
2014-03-08 19:27:54 -05:00
Thijs Vermeir
e96f0c03ef osxvideo: fix build on Mac OSX Mavericks and put new window in front
GetCurrentProcess/SetFrontProcess/TransformProcessType was deprecated
and now removed in Mac OSX 10.9. orderFrontRegardless is used to make
the video window the most front window.
2014-03-05 20:35:31 +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
Nicolas Dufresne
a1db7e8c6c v4l2: CAPTURE_MPLANE is well tested now
https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -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
61183670c0 v4l2videodec: Implement v4l2videodec
Implement an element that can driver V4L2 M2M decoder device.

https://bugzilla.gnome.org/show_bug.cgi?id=722128
2014-02-25 14:29:10 -05:00
Mark Nauwelaerts
433d4f902d v4l2: make some more controls configurable
... at least if one tries hard enough using extra-controls property.
2014-02-23 13:06:43 +01:00