Commit graph

384 commits

Author SHA1 Message Date
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
44fa0b9cab v4l2: handle unsupported formats 2011-07-19 18:20:43 +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
39716c02a7 v4l2: add IO method enum 2011-07-18 10:52:23 +02:00
Wim Taymans
23656bbb72 bufferpool: improve _new function 2011-07-18 10:51:21 +02:00
Wim Taymans
4440801ace v4l2: implement setup_allocation
Implement the setup_allocation vmethod, we'll hopefully do something clever in
there later.
2011-07-15 16:55:50 +02:00
Wim Taymans
3eaecf3aed v4l2: improve bufferpool config setting
Pass the caps and the default video size to the bufferpool config.
Don't activate the bufferpool, this will be done by the object that decides to
use the bufferpool.
Improve debugging and error reporting.
2011-07-15 16:26:06 +01: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
c807bfb693 v4l2: unref copied buffer
After we copy the incomming buffer to one of our bufferpool buffers, unref the
target buffer after rendering so that it is put back in the pool.
2011-07-15 13:29:42 +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
549a4ddc8f v4l2: add ALLOCATION query to the sink 2011-07-15 11:30:25 +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
0f16daed15 v4l2: remove experimental markers 2011-07-15 11:18:03 +02:00
Wim Taymans
ef18a3c09b v4l2: merge code 2011-07-14 16:21:36 +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
7c5f5b1b7f v4l2: move capture code to device object
Move the details of how to capture to the device object. Remove the
v4l2src_calls.[ch] files because they are empty now.
Provide two simple methods to get and return a buffer to the device.
Also do a slow copy when the buffer is not from our pool.
2011-07-13 18:32:00 +02:00
Wim Taymans
ebd03a3fad v4l2: add some more debug 2011-07-13 16:58:08 +02:00
Wim Taymans
d7a27613c1 v4l2: stop streaming in READY and NULL 2011-07-13 16:56:21 +01:00
Wim Taymans
387e76114d v4l2: start streaming for the output as well 2011-07-13 16:40:39 +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
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
3aed125163 v4l2: Use video frame copy for raw video
Use the video frame copy API for raw video frames so that we copy with the right
strides.
2011-07-13 13:38:15 +02:00
Wim Taymans
e77d183a1e v4l2: add video metadata to raw video buffers 2011-07-13 13:37:58 +02:00
Wim Taymans
be83e4f704 v4l2: small cleanups 2011-07-13 13:15:16 +02:00
Wim Taymans
01def08e7a v4l2: improve caps parsing
Use GstVideoInfo to store the parsed caps.
Remove outsize from the caps parsing code, it's wrong because it does not use
the stride given by the driver.
2011-07-13 13:04:40 +02:00
Wim Taymans
c83730fc11 v4l2: use errno 2011-07-13 11:40:11 +01:00
Wim Taymans
6d97bfc41f v4l2: handle EINVAL without posting a warning
EINVAL means that a call is not supported, we only want to post a WARNING when
something is really wrong.
2011-07-13 11:36:54 +02:00
Wim Taymans
50ce1807f0 v4l2: only set framerate for capture for now 2011-07-13 11:29:26 +02:00
Wim Taymans
9f4cf3be58 v4l2: Move configuration of framerate to _set_format
Move the configuration of the framerate to where we set the other format
parameters.
Remove hack to check if the device is active.
Store streamparm in the device info.
Use some macros to access the current device configuration.
Remove some duplicate fields in src and sink and use the device configuration
instead.
2011-07-13 11:19:28 +02:00
Wim Taymans
100d46b5b9 v4l2: fix return value... 2011-07-12 19:13:45 +02:00
Wim Taymans
e8ae00f5fc v4l2: simplify setting the capture format
Pass the caps to the set_format function and make _set_format parse the caps.
Also keep the parsed values in the v4l2object so that we can refer to them when
we want.
2011-07-12 19:03:32 +01:00
Wim Taymans
b7ad28ba53 v4l2: remove more unused parameters 2011-07-12 18:41:47 +01:00
Wim Taymans
baa03a951b v4l: handle object out of the normal flow 2011-07-12 18:29:35 +01: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
59b86d2558 v4l: pass the bytesperline around
When setting a format, return the bytesperline to the caller so that it can be
used to allocate buffers.
2011-07-12 16:46:21 +01: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
e9d80b9f14 v4l2sink: handle pools
Create a new pool in setcaps and stop/destroy the old one.
Remove buffer_alloc functions.
Check that we have v4l2 metadata in show_frame and fall back to memcpy into a
buffer from our pool if we don't receive one of our own buffers.
2011-07-11 13:51:52 +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
3b4afcb8df v4l2: fix gray format, use filter in getcaps 2011-07-08 16:37:11 +02:00
Wim Taymans
7a296af37f v4l2: port and enable v4l2sink 2011-07-08 16:10:47 +02:00
Wim Taymans
b8640c8cd9 v4l2src: port to new video formats 2011-07-08 14:34:40 +02:00
Wim Taymans
e20d6f0bb5 v4l2: port to 0.11 2011-07-08 12:49:12 +02:00
Wim Taymans
d89790d545 Merge branch 'master' into 0.11
Conflicts:
	gst/avi/gstavidemux.c
	gst/rtp/gstrtpac3depay.c
	gst/rtp/gstrtpg726depay.c
	gst/rtp/gstrtpmpvdepay.c
	gst/videofilter/gstgamma.c
2011-05-24 17:34:19 +02:00
Rob Clark
9c9585116c v4l2: add norm property
Based on a patch by Guennadi Liakhovetski.

v2: updates because I forgot to add GstTuner interface to v4l2sink
v3: update to add all possible values to norm enum
2011-05-24 10:47:26 +02:00
Wim Taymans
e15651816e Merge branch 'master' into 0.11 2011-05-17 16:13:59 +02:00