Commit graph

37 commits

Author SHA1 Message Date
Wim Taymans
b2e1532021 v4l2: implement more bits of RW I/O mode
Implement the relaese of RW buffers in the pool.
Warn for unsupported write() mode for sinks.
2011-07-26 10:56:07 +01:00
Wim Taymans
9a8f1c4339 v4l2: remove unused method 2011-07-25 15:51:22 +02:00
Wim Taymans
e6a8718f0c v4l2: fix flushing start and stop
Move the flushing calls to the right place in the bufferpool.
Fix the min and max buffer sizes.
2011-07-25 15:39:18 +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
b98bc75f47 v4l2: only to STREAMOFF when streaming
Only call STREAMOFF when we previously called STREAMON
2011-07-25 10:24:33 +01:00
Wim Taymans
87d9a57aba v4l2: Fix sink bufferpool handling
Remove old method, use neww _process method for the sink.
Inform the parent bufferpool class about the settings too. This is needed to let
it know about the max-buffers.
Allocate the negotiated max-buffers and initially mmap min-buffers. The idea is
that the bufferpool will allocate more when needed.
Improve debugging.
Only poll in capture mode, it does not seem to work in playback mode on this
beagleboard.
2011-07-19 16:59:55 +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
23656bbb72 bufferpool: improve _new function 2011-07-18 10:51:21 +02:00
Wim Taymans
37ef3f8997 v4l2: handle dequeueing correcly
First clean up the buffers in the queue, then the remaining ones in the
device.
2011-07-15 13:52:38 +01: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
4dc85b87d9 v4l2: use the parent queue for the sink
We want to maintain a queue of free buffers for the sink, use the parent methods
to do that.
2011-07-15 12:35:14 +01:00
Wim Taymans
47816e1155 v4l2: fix error messages 2011-07-15 12:00:54 +02: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
398001f20d v4l2: don't store stride in the videoinfo
We want to keep the default strides in the videoinfo. Keep the stride of the
video frames separate so that we can use both to copy a video frame and do
correct stride conversion.
2011-07-13 13:52:30 +01:00
Wim Taymans
e77d183a1e v4l2: add video metadata to raw video buffers 2011-07-13 13:37:58 +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
1ef806181c pool: make buffer writable
We need writable buffers when we need to do a slow memcpy.
2011-07-12 16:43:04 +01: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
e20d6f0bb5 v4l2: port to 0.11 2011-07-08 12:49:12 +02:00
Wim Taymans
c63dc97adf meta: update for new API 2011-03-08 17:02:30 +00:00
Wim Taymans
de1ca68077 v4l2: register metadata 2011-02-28 11:58:49 +01: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
Tim-Philipp Müller
9dcb60822f v4l2: define V4L2_FIELD_INTERLACED_{TB,BT} if not available in header
Older kernels don't have these, and there's no easy way to check for the
existance of enums that doesn't involve a configure check, so just define
these if the V4L2_CAP_VIDEO_OUTPUT_OVERLAY define is not there, which was
added in the same commit as the TB/BT enum. Fixes compilation on CentOS 5.

https://bugzilla.gnome.org/show_bug.cgi?id=639339
2011-01-12 22:41:17 +00:00
Tim-Philipp Müller
b0eb10cc53 v4l2: mark v4l2sink as experimental and build only if --enable-experimental is passed
It's not really of 'good' quality yet, but there's a lot of
code shared with v4l2src, so not so easy to move it elswhere.

https://bugzilla.gnome.org/show_bug.cgi?id=612244
2011-01-02 11:40:29 +00:00
Rob Clark
c3721534c9 v4l2: fix race condition
The size of the buffer would be zero'd out in gst_v4l2_buffer_finalize()
after the buffer is qbuf'd or pushed onto the queue of available buffers..
leaving a race condition where the thread waiting for the buffer could awake
and set back a valid size before the finalizing thread zeros out the length.
This would result that the newly allocated buffer has length of zero.
2010-12-29 11:46:41 -06: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
Rob Clark
ecfbaf58a5 v4l2: clear flags before reusing buffer from buffer pool
note: this really only affects v4l2sink since gst_v4l2_buffer_pool_get() is
only called once per buffer in the v4l2src case (in
gst_v4l2src_buffer_pool_activate())
2010-12-29 11:46:40 -06:00
Rob Clark
60c1a44917 v4l2: fix typo 2010-12-23 16:44:06 -06:00
Janne Grunau
ab69275f4d v4l2src: set top field first for interlaced buffers if v4l2 exports it
https://bugzilla.gnome.org/show_bug.cgi?id=634393
2010-12-04 16:42:21 +00:00
Stefan Kost
0134e950fa v4l2: log more details in buffer pool finalize
Helps to align with the loggin from libv4l.
2010-02-16 10:15:22 +02:00
Stefan Kost
e789d2253f v4l2: fix bufferpool file names in header comment 2010-01-18 14:55:38 +02:00
Stefan Kost
0a68003efe docs: fix gtk-doc warnings 2009-09-10 10:26:23 +03: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