pwc-ioctl.h

00001 #ifndef PWC_IOCTL_H
00002 #define PWC_IOCTL_H
00003 
00004 /* (C) 2001-2003 Nemosoft Unv.    webcam@smcc.demon.nl
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 /* This is pwc-ioctl.h belonging to PWC 8.12.1
00022    It contains structures and defines to communicate from user space
00023    directly to the driver.
00024  */
00025 
00026 /*
00027    Changes
00028    2001/08/03  Alvarado   Added ioctl constants to access methods for
00029                           changing white balance and red/blue gains
00030    2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
00031    2003/12/13  Nemosft Unv. Some modifications to make interfacing to
00032                PWCX easier
00033  */
00034 
00035 /* These are private ioctl() commands, specific for the Philips webcams.
00036    They contain functions not found in other webcams, and settings not
00037    specified in the Video4Linux API.
00038 
00039    The #define names are built up like follows:
00040    VIDIOC               VIDeo IOCtl prefix
00041          PWC            Philps WebCam
00042             G           optional: Get
00043             S           optional: Set
00044              ...        the function
00045  */
00046 
00047 
00048  /* Enumeration of image sizes */
00049 #define PSZ_SQCIF       0x00
00050 #define PSZ_QSIF        0x01
00051 #define PSZ_QCIF        0x02
00052 #define PSZ_SIF         0x03
00053 #define PSZ_CIF         0x04
00054 #define PSZ_VGA         0x05
00055 #define PSZ_MAX         6
00056 
00057 
00058 /* The frame rate is encoded in the video_window.flags parameter using
00059    the upper 16 bits, since some flags are defined nowadays. The following
00060    defines provide a mask and shift to filter out this value.
00061 
00062    In 'Snapshot' mode the camera freezes its automatic exposure and colour
00063    balance controls.
00064  */
00065 #define PWC_FPS_SHIFT           16
00066 #define PWC_FPS_MASK            0x00FF0000
00067 #define PWC_FPS_FRMASK          0x003F0000
00068 #define PWC_FPS_SNAPSHOT        0x00400000
00069 
00070 
00071 /* structure for transfering x & y coordinates */
00072 struct pwc_coord
00073 {
00074         int x, y;               /* guess what */
00075         int size;               /* size, or offset */
00076 };
00077 
00078 
00079 /* Used with VIDIOCPWCPROBE */
00080 struct pwc_probe
00081 {
00082         char name[32];
00083         int type;
00084 };
00085 
00086 
00087 /* pwc_whitebalance.mode values */
00088 #define PWC_WB_INDOOR           0
00089 #define PWC_WB_OUTDOOR          1
00090 #define PWC_WB_FL               2
00091 #define PWC_WB_MANUAL           3
00092 #define PWC_WB_AUTO             4
00093 
00102 struct pwc_whitebalance
00103 {
00104         int mode;
00105         int manual_red, manual_blue;    /* R/W */
00106         int read_red, read_blue;        /* R/O */
00107 };
00108 
00114 struct pwc_wb_speed
00115 {
00116         int control_speed;
00117         int control_delay;
00118 
00119 };
00120 
00122 struct pwc_leds
00123 {
00124         int led_on;                     /* Led on-time; range = 0..25000 */
00125         int led_off;                    /* Led off-time; range = 0..25000  */
00126 };
00127 
00129 struct pwc_imagesize
00130 {
00131         int width;
00132         int height;
00133 };
00134 
00135 /* Defines and structures for Motorized Pan & Tilt */
00136 #define PWC_MPT_PAN             0x01
00137 #define PWC_MPT_TILT            0x02
00138 #define PWC_MPT_TIMEOUT         0x04 /* for status */
00139 
00145 struct pwc_mpt_angles
00146 {
00147         int absolute;           /* write-only */
00148         int pan;                /* degrees * 100 */
00149         int tilt;               /* degress * 100 */
00150         int zoom;               /* N/A, set to -1 */
00151 };
00152 
00157 struct pwc_mpt_range
00158 {
00159         int pan_min, pan_max;           /* degrees * 100 */
00160         int tilt_min, tilt_max;
00161         int zoom_min, zoom_max;         /* -1, -1 */
00162 };
00163 
00164 struct pwc_mpt_status
00165 {
00166         int status;
00167         int time_pan;
00168         int time_tilt;
00169 };
00170 
00171 
00176 struct pwc_video_command
00177 {
00178         int type;               /* camera type (645, 675, 730, etc.) */
00179         int release;            /* release number */
00180 
00181         int size;               /* one of PSZ_* */
00182         int alternate;
00183         int command_len;        /* length of USB video command */
00184         unsigned char command_buf[13];  /* Actual USB video command */
00185         int bandlength;         /* >0 = compressed */
00186         int frame_size;         /* Size of one (un)compressed frame */
00187 };
00188 
00189 /* Flags for PWCX subroutines. Not all modules honour all flags. */
00190 #define PWCX_FLAG_PLANAR        0x0001
00191 #define PWCX_FLAG_BAYER         0x0008
00192 
00193 
00194 /* IOCTL definitions */
00195 
00196  /* Restore user settings */
00197 #define VIDIOCPWCRUSER          _IO('v', 192)
00198  /* Save user settings */
00199 #define VIDIOCPWCSUSER          _IO('v', 193)
00200  /* Restore factory settings */
00201 #define VIDIOCPWCFACTORY        _IO('v', 194)
00202 
00203  /* You can manipulate the compression factor. A compression preference of 0
00204     means use uncompressed modes when available; 1 is low compression, 2 is
00205     medium and 3 is high compression preferred. Of course, the higher the
00206     compression, the lower the bandwidth used but more chance of artefacts
00207     in the image. The driver automatically chooses a higher compression when
00208     the preferred mode is not available.
00209   */
00210  /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
00211 #define VIDIOCPWCSCQUAL         _IOW('v', 195, int)
00212  /* Get preferred compression quality */
00213 #define VIDIOCPWCGCQUAL         _IOR('v', 195, int)
00214 
00215 
00216  /* This is a probe function; since so many devices are supported, it
00217     becomes difficult to include all the names in programs that want to
00218     check for the enhanced Philips stuff. So in stead, try this PROBE;
00219     it returns a structure with the original name, and the corresponding
00220     Philips type.
00221     To use, fill the structure with zeroes, call PROBE and if that succeeds,
00222     compare the name with that returned from VIDIOCGCAP; they should be the
00223     same. If so, you can be assured it is a Philips (OEM) cam and the type
00224     is valid.
00225  */
00226 #define VIDIOCPWCPROBE          _IOR('v', 199, struct pwc_probe)
00227 
00228  /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
00229 #define VIDIOCPWCSAGC           _IOW('v', 200, int)
00230  /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
00231 #define VIDIOCPWCGAGC           _IOR('v', 200, int)
00232  /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
00233 #define VIDIOCPWCSSHUTTER       _IOW('v', 201, int)
00234 
00235  /* Color compensation (Auto White Balance) */
00236 #define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance)
00237 #define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance)
00238 
00239  /* Auto WB speed */
00240 #define VIDIOCPWCSAWBSPEED      _IOW('v', 203, struct pwc_wb_speed)
00241 #define VIDIOCPWCGAWBSPEED      _IOR('v', 203, struct pwc_wb_speed)
00242 
00243  /* LEDs on/off/blink; int range 0..65535 */
00244 #define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds)
00245 #define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds)
00246 
00247   /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
00248 #define VIDIOCPWCSCONTOUR       _IOW('v', 206, int)
00249 #define VIDIOCPWCGCONTOUR       _IOR('v', 206, int)
00250 
00251   /* Backlight compensation; 0 = off, otherwise on */
00252 #define VIDIOCPWCSBACKLIGHT     _IOW('v', 207, int)
00253 #define VIDIOCPWCGBACKLIGHT     _IOR('v', 207, int)
00254 
00255   /* Flickerless mode; = 0 off, otherwise on */
00256 #define VIDIOCPWCSFLICKER       _IOW('v', 208, int)
00257 #define VIDIOCPWCGFLICKER       _IOR('v', 208, int)  
00258 
00259   /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
00260 #define VIDIOCPWCSDYNNOISE      _IOW('v', 209, int)
00261 #define VIDIOCPWCGDYNNOISE      _IOR('v', 209, int)
00262 
00263  /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
00264 #define VIDIOCPWCGREALSIZE      _IOR('v', 210, struct pwc_imagesize)
00265 
00266  /* Motorized pan & tilt functions */ 
00267 #define VIDIOCPWCMPTRESET       _IOW('v', 211, int)
00268 #define VIDIOCPWCMPTGRANGE      _IOR('v', 211, struct pwc_mpt_range)
00269 #define VIDIOCPWCMPTSANGLE      _IOW('v', 212, struct pwc_mpt_angles)
00270 #define VIDIOCPWCMPTGANGLE      _IOR('v', 212, struct pwc_mpt_angles)
00271 #define VIDIOCPWCMPTSTATUS      _IOR('v', 213, struct pwc_mpt_status)
00272 
00273  /* Get the USB set-video command; needed for initializing libpwcx */
00274 #define VIDIOCPWCGVIDCMD        _IOR('v', 215, struct pwc_video_command)
00275 
00276 #endif

Generated on Sat Oct 27 09:21:03 2007 for QastroCam by  doxygen 1.5.1