v4l2uvc.h

00001 /*******************************************************************************
00002 #               uvcview: 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 #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);

Last updated 12 September 2005 21:38:45