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 #include <stdio.h>
00025 #include <string.h>
00026 #include <fcntl.h>
00027 #include <unistd.h>
00028 #include <errno.h>
00029 #include <stdlib.h>
00030 #include <sys/ioctl.h>
00031 #include <sys/mman.h>
00032 #include <sys/select.h>
00033 #include <linux/types.h>
00034 #include <linux/videodev2.h>
00035
00036 #define NB_BUFFER 2
00037 #define DHT_SIZE 432
00038
00039 #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0)
00040 #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1)
00041 #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2)
00042 #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3)
00043 #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4)
00044 #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5)
00045 #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6)
00046
00047 #define V4L2_CID_PANTILT_RELATIVE (V4L2_CID_PRIVATE_BASE+7)
00048 #define V4L2_CID_PANTILT_RESET (V4L2_CID_PRIVATE_BASE+8)
00049
00050 struct vdIn {
00051 int fd;
00052 char *videodevice;
00053 char *status;
00054 char *pictName;
00055 struct v4l2_capability cap;
00056 struct v4l2_format fmt;
00057 struct v4l2_buffer buf;
00058 struct v4l2_requestbuffers rb;
00059 void *mem[NB_BUFFER];
00060 unsigned char *tmpbuffer;
00061 unsigned char *framebuffer;
00062 int isstreaming;
00063 int grabmethod;
00064 int width;
00065 int height;
00066 int formatIn;
00067 int formatOut;
00068 int framesizeIn;
00069 int signalquit;
00070 int toggleAvi;
00071 int getPict;
00072
00073 };
00074
00075 int
00076 init_videoIn(struct vdIn *vd, char *device, int width, int height,
00077 int format, int grabmethod);
00078 int uvcGrab(struct vdIn *vd);
00079 int close_v4l2(struct vdIn *vd);
00080
00081 int v4l2GetControl(struct vdIn *vd, int control);
00082 int v4l2SetControl(struct vdIn *vd, int control, int value);
00083 int v4l2UpControl(struct vdIn *vd, int control);
00084 int v4l2DownControl(struct vdIn *vd, int control);
00085 int v4l2ToggleControl(struct vdIn *vd, int control);
00086 int v4l2ResetControl(struct vdIn *vd, int control);
00087 int v4l2ResetPanTilt(struct vdIn *vd,int pantilt);
00088 int v4L2UpDownPan(struct vdIn *vd, short inc);
00089 int v4L2UpDownTilt(struct vdIn *vd,short inc);