Re: Re: ioctl parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Friday 15 February 2002 03:13 pm, Trent Piepho wrote:
> > According to what I think Alan was saying and the API said,
> > VIDIOCMCAPTURE does two things:
> >
> > 1) Returns when a grabbed frame is available.
>
> Then how could you ever get a queue depth greater than 1?

The way I read it, the application does not queue up frames to be captured.  
It just reads that frame out of the mmap ring buffer.  If that frame isn't 
available (it has a capture pending), it blocks until it is.  If you have an 
mmap buffer of 4 frames (the driver determines how many mmap buffers you 
have), the driver will capture at most 3 frames ahead of the currently 
processed frame before stopping.  As long as your application can keep up 
with that no lost frames.

> The purpose of VIDIOCMCAPTURE is to tell the driver that you are done with
> a buffer, and that the driver should add it to the capture queue.  The
> purpose of VIDIOCSYNC is for the driver to tell you that it is done with
> the buffer, and you should process it.

That may be true.  But if that is true API.html is explicitly wrong:

Whenever a buffer is "used" by the program it should called VIDIOCSYNC to 
free this frame up and continue.

Which I think is what everybody is saying...  API.html is completely 
incorrect on the matter of reading data from mmapped buffers and my 
interpretation of a driver marking a buffer as "unused" meaning "available" 
was a side effect of the API document.

It actually means the driver isn't using this buffer, the program can do with 
it as it pleases.

The only problem I have with this is that the drivers will flag an error if 
you VIDIOCSYNC a frame twice, even though the second time the driver still 
isn't using it.  The drivers I've seen have two flags:  One which says "I've 
read the data, it is sitting in the mmap buffer, but the user hasn't SYNCed 
it", and another which says "I've read the data, it is sitting in the mmap 
buffer, and user has SYNCed it".  The only purpose of this flag seems to be 
to allow an error to be returned if SYNC is done twice on a buffer before 
MCAPTURE is called.  The semantic of SYNC would seem to be "block until 
you're done with this frame", but it only works once.  Even though it is 
still done with the frame the second time, it returns -EINVAL.

-Joe





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux