Commit graph

33 commits

Author SHA1 Message Date
Michael Olbrich
1e777ede92 v4l2: try to allocate new buffers with VIDIOC_CREATE_BUFS if needed
If max_buffers is 0 then an arbitrary number of buffers (currently 4) is
allocated. If this is not enough v4l2src starts copying buffers.
With this patch VIDIOC_CREATE_BUFS is used to allocate a new buffer. If
this fails v4l2src falls back to copying buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=699447
2013-05-03 11:18:04 +02:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Wim Taymans
eecb9a96a6 v4l2: Improve buffer management
Query the amount of available buffers when doing set_config(). This allows us to
configure the parent bufferpool with the number of buffers to preallocate.
Keep track of the provided allocator and use it when we need to allocate a
buffer in RW mode.
When we are can not allocate the requested max_buffers amount of buffers, make
sure we keep 2 buffers around in the pool and copy them into an output buffer.
This makes sure that we always have a buffer to capture into. We also need to
detect those copied buffers and unref them when they return to the pool.
2012-04-23 18:10:33 +02:00
Wim Taymans
fa436c0799 v4l2: called base class start
Chain up to the base class start method so that metadata is properly tagged.
Remove an unused variable.

fixes: https://bugzilla.gnome.org/show_bug.cgi?id=672813
2012-03-26 15:33:59 +02:00
Wim Taymans
ecaea36c3d update for memory api changes 2012-03-15 13:36:17 +01:00
Wim Taymans
751fcf035b take padding into account 2012-03-14 19:56:56 +01:00
Wim Taymans
9c789aa434 update for metadata API changes 2012-02-29 17:26:01 +01:00
Wim Taymans
b1ef7e8a86 update for meta api change 2011-11-02 09:06:37 +01:00
Wim Taymans
add1cbdbd8 v4l2: activate the pool in fallback
When nobody is using our pool, activate it ourselves.
Avoid leaking the buffer array.
Set default pool configuration with caps.
Don't keep current_caps, core does that for us now.
2011-08-04 12:56:47 +01:00
Wim Taymans
63fc64dd98 v4l2: remove unused variables
Use the more specialized type for the bufferpool.
Use the size from the driver as the size of the image to read.
Don't configure the pool when created. This will be done in the setup_allocation
method later or by upstream for sinks.
Remove unused properties and variables. Bufferpool sizes are now configured in
the bufferpool by the elements in the pipeline. We might want to influence the
pool size later somehow.
2011-07-27 16:46:46 +02:00
Wim Taymans
b638bb4735 v4l2bufferpool: remove unused variable 2011-07-27 13:46:09 +02:00
Wim Taymans
fcfdececce bufferpool: check for metadata
Only add video metadata when it was configured in the pool. Fail if there was no
video metadata configured and the strides are not the default ones.
2011-07-27 13:41:28 +02:00
Wim Taymans
9a8f1c4339 v4l2: remove unused method 2011-07-25 15:51:22 +02:00
Wim Taymans
0a88ac4c92 v4l2: dequeue buffers when all are queued
Prefer to always use the default bufferpool queue for the _acquire function
because it properly supports unblocking when setting inactive etc. As a result,
we need to dequeue buffers and put them back in the bufferpool queue when we
have queued all buffers in the sink.
Rename some variables to more meaningfull names to avoid a problem with
freeing the wrong amount of buffers.
2011-07-25 14:47:05 +01:00
Wim Taymans
55eb26f1e7 v4l2: More work on bufferpools
Add different transport methods to the bufferpool (MMAP and READ/WRITE)
Do more parsing of the bufferpool config.
Start and stop streaming based on the bufferpool state.
Make separate methods for getting a buffer from the pool and filling it with
data. This allows us to fill buffers from other pools too. Either use copy or
read to fill up the target buffers.
Add property to force a transfer mode in v4l2src.
Increase default number of buffers to 4.
Negotiate bufferpool and its properties in v4l2src.
2011-07-18 18:54:49 +02:00
Wim Taymans
b1378f159a v4l2: dequeue buffers for the sink
When we have all buffers queued for playback and we need a new empty buffer,
dequeue one and return it.
Set the right size for sink buffers.
Improve counting of queued buffers.
2011-07-15 13:07:11 +01:00
Wim Taymans
21f532ae10 v4l2: convert to GstBufferPool
Extend from GstBufferPool.
Handle the lifetime of the pool buffers correctly with the start/stop vmethods.
Map acquire and release directly to QBUF and DQBUF. We still expose an explicit
qbuf for the v4l2sink for now.
2011-07-15 11:27:18 +02:00
Wim Taymans
33d93069c1 v4l2: Move output details to device object
Move the details of how a buffer is rendered to the device object.
2011-07-14 16:12:15 +02:00
Wim Taymans
d9e61954a1 v4l2: Let the device object manage the pool
Rename start and stop methods to open and close because that is what they do.
After setting the format on the device object, setup the bufferpools. Move this
code from the v4l2src_calls.c file, it is shared between source and sink.
Make new device start and stop method that merges various bits of common code
spread over several files.
2011-07-13 16:33:58 +02:00
Wim Taymans
be83e4f704 v4l2: small cleanups 2011-07-13 13:15:16 +02:00
Wim Taymans
0dcf0aebb0 v4l2: Let the bufferpool own the V4l2Object
Keep track of the currently configured format and setting in the
v4l2object.
Pass the v4l2object to the bufferpool constructor so that the bufferpool can
know everything about the currently configured settings. This also allows us
to remove some awkward code.
2011-07-12 18:13:42 +02:00
Wim Taymans
f55656dcfc v4l: remove caps argument, it's not needed
Remove the caps parameter, we don't need it anymore because we don't set
caps on buffers anymore.
2011-07-12 17:06:41 +02:00
Wim Taymans
851f550003 v4l2: various cleanups
Various cleanups, avoids useless casts, move error handling outside of the main
code flow.
Negotiate to a resonable resolution instead of the max resolution.
2011-07-11 12:15:12 +02:00
Wim Taymans
7a296af37f v4l2: port and enable v4l2sink 2011-07-08 16:10:47 +02:00
Wim Taymans
e20d6f0bb5 v4l2: port to 0.11 2011-07-08 12:49:12 +02:00
Wim Taymans
9c08bde90b meta: fix for new API 2011-02-28 11:58:49 +01:00
Wim Taymans
f229f4d192 metadata: use metadata for private buffer data
Use buffer metadata to store element private data.
2011-02-28 11:58:49 +01:00
Wim Taymans
d90a388289 miniobject: port to 0.11
Use buffer private data instead of subclassing.
2011-02-28 11:58:48 +01:00
Rob Clark
0cec72b97e v4l2sink: Add support for blocking dequeue.
We'd prefer to throttle the decoder if we run out of buffers, to keep a bound
on memory usage.  Also, for OMAP4 it is a requirement of the decoder to not
alternate between memory alloced by the display driver and malloc'd userspace
memory.
2010-12-29 11:46:40 -06:00
Stefan Kost
30b2cd42c5 v4l2: move G_END_DECLS to the end 2010-01-18 14:57:42 +02:00
Stefan Kost
e789d2253f v4l2: fix bufferpool file names in header comment 2010-01-18 14:55:38 +02:00
Rob Clark
99e2ac121d v4l2sink: change where buffers get dequeued
It seems to cause strange occasional high latencies (almost 200ms) when dequeuing buffers from _buffer_alloc().  It is simpler and seems to work much better to dqbuf from the same thread that is queuing the next buffer.
2009-08-04 09:22:29 +02:00
Rob Clark
f19cfbda96 v4l2: Add v4l2sink element
This also does the following changes:
(1) pull the bufferpool code out into gstv4l2bufferpool.c, and make a
    bit more generic so it can be used both for v4l2src and v4l2sink
(2) move some of the device probing/configuration/caps stuff into
    gstv4l2object.c so it does not have to be duplicated between
    v4l2src and v4l2sink

Fixes bug #590280.
2009-08-04 09:16:56 +02:00