Re: ioctl parameters

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



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






[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