Greetings, On Thursday 01 November 2001 14:37, you wrote: > > One last thing, do I need to do ioctl(fd, VIDIOCMCAPTURE, &1); to > > capture, or is VIDIOCMCAPTURE only useful for enabling/disabling the > > video overlay display? Supposing that it's not necessary to do > > ioctl(fd,VIDIOCMCAPTURE, > > VIDIOCMCAPTURE(i) requests the next available TV frame to be captured to > buffer[i]. You must call VIDIOCMCAPTURE for every frame you want. As > VIDIOCMCAPTURE returns immediately a queue of several requested frames > may be built. I think this is only true for V4L2... > (And subsequently a VIDIOCSYNC(i) for every exposed > VIDIOCMCAPTURE(i) should follow. VIDIOCCSYNC cannot be queued because it > returns not before the respective frame/buffer has finished its capture.) To clarify a bit, from a programmers point of view... You usually allocate 1 large buffer to hold 2 (or more) complete images (2 is the default number of buffers for bttv), which you mmap(). Then you alternatively capture and sync to the buffers, like this: MCAPTURE(0) (initial capture) do { SYNC(0) MCAPTURE(1) (yes, start capturing immediately) do something with buffer 0 SYNC(1) (this will return imm. when the frame is already there) MCAPTURE(0) do something with buffer 1 } while Using more than 2 buffers is possible, but they take quite a lot of memory. > > &1), how do I de-queue the buffers after being done capturing? Or can I > > just leave them and requeue the same buffers when I want to continue > > capturing at a later time (without having unmap()'ed/mmap()'ed the > > memory or in any other way restarted the process)? Exactly. SYNC is a bit of a misnomer; it indeed syncs (waits) for the frame to finish, but it also immediately marks the buffer as 'free', while you haven't done anything yet with the data you just captured! Fortunately, the driver doesn't touch this data until you give the next MCAPTURE. NB: calling MCAPTURE on a buffer that hasn't been SYNCed yet will return an error. - Nemosoft