视频采集及显示: v4l2uvc.h源文件
视频采集及显示 1.0 beta
Linux平台视频采集及其显示

v4l2uvc.h

浏览该文件的文档。
00001 /*
00002  *                           _/_/     _/_/_/     _/_/_/_/_/
00003  *                        _/    _/  _/              _/
00004  *                       _/         _/             _/
00005  *                      _/            _/_/        _/
00006  *                     _/                 _/     _/
00007  *                     _/   _/      _/    _/    _/
00008  *                      _/_/         _/_/    _/_/_/
00009  */
00034 #ifndef _V4L2UVC_H
00035 #define _V4L2UVC_H
00036 
00037 #include <stdio.h>
00038 #include <stdlib.h>
00039 #include <unistd.h>
00040 #include <string.h>
00041 #include <sys/types.h>
00042 #include <sys/ioctl.h>          /* ioctl */
00043 #include <sys/mman.h>           /* for MAP_SHARED etc */
00044 #include <sys/select.h>         /* select,etc. */
00045 #include <fcntl.h>              /* open, etc */
00046 #include <errno.h>
00047 #include <linux/videodev2.h>
00048 #include "my-types.h"
00049 
00050 /* for debug */
00051 #define DEBUG
00052 #include "debug-msg.h"
00053 
00055 #define NB_BUFFER 4
00056 
00058 #define device "/dev/video"
00059 
00061 struct video_info
00062 {
00063     int camfd;                  
00064     struct v4l2_capability cap; 
00065     struct v4l2_format fmt;     
00066     struct v4l2_requestbuffers rb;      
00067     struct v4l2_buffer buf;     
00068     enum v4l2_buf_type type;    
00069     void* mem[NB_BUFFER];       
00070     uint8* tmp_buffer;          
00071     uint8* frame_buffer;        
00072     uint32 frame_size_in;       
00074     uint32 format;              
00075     int width;                  
00076     int height;                 
00077     int is_streaming;           
00078     int is_quit;                
00080     enum v4l2_field field;
00081     uint32 bytes_per_line;
00082     uint32 size_image;
00083     enum v4l2_colorspace color_space;
00084     uint32 priv;
00085 };
00086 
00087 
00088 int v4l2_open(struct video_info* vd_info);
00089 int v4l2_close(struct video_info* vd_info);
00090 
00091 int v4l2_init(struct video_info* vd_info, uint32 format,
00092               uint32 width, uint32 height);
00093 int v4l2_on(struct video_info* vd_info);
00094 int v4l2_off(struct video_info* vd_info);
00095 
00096 int v4l2_grab(struct video_info* vd_info);
00097 
00098 void v4l2_capture(struct video_info* vd_info);
00099 
00100 int v4l2_process(struct video_info* vd_info);
00101 
00102 int v4l2_get_pic(struct video_info* vd_info);
00103 
00104 int v4l2_get_capability(struct video_info* vd_info);
00105 int v4l2_get_format(struct video_info* vd_info);
00106 int v4l2_set_foramt(struct video_info* vd_info,
00107                     uint32 width, uint32 height,uint32 format);
00108 
00109 #endif  /* _CAMERA_H */