Re: Slow image capture using mmap

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



Kali Griffin wrote:
> 
> Hi,
> 
> I can only capture 8-10 fps regardless of image
> size using the bttv drivers and the v4l interface.
> 
> The type of card I have is an Osprey 100.  The device
> driver does not support read captures, so I have to
> use mmap.  Here is the gist of my code:
> 
> fd = open(/dev/video0, O_RDONLY);
> 
> video_picture.depth = 24;
> video_picture.format = VIDEO_PALETTE_RGB24
> ioctl (fd, VIDIOCGPICT, *video_picture);
> 
> video_window.width = 176;
> video_window.height = 144;
> ioctl (fd, VIDIOCSWIN, *video_window);
> 
> //MMAP will only grant me enough memory for 2 frames
> //no matter what my arguments are
> unsigned char* data =
>    mmap(0, 152064,PROT_READ,MAP_SHARED,fd,0);

Actually it won't, use GMBUF to get the correct parameters.

> //Capture Loop

Before the loop queue both buffers with CMCAPTURE.

> ioctl(fd,VIDIOCSYNC, &ONE);
> <memcpy buffer 1>
> ioctl(fd,VIDIOCMCAPTURE, *video_mmap);
> ioctl(fd,VIDIOCSYNC, &TWO);
> <memcpy buffer 2>
> ioctl(fd,VIDIOCMCAPTURE, *video_mmap);

Should do the trick (but remeber to fix the frame value in video_mmap).

-justin





[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