Hi!

On Thu, 14 Feb 2002, Joe Burks wrote:
> Anyway, if I read that code right the answer is that VIDIOCMCAPTURE ioctl 
> must be called once for every frame you capture.  If the frame in question is 
> not yet available because it is spooling, the ioctl will block until the 
> image is available.

Yes, VIDIOCMCAPTURE must be called for every frame.
No, VIDIOCMCAPTURE doesn't block. VIDIOCSYNC blocks. 

To achieve the full capture rate the application usually has to call 
VIDIOCMCAPTURE-for-frame-n+1 before frame n finishes, i.e. before the
VIDIOCSYNC-for-frame-n. To make this possible the driver must offer more
than one capture buffer and must be able to queue up several incoming
VIDIOCMCAPTURE calls - and dequeue them on every beginning frame
(interrupt-driven in case of capture cards).

A two-frame capture (frame n to buffer 0, frame n+1 to buffer 1) may look
like this (time axis points downwards):

Action
by app:         .
                - frame n-1
                .
                .
- VIDIOCMCAPTURE (buffer 0)     // returns within nano/microseconds
- VIDIOCMCAPTURE (buffer 1)     // returns within nano/microseconds
- VIDIOCSYNC (buffer 0)         // return may last up to 40 ms (PAL)
                .
                .
                - frame n       // capturing to buffer 0 begins
                .
                .
                .
                .               // VIDIOCSYNC returns
                - frame n+1     // capturing to buffer 1 begins
- Process buffer 0
- VIDIOCSYNC (buffer 1)         // return may last up to 20 ms (PAL)
                .
                .
                .               // VIDIOCSYNC returns
                - frame n+2     // not captured
- Process buffer 1
                .

Well, in this example - capturing ends after two frames - the processing
of buffer 0 may also take place after the second VIDIOCSYNC returns.


Bye,
     Rolf




_______________________________________________
Video4linux-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to