1 /*==========================================================================
3 capture_v4l.h: Header file for capturing image using Video4Linux.
4 Written by Naoyuki Ichimura, AIST, 2001.
5 ==========================================================================*/
12 #include <sys/types.h> /* for open() */
16 #include <sys/ioctl.h> /* for ioctl() */
18 #include <unistd.h> /* for mmap() */
21 #include <linux/videodev.h> /* for V4L */
23 /*=====================================================
24 Definitions for Video4Linux
25 =====================================================*/
26 #define DEFAULT_DEVICE_NAME "/dev/video0" /* device file name */
27 #define MAX_NO_CHANNEL 10 /* maximum number of channel of frame grabber */
28 #define CAPTURE_IMAGE_WIDTH 640 /* image width */
29 #define CAPTURE_IMAGE_HEIGHT 480 /* image height */
31 #define RGB 3 /* number of bit plane */
33 #define COMPOSITE1 0 /* for IO-DATA GV-VCP2M/PCI */
37 #define DOWN_SAMPLING_RATE 2 /* to remove even number field */
39 #define IMAGE_WIDTH_DS CAPTURE_IMAGE_WIDTH/DOWN_SAMPLING_RATE /* image size after down sampling */
40 #define IMAGE_HEIGHT_DS CAPTURE_IMAGE_HEIGHT/DOWN_SAMPLING_RATE
42 /*=====================================================
44 =====================================================*/
45 int CaptureV4LOpen( char *device_name );
46 int CaptureV4LGetDeviceCapability( int fd , struct video_capability *vcap );
47 void CaptureV4LDisplayDeviceCapability( struct video_capability vcap );
48 int CaptureV4LGetChannelInfo( int fd , struct video_channel vch[MAX_NO_CHANNEL] , int no_channel );
49 void CaptureV4LDisplayChannelInfo( struct video_channel vch[MAX_NO_CHANNEL] , int no_channel );
50 int CaptureV4LGetPictureInfo( int fd , struct video_picture *vp );
51 void CaptureV4LDisplayPictureInfo( struct video_picture vp );
52 int CaptureV4LGetMemoryMapInfo( int fd , struct video_mbuf *vm );
53 void CaptureV4LDisplayMemoryMapInfo( struct video_mbuf vm );
55 int CaptureV4LSelectChannel( int fd , struct video_channel vch[MAX_NO_CHANNEL] , int channel_no );
56 int CaptureV4LMemoryMapping( int fd , struct video_mbuf vm );
58 int CaptureV4LSimpleCapture( int fd , struct video_mmap *vmap );
59 int CaptureV4LDoubleBufferingInitCapture( int fd , struct video_mmap *vmap );
60 int CaptureV4LDoubleBufferingCaptureWait( int fd , struct video_mmap *vmap ) ;
61 int CaptureV4LDoubleBufferingCaptureNextFrame( int fd , struct video_mmap *vmap );
63 unsigned char *CaptureV4LSetImage( struct video_mmap vmap , struct video_mbuf vm );
64 void CaptureV4LSetImageDownSamplingForOpenGL( struct video_mmap vmap , struct video_mbuf vm , int down_sampling_rate , unsigned char *image , unsigned char *disp_image );