RE: Re: v4l2 + select() + read()

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



On 31-May-01 Gerd Knorr wrote:
>>  Fair enough. Hmm, by reading at the v4l2 API... The v4l2_capability.flag
>>  has
>>  defines for V4L2_FLAG_READ, and V4L2_FLAG_WRITE, but theres nothing
>>  about
>>  MMAP. Unless thats the _STREAMING flag, which I find confusing...
> 
> Yes, it is the _STREAMING flag.  You have to use the STREAMON/STREAMOFF
> ioctls to start/stop capture via mmap()'ed buffers, so the name choice
> isn't that bad I think...

Yes, and no. READ/WRITE indicate something about the method through which
the data is moved in or out of the application (by using read() or write()),
while STREAMING implies something different. I would never assiociate that
with mmap(). In stead I would think that if the STREAMING flag is off, I
can´t get a video stream at all, but only static snapshots, or something
like that. Renaming to _MMAP might be a lot clearer to video app writers,
since as far as I know all video devices stream data anyway.

I mean, even with read() I can ´stream´ by reading continuously (except it´s
not done automatically, like with VIDIOC_QBUF). 

I´ve looked at the V4L2 API description about this capturing; looks good,
but I´m missing one detail: what happens when program can´t dequeue fast
enough (or deliberately throttles the framerate). More specifically: when
the queue is full, do you drop the last frame captured, or the oldest? I ask
because originally in my webcam driver I simply dropped the last frame;
however, this quickly leads to stale data in the buffer (I used a few
internal buffers to queue data); switching to dropping the oldest frame was
a bit more difficult to implement, but leaded to much better response time.

Of course, this is ultimately up to the developer of a driver, but it would
be nice to write a few words about it. Or turn it into an option. Sometimes,
all an application is interested in is the latest frame, and don´t care
about queueing, or dropping a few frames (maybe using only one buffer
will do the trick?). Others, like recording tools would be happy to use a
few buffers.

 - Nemosoft

-----------------------------------------------------------------------------
Try SorceryNet!   One of the best IRC-networks around!   irc.sorcery.net:9000
URL: never        IRC: nemosoft      IscaBBS (bbs.isca.uiowa.edu): Nemosoft
                        >> Never mind the daylight << 





[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