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