00001 /******************************************************************************* 00002 # luvcview: Sdl video Usb Video Class grabber . # 00003 #This package work with the Logitech UVC based webcams with the mjpeg feature. # 00004 #All the decoding is in user space with the embedded jpeg decoder # 00005 #. # 00006 # Copyright (C) 2005 2006 Laurent Pinchart && Michel Xhaard # 00007 # # 00008 # This program is free software; you can redistribute it and/or modify # 00009 # it under the terms of the GNU General Public License as published by # 00010 # the Free Software Foundation; either version 2 of the License, or # 00011 # (at your option) any later version. # 00012 # # 00013 # This program is distributed in the hope that it will be useful, # 00014 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 00015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 00016 # GNU General Public License for more details. # 00017 # # 00018 # You should have received a copy of the GNU General Public License # 00019 # along with this program; if not, write to the Free Software # 00020 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 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 /* raw frame capture */ 00072 unsigned int fileCounter; 00073 /* raw frame stream capture */ 00074 unsigned int rfsFramesWritten; 00075 unsigned int rfsBytesWritten; 00076 /* raw stream capture */ 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