I only want to say a Gerd Knorr (how it was obvious ) the problem
was in my application.
I think it's interesting to know that bttv.0.9.9 captures fields in
field rate without problems (with an average time of 20 ms)
Thank's for all your help.
Iñaki wrote:
Gerd Knorr wrote:
Iñaki <gcypher@xxxxxxxx> writes:
I've developed an aplication on v4l2 but i've a doubt about how to
sync with the capture of frames. Reading the draft of v4l2 i thought
VIDIOC_DQBUF blocks aplication user until buffer wainting for was
filled. When i tried to use DQBUF a buffer it rises an EINVAL with the
perror "Resource temporarily unavailable"(i haven't opened fd with
O_NONBLOCK and there is a buffer in queue). I've used select() to
block the aplication until the buffer is filled and now it's work but
i want to know if there is another way.
==============================[ cut here ]==============================
--- bttv-0.9.9/video-buf.c~ 2003-03-21 11:16:36.000000000 +0100
+++ bttv-0.9.9/video-buf.c 2003-04-01 09:27:21.000000000 +0200
@@ -586,7 +586,7 @@
if (list_empty(&q->stream))
goto done;
buf = list_entry(q->stream.next, struct videobuf_buffer, stream);
- retval = videobuf_waiton(buf,1,1);
+ retval = videobuf_waiton(buf, file->f_flags & O_NONBLOCK, 1);
if (retval < 0)
goto done;
switch (buf->state) {
==============================[ cut here ]==============================
Perfect! With this patch DQBUF blocks my application but the big
problem is alredy
the segmentation fault. I've modified my application to use a
configurable number of buffers and always happens the same;
segmentation fault when i try to use the pointer which point to mmap
of the last buffer (only with the last ) of field.
I've bttv-0.9.9 right loading and my application works fine with
frames (V4L2_FIELD_ANY or V4L2_FIELD_INTERLACED) but
always crash at the last buffer using V4L2_FIELD_ALTERNATE (or X
field). I've tested with 2, 4 ,6 ,8 and 10 buffers. Always crash in
the last. I don't kown if the problem is in my application (i have to
configure something new with fields) or is in the driver.
Thanks
Iñaki
Another question is i've tried to change fmt.pix.field from
V4L2_FIELD_ANY to V4L2_FIELD_ALTERNATE (i'm using the V4L2_MEMORY_MMAP
and V4L2_BUF_TYPE_VIDEO_CAPTURE with GREYSCALE) to capture in half
period time but it always rises an Segmentation fault in the second
buffer (of 2) after VIDIOC_DQBUF call. Does anyone know some reason?
latest bttv version? And you need more that two buffers, otherwise
you will not get full 50 fields/sec rate ...
Gerd