Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #include <stdio.h>
00025 #include <string.h>
00026 #include <fcntl.h>
00027 #include <unistd.h>
00028 #include <errno.h>
00029 #include <sys/ioctl.h>
00030 #include <sys/mman.h>
00031 #include <sys/select.h>
00032 #include <linux/videodev2.h>
00033 
00034 #include "uvcvideo.h"
00035 #include "dynctrl-logitech.h"
00036 
00037 
00038 #define NB_BUFFER 4
00039 #define DHT_SIZE 432
00040 
00041 
00042 
00043 struct vdIn {
00044     int fd;
00045     char *videodevice;
00046     char *status;
00047     char *pictName;
00048     struct v4l2_capability cap;
00049     struct v4l2_format fmt;
00050     struct v4l2_buffer buf;
00051     struct v4l2_requestbuffers rb;
00052     void *mem[NB_BUFFER];
00053     unsigned char *tmpbuffer;
00054     unsigned char *framebuffer;
00055     int isstreaming;
00056     int grabmethod;
00057     int width;
00058     int height;
00059     float fps;
00060     int formatIn;
00061     int formatOut;
00062     int framesizeIn;
00063     int signalquit;
00064     int toggleAvi;
00065     int getPict;
00066     int rawFrameCapture;
00067     
00068     unsigned int fileCounter;
00069     
00070     unsigned int rfsFramesWritten;
00071     unsigned int rfsBytesWritten;
00072     
00073     FILE *captureFile;
00074     unsigned int framesWritten;
00075     unsigned int bytesWritten;
00076     int framecount;
00077     int recordstart;
00078     int recordtime;
00079 };
00080 int
00081 init_videoIn(struct vdIn *vd, char *device, int width, int height, float fps,
00082              int format, int grabmethod, char *avifilename);
00083 int enum_controls(int vd);
00084 int save_controls(int vd, const char* filename);
00085 int load_controls(int vd, const char* filename);
00086              
00087 int uvcGrab(struct vdIn *vd);
00088 int close_v4l2(struct vdIn *vd);
00089 
00090 int v4l2GetControl(struct vdIn *vd, int control);
00091 int v4l2SetControl(struct vdIn *vd, int control, int value);
00092 int v4l2UpControl(struct vdIn *vd, int control);
00093 int v4l2DownControl(struct vdIn *vd, int control);
00094 int v4l2ToggleControl(struct vdIn *vd, int control);
00095 int v4l2ResetControl(struct vdIn *vd, int control);
00096 int v4l2ResetPanTilt(struct vdIn *vd);
00097 int v4L2UpDownPan(struct vdIn *vd, short inc);
00098 int v4L2UpDownTilt(struct vdIn *vd,short inc);
00099 int v4L2UpDownPanTilt(struct vdIn *vd, short inc_p, short inc_t);
00100 int v4l2SetLightFrequencyFilter(struct vdIn *vd,int flt);
00101 int enum_frame_intervals(int dev, __u32 pixfmt, __u32 width, __u32 height);
00102 int enum_frame_sizes(int dev, __u32 pixfmt);
00103 int enum_frame_formats(int dev, unsigned int *supported_formats, unsigned int max_formats);
00104 
00105 
00106 int check_videoIn(struct vdIn *vd, char *device);
00107 int v4l2ResetPan(struct vdIn *vd);
00108 int v4l2ResetTilt(struct vdIn *vd);