Benedict Bridgwater wrote: > > Justin Schoeman wrote: > > > > Justin Schoeman wrote: > > > > > > "Gleicon S. Moraes" wrote: > > > > > > > > Edgard Alexander Sotter wrote: > > > > > > > > [snip] > > > > > > > > > someone told me that I have to work with video_buffer struct, > > > > > anyone has experience in work with this struct???... anyone has a example of > > > > > grabbing image in real time (video)??? using more than one buffer. > > > > > > > > > > > > > I uploaded an attempt to use the double buffers to grab. > > > > My primary source of information were the Programming txt found in xawtv > > > > tarball. > > > > The link is the same: > > > > > > > > http://planeta.terra.com.br/informatica/gleicon/videodog.html > > > > > > > > The process looks is: sync buffer one, grab buffer 2, sync buffer 2, > > > > grab buffer 1. > > > > I hope it helps, sorry but I did it in a hurry, its not the nicest code > > > > overthere ... BTW if somebody got some clue to help improve this double > > > > buffer grab code, I would thank a lot. Probably I will do a presentation > > > > about video processing using linux, and would be very cool if I got some > > > > almost-real time processing :-D > > > > > > > > Regards. > > > > > > Here is a non-bttv specific example. I no longer use v4l, so I can't > > > > ... > > > > > > > > Also, please note that to be formally correct, the app must first test > > > for streaming capabilities with VIDIOCGCAP, and set the picture format > > > with VIDIOCSPICT (before any call to VIDIOCGMBUF is made). > > > > Sorry - there should also be a VIDIOCSWIN ioctl (I think) to set the > > image size. Quoting the v4l API document: > > > > "To use the mmap interface a user first sets the desired image size and > > depth properties. Next > > the VIDIOCGMBUF ioctl is issued." The only way I know of to set the > > size and depth parameters is the SWIN call??? > > VIDIOCSPICT and VIDIOCSWIN are only used for setting up an overlay > window, not for memory capture. For doing memory capture the size/format > are passed to each VIDIOMCAPTURE call. > > If anyone is wiling to host it, I have a thin C wrapper for V4L and some > simple examples showing how to to streaming mmap capture displayed in an > X window, that might be useful to people starting out. This is a point I am not sure of. The v4l API specification explicitly requires that GMBUF is isued AFTER setting the size and format, while MCAPTURE is only allowed after GMBUF and mmap. As you can see, this prevents using MCAPTURE to set the size/format, and the only other ioctl that sets size is SWIN, so this must be the one. Looking at the v4l2 emulation layer for v4l1 (which is a formal v4l implementation), you can see that it uses SWIN to set the capture format. I therefore assume this is the ioctl that the API spec is referring to. NB - just because bttv accepts GMBUF without a format, doesn't mean that all v4l drivers have to!!! -justin