diff -rcN opencv-0.9.7/otherlibs/highgui/Makefile.am opencv-0.9.7+pwc0.3/otherlibs/highgui/Makefile.am
*** opencv-0.9.7/otherlibs/highgui/Makefile.am	2005-07-25 21:25:44.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/Makefile.am	2005-12-01 04:39:24.000000000 +0900
***************
*** 4,10 ****
      cvcap_v4l.cpp grfmt_base.cpp grfmt_bmp.cpp grfmt_jpeg.cpp \
      grfmt_png.cpp grfmt_pxm.cpp grfmt_sunras.cpp grfmt_tiff.cpp \
      image.cpp loadsave.cpp precomp.cpp utils.cpp window_lnx.cpp \
!     window_w32.cpp
  
  EXTRA_DIST = highgui.dsp highgui.vcproj highgui.rc resource.h
  
--- 4,10 ----
      cvcap_v4l.cpp grfmt_base.cpp grfmt_bmp.cpp grfmt_jpeg.cpp \
      grfmt_png.cpp grfmt_pxm.cpp grfmt_sunras.cpp grfmt_tiff.cpp \
      image.cpp loadsave.cpp precomp.cpp utils.cpp window_lnx.cpp \
!     window_w32.cpp cvcap_pwc.cpp
  
  EXTRA_DIST = highgui.dsp highgui.vcproj highgui.rc resource.h
  
***************
*** 12,18 ****
  
  libhighguiinclude_HEADERS = highgui.h
  
! noinst_HEADERS = _highgui.h bitstrm.h grfmt_base.h grfmt_bmp.h grfmt_jpeg.h grfmt_pxm.h grfmt_png.h grfmt_sunras.h grfmt_tiff.h grfmts.h utils.h
  
  libhighgui_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
  
--- 12,18 ----
  
  libhighguiinclude_HEADERS = highgui.h
  
! noinst_HEADERS = _highgui.h bitstrm.h grfmt_base.h grfmt_bmp.h grfmt_jpeg.h grfmt_pxm.h grfmt_png.h grfmt_sunras.h grfmt_tiff.h grfmts.h utils.h cvcap_v4l.h
  
  libhighgui_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
  
diff -rcN opencv-0.9.7/otherlibs/highgui/Makefile.in opencv-0.9.7+pwc0.3/otherlibs/highgui/Makefile.in
*** opencv-0.9.7/otherlibs/highgui/Makefile.in	2005-07-26 22:57:05.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/Makefile.in	2005-12-01 04:39:24.000000000 +0900
***************
*** 68,74 ****
  	cvcap_v4l.lo grfmt_base.lo grfmt_bmp.lo grfmt_jpeg.lo \
  	grfmt_png.lo grfmt_pxm.lo grfmt_sunras.lo grfmt_tiff.lo \
  	image.lo loadsave.lo precomp.lo utils.lo window_lnx.lo \
! 	window_w32.lo
  libhighgui_la_OBJECTS = $(am_libhighgui_la_OBJECTS)
  DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
  depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
--- 68,74 ----
  	cvcap_v4l.lo grfmt_base.lo grfmt_bmp.lo grfmt_jpeg.lo \
  	grfmt_png.lo grfmt_pxm.lo grfmt_sunras.lo grfmt_tiff.lo \
  	image.lo loadsave.lo precomp.lo utils.lo window_lnx.lo \
! 	window_w32.lo cvcap_pwc.lo
  libhighgui_la_OBJECTS = $(am_libhighgui_la_OBJECTS)
  DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
  depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp
***************
*** 229,240 ****
      cvcap_v4l.cpp grfmt_base.cpp grfmt_bmp.cpp grfmt_jpeg.cpp \
      grfmt_png.cpp grfmt_pxm.cpp grfmt_sunras.cpp grfmt_tiff.cpp \
      image.cpp loadsave.cpp precomp.cpp utils.cpp window_lnx.cpp \
!     window_w32.cpp
  
  EXTRA_DIST = highgui.dsp highgui.vcproj highgui.rc resource.h
  libhighguiincludedir = $(includedir)/opencv
  libhighguiinclude_HEADERS = highgui.h
! noinst_HEADERS = _highgui.h bitstrm.h grfmt_base.h grfmt_bmp.h grfmt_jpeg.h grfmt_pxm.h grfmt_png.h grfmt_sunras.h grfmt_tiff.h grfmts.h utils.h
  libhighgui_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
  libhighgui_la_LIBADD = $(top_builddir)/cv/src/libcv.la @GTK_LIBS@ @IMAGELIBS@ @FFMPEGLIBS@ @IEEE1394LIBS@
  INCLUDES = -I. -I$(top_srcdir)/cxcore/include -I$(top_srcdir)/cv/include @GTK_CFLAGS@
--- 229,240 ----
      cvcap_v4l.cpp grfmt_base.cpp grfmt_bmp.cpp grfmt_jpeg.cpp \
      grfmt_png.cpp grfmt_pxm.cpp grfmt_sunras.cpp grfmt_tiff.cpp \
      image.cpp loadsave.cpp precomp.cpp utils.cpp window_lnx.cpp \
!     window_w32.cpp cvcap_pwc.cpp
  
  EXTRA_DIST = highgui.dsp highgui.vcproj highgui.rc resource.h
  libhighguiincludedir = $(includedir)/opencv
  libhighguiinclude_HEADERS = highgui.h
! noinst_HEADERS = _highgui.h bitstrm.h grfmt_base.h grfmt_bmp.h grfmt_jpeg.h grfmt_pxm.h grfmt_png.h grfmt_sunras.h grfmt_tiff.h grfmts.h utils.h cvcap_v4l.h
  libhighgui_la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ @LDFLAGS@
  libhighgui_la_LIBADD = $(top_builddir)/cv/src/libcv.la @GTK_LIBS@ @IMAGELIBS@ @FFMPEGLIBS@ @IEEE1394LIBS@
  INCLUDES = -I. -I$(top_srcdir)/cxcore/include -I$(top_srcdir)/cv/include @GTK_CFLAGS@
***************
*** 311,316 ****
--- 311,317 ----
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvcap.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvcap_dc1394.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvcap_v4l.Plo@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvcap_pwc.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grfmt_base.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grfmt_bmp.Plo@am__quote@
  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grfmt_jpeg.Plo@am__quote@
diff -rcN opencv-0.9.7/otherlibs/highgui/cvcap_pwc.cpp opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_pwc.cpp
*** opencv-0.9.7/otherlibs/highgui/cvcap_pwc.cpp	1970-01-01 09:00:00.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_pwc.cpp	2005-12-02 13:38:47.000000000 +0900
***************
*** 0 ****
--- 1,152 ----
+ /* This is the contributed code:
+ 
+     File :cvcap_pwc.cpp
+     Original Version : 2005-11-25 Osamu Matsumoto osamu-m@is.naist.jp
+     Description :
+ 
+ */
+ 
+ /*M///////////////////////////////////////////////////////////////////////////////////////
+ //
+ //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+ //
+ //  By downloading, copying, installing or using the software you agree to this license.
+ //  If you do not agree to this license, do not download, install,
+ //  copy or use the software.
+ //
+ //
+ //                        Intel License Agreement
+ //                For Open Source Computer Vision Library
+ //
+ // Copyright (C) 2000, Intel Corporation, all rights reserved.
+ // Third party copyrights are property of their respective owners.
+ //
+ // Redistribution and use in source and binary forms, with or without modification,
+ // are permitted provided that the following conditions are met:
+ //
+ //   * Redistribution's of source code must retain the above copyright notice,
+ //     this list of conditions and the following disclaimer.
+ //
+ //   * Redistribution's in binary form must reproduce the above copyright notice,
+ //     this list of conditions and the following disclaimer in the documentation
+ //     and/or other materials provided with the distribution.
+ //
+ //   * The name of Intel Corporation may not be used to endorse or promote products
+ //     derived from this software without specific prior written permission.
+ //
+ // This software is provided by the copyright holders and contributors "as is" and
+ // any express or implied warranties, including, but not limited to, the implied
+ // warranties of merchantability and fitness for a particular purpose are disclaimed.
+ // In no event shall the Intel Corporation or contributors be liable for any direct,
+ // indirect, incidental, special, exemplary, or consequential damages
+ // (including, but not limited to, procurement of substitute goods or services;
+ // loss of use, data, or profits; or business interruption) however caused
+ // and on any theory of liability, whether in contract, strict liability,
+ // or tort (including negligence or otherwise) arising in any way out of
+ // the use of this software, even if advised of the possibility of such damage.
+ //
+ //M*/
+ 
+ #include "_highgui.h"
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+ #include <sys/mman.h>
+ 
+ #include <linux/videodev.h>
+ #include "cvcap_v4l.h"
+ #include "pwc-ioctl.h"
+ 
+ #define IN_RANGE(x,max,min) ((max) >= (x) && (x) >= (min))
+ 
+ static int icvGetPanTilt(CvCaptureCAM_V4L *capture,CvPanTilt *dst)
+ {
+ 	struct pwc_mpt_angles angles;
+ 
+ 	if ( ioctl(capture->deviceHandle,
+ 		   VIDIOCPWCMPTGANGLE, &angles)){
+ 		perror("HIGHGUI ERROR: PWC: while ioctl(VIDIOCPWCMPTGANGLE)\n");
+ 		return -1;
+ 	}
+ 	dst->pan = angles.pan;
+ 	dst->tilt = angles.tilt;
+ 
+ 	return 0;
+ }
+ 
+ static int icvSetPanTilt(CvCaptureCAM_V4L *capture,int abs,CvPanTilt d){
+ 	struct pwc_mpt_angles angles;
+ 
+ 	angles.absolute = abs;
+ 	angles.pan = d.pan;
+ 	angles.tilt= d.tilt;
+ 
+ 	if ( ioctl(capture->deviceHandle,
+ 		   VIDIOCPWCMPTSANGLE, &angles)){
+ 		perror("HIGHGUI ERROR: PWC: while ioctl(VIDIOPWCMPTSANGLE)\n");
+ 		return -1;
+ 	}
+ 	return 0;
+ }
+ 
+ CV_IMPL int cvRelativePanTilt(CvCapture *capture,CvPanTilt d,
+ 			      CvPanTiltRange range){
+ 	CvPanTilt angle;
+ 	if(capture && capture->vtable &&
+ 	   (cvGetPanTilt(capture,&angle)==0) &&
+ 	   IN_RANGE(angle.pan + d.pan, range.pan_max,range.pan_min) &&
+ 	   IN_RANGE(angle.tilt + d.tilt, range.tilt_max, range.tilt_min))
+ 		return icvSetPanTilt( (CvCaptureCAM_V4L *)capture ,0 ,d);
+ 
+ 	return -1;
+ }
+ 
+ CV_IMPL int cvAbsolutePanTilt(CvCapture *capture ,CvPanTilt p,CvPanTiltRange range){
+ 	if(capture && capture->vtable &&
+ 	   IN_RANGE(p.pan, range.pan_max, range.pan_min) &&
+ 	   IN_RANGE(p.tilt,  range.tilt_max , range.tilt_min))
+ 		return icvSetPanTilt( (CvCaptureCAM_V4L *)capture, 1 , p);
+ 
+ 	return -1;
+ }
+ 
+ CV_IMPL int cvGetPanTilt(CvCapture *capture,CvPanTilt *p){
+ 	if(capture && capture->vtable)
+ 		return icvGetPanTilt( (CvCaptureCAM_V4L *)capture ,p );
+ 	return -1;
+ }
+ 
+ CV_IMPL CvPanTiltRange cvRangePanTilt(CvCapture *capture)
+ {
+ 	struct pwc_mpt_range range;
+ 	CvPanTiltRange p;
+ 
+ 	if ( ioctl(((CvCaptureCAM_V4L *)capture)->deviceHandle,
+ 		   VIDIOCPWCMPTGRANGE, &range)){
+ 		fprintf(stderr,"HIGHGUI ERROR: PWC: while ioctl(PWCMPTGRANGE)\n");
+ 		return p;
+ 	}
+ 
+ 	p.pan_min = range.pan_min;
+ 	p.pan_max = range.pan_max;
+ 	p.tilt_min = range.tilt_min;
+ 	p.tilt_max = range.tilt_max;
+ 
+ 	return p;
+ }
+ CV_IMPL void cvSetLED(CvCapture *capture,int on_time,int off_time){
+ 	struct pwc_leds LED;
+ 	
+ 	LED.led_on = on_time;
+ 	LED.led_off = off_time;
+ 	if ( ioctl(((CvCaptureCAM_V4L *)capture)->deviceHandle,
+ 		   VIDIOCPWCSLED, &LED)){
+ 		fprintf(stderr,"HIGHGUI ERROR: PWC: while ioctl(VIDIOCPWCSLED)\n");
+ 	}
+ }
+ 
+ 
+ 
diff -rcN opencv-0.9.7/otherlibs/highgui/cvcap_v4l.cpp opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_v4l.cpp
*** opencv-0.9.7/otherlibs/highgui/cvcap_v4l.cpp	2005-07-21 17:37:17.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_v4l.cpp	2005-12-02 13:38:47.000000000 +0900
***************
*** 143,174 ****
  #include <linux/kernel.h>
  #include <linux/videodev.h>
  
! /* Defaults - If your board can do better, set it here.  Set for the most common type inputs. */
! #define DEFAULT_V4L_WIDTH  640
! #define DEFAULT_V4L_HEIGHT 480
! 
! #define CHANNEL_NUMBER 1
! #define MAX_CAMERAS 8
! 
! #define MAX_DEVICE_DRIVER_NAME 80
! 
! /* Device Capture Objects */
! 
! typedef struct CvCaptureCAM_V4L
! {
!     CvCaptureVTable* vtable;
!     int deviceHandle;
!     int bufferIndex;
!     int FirstCapture;
!     struct video_capability capability;
!     struct video_window     captureWindow;
!     struct video_picture    imageProperties; 
!     struct video_mbuf       memoryBuffer;
!     struct video_mmap       *mmaps;
!     char *memoryMap;
!     IplImage frame;
! }
! CvCaptureCAM_V4L;
  
  static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture );
  
--- 143,149 ----
  #include <linux/kernel.h>
  #include <linux/videodev.h>
  
! #include "cvcap_v4l.h"
  
  static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture );
  
diff -rcN opencv-0.9.7/otherlibs/highgui/cvcap_v4l.h opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_v4l.h
*** opencv-0.9.7/otherlibs/highgui/cvcap_v4l.h	1970-01-01 09:00:00.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/cvcap_v4l.h	2005-12-02 13:38:59.000000000 +0900
***************
*** 0 ****
--- 1,84 ----
+ /* 
+    File :	cvcap_v4l.h
+    Original : opencv-0.9.7/otherlibs/cvcap_v4l.cpp
+    Modifiers : Osamu Matsumoto <osamu-m@is.naist.jp>
+    Modifiers Comments:
+    I'm appending pan-tilt camera control functions to opencv.
+    I want to use deviceHandle in CvCaptureCAM_V4L for sending ioctl to
+    device.
+    
+ */
+ /*M///////////////////////////////////////////////////////////////////////////////////////
+ //
+ //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
+ //
+ //  By downloading, copying, installing or using the software you agree to this license.
+ //  If you do not agree to this license, do not download, install,
+ //  copy or use the software.
+ //
+ //
+ //                        Intel License Agreement
+ //                For Open Source Computer Vision Library
+ //
+ // Copyright (C) 2000, Intel Corporation, all rights reserved.
+ // Third party copyrights are property of their respective owners.
+ //
+ // Redistribution and use in source and binary forms, with or without modification,
+ // are permitted provided that the following conditions are met:
+ //
+ //   * Redistribution's of source code must retain the above copyright notice,
+ //     this list of conditions and the following disclaimer.
+ //
+ //   * Redistribution's in binary form must reproduce the above copyright notice,
+ //     this list of conditions and the following disclaimer in the documentation
+ //     and/or other materials provided with the distribution.
+ //
+ //   * The name of Intel Corporation may not be used to endorse or promote products
+ //     derived from this software without specific prior written permission.
+ //
+ // This software is provided by the copyright holders and contributors "as is" and
+ // any express or implied warranties, including, but not limited to, the implied
+ // warranties of merchantability and fitness for a particular purpose are disclaimed.
+ // In no event shall the Intel Corporation or contributors be liable for any direct,
+ // indirect, incidental, special, exemplary, or consequential damages
+ // (including, but not limited to, procurement of substitute goods or services;
+ // loss of use, data, or profits; or business interruption) however caused
+ // and on any theory of liability, whether in contract, strict liability,
+ // or tort (including negligence or otherwise) arising in any way out of
+ // the use of this software, even if advised of the possibility of such damage.
+ //
+ //M*/
+ 
+ #ifndef CVCAP_V4L_H
+ #define CVCAP_V4L_H
+ 
+ 
+ /* Defaults - If your board can do better, set it here.  Set for the most common type inputs. */
+ #define DEFAULT_V4L_WIDTH  640
+ #define DEFAULT_V4L_HEIGHT 480
+ 
+ #define CHANNEL_NUMBER 0
+ #define MAX_CAMERAS 8
+ 
+ #define MAX_DEVICE_DRIVER_NAME 80
+ 
+ /* Device Capture Objects */
+ 
+ typedef struct CvCaptureCAM_V4L
+ {
+     CvCaptureVTable* vtable;
+     int deviceHandle;
+     int bufferIndex;
+     int FirstCapture;
+     struct video_capability capability;
+     struct video_window     captureWindow;
+     struct video_picture    imageProperties; 
+     struct video_mbuf       memoryBuffer;
+     struct video_mmap       *mmaps;
+     char *memoryMap;
+     IplImage frame;
+ }
+ CvCaptureCAM_V4L;
+ 
+ 
+ #endif
diff -rcN opencv-0.9.7/otherlibs/highgui/highgui.h opencv-0.9.7+pwc0.3/otherlibs/highgui/highgui.h
*** opencv-0.9.7/otherlibs/highgui/highgui.h	2005-07-06 00:52:50.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/highgui.h	2005-12-02 13:38:59.000000000 +0900
***************
*** 444,447 ****
--- 444,479 ----
  
  #endif /* __cplusplus */
  
+ 
+ /****************************************************************
+     Specifics for PWC Driver
+ *****************************************************************/
+ 
+ struct CvPanTilt{
+ 	int pan,tilt;
+ };
+ 
+ struct CvPanTiltRange{
+ 	int pan_max,pan_min;
+ 	int tilt_max,tilt_min;
+ };
+ 
+ typedef struct CvPanTilt CvPanTilt;
+ typedef struct CvPanTiltRange CvPanTiltRange;
+ 
+ CV_INLINE CvPanTilt cvPanTilt(int pan,int tilt){
+ 	CvPanTilt s;
+ 	s.pan = pan;
+ 	s.tilt = tilt;
+ 	return s;
+ }
+ 
+ CVAPI(int) cvRelativePanTilt(CvCapture *capture,CvPanTilt angle,
+ 			     CvPanTiltRange range);
+ CVAPI(int) cvAbsolutePanTilt(CvCapture *capture,CvPanTilt angle,
+ 			     CvPanTiltRange range);
+ CVAPI(int)  cvGetPanTilt(CvCapture *capture,CvPanTilt *angle);
+ CVAPI(CvPanTiltRange) cvRangePanTilt(CvCapture *capture);
+ CVAPI(void) cvSetLED(CvCapture *capture,int on_time,int off_time);
+ 
  #endif /* _HIGH_GUI_ */
diff -rcN opencv-0.9.7/otherlibs/highgui/pwc-ioctl.h opencv-0.9.7+pwc0.3/otherlibs/highgui/pwc-ioctl.h
*** opencv-0.9.7/otherlibs/highgui/pwc-ioctl.h	1970-01-01 09:00:00.000000000 +0900
--- opencv-0.9.7+pwc0.3/otherlibs/highgui/pwc-ioctl.h	2005-12-02 13:38:59.000000000 +0900
***************
*** 0 ****
--- 1,307 ----
+ #ifndef PWC_IOCTL_H
+ #define PWC_IOCTL_H
+ 
+ /* (C) 2001-2004 Nemosoft Unv.
+    (C) 2004      Luc Saillard (luc@saillard.org)
+ 
+    NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+    driver and thus may have bugs that are not present in the original version.
+    Please send bug reports and support requests to <luc@saillard.org>.
+    The decompression routines have been implemented by reverse-engineering the
+    Nemosoft binary pwcx module. Caveat emptor.
+ 
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+ 
+ /* This is pwc-ioctl.h belonging to PWC 8.12.1
+    It contains structures and defines to communicate from user space
+    directly to the driver.
+  */
+ 
+ /*
+    Changes
+    2001/08/03  Alvarado   Added ioctl constants to access methods for
+                           changing white balance and red/blue gains
+    2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
+    2003/12/13  Nemosft Unv. Some modifications to make interfacing to
+                PWCX easier
+  */
+ 
+ /* These are private ioctl() commands, specific for the Philips webcams.
+    They contain functions not found in other webcams, and settings not
+    specified in the Video4Linux API.
+ 
+    The #define names are built up like follows:
+    VIDIOC		VIDeo IOCtl prefix
+          PWC		Philps WebCam
+             G           optional: Get
+             S           optional: Set
+              ... 	the function
+  */
+ 
+ 
+  /* Enumeration of image sizes */
+ #define PSZ_SQCIF	0x00
+ #define PSZ_QSIF	0x01
+ #define PSZ_QCIF	0x02
+ #define PSZ_SIF		0x03
+ #define PSZ_CIF		0x04
+ #define PSZ_VGA		0x05
+ #define PSZ_MAX		6
+ 
+ 
+ /* The frame rate is encoded in the video_window.flags parameter using
+    the upper 16 bits, since some flags are defined nowadays. The following
+    defines provide a mask and shift to filter out this value.
+    This value can also be passing using the private flag when using v4l2 and
+    VIDIOC_S_FMT ioctl.
+ 
+    In 'Snapshot' mode the camera freezes its automatic exposure and colour
+    balance controls.
+  */
+ #define PWC_FPS_SHIFT		16
+ #define PWC_FPS_MASK		0x00FF0000
+ #define PWC_FPS_FRMASK		0x003F0000
+ #define PWC_FPS_SNAPSHOT	0x00400000
+ #define PWC_QLT_MASK		0x03000000
+ #define PWC_QLT_SHIFT		24
+ 
+ 
+ /* structure for transfering x & y coordinates */
+ struct pwc_coord
+ {
+ 	int x, y;		/* guess what */
+ 	int size;		/* size, or offset */
+ };
+ 
+ 
+ /* Used with VIDIOCPWCPROBE */
+ struct pwc_probe
+ {
+ 	char name[32];
+ 	int type;
+ };
+ 
+ struct pwc_serial
+ {
+ 	char serial[30];	/* String with serial number. Contains terminating 0 */
+ };
+ 	
+ /* pwc_whitebalance.mode values */
+ #define PWC_WB_INDOOR		0
+ #define PWC_WB_OUTDOOR		1
+ #define PWC_WB_FL		2
+ #define PWC_WB_MANUAL		3
+ #define PWC_WB_AUTO		4
+ 
+ /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 
+    Set mode to one of the PWC_WB_* values above.
+    *red and *blue are the respective gains of these colour components inside 
+    the camera; range 0..65535
+    When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 
+    otherwise undefined.
+    'read_red' and 'read_blue' are read-only.
+ */   
+ struct pwc_whitebalance
+ {
+ 	int mode;
+ 	int manual_red, manual_blue;	/* R/W */
+ 	int read_red, read_blue;	/* R/O */
+ };
+ 
+ /* 
+    'control_speed' and 'control_delay' are used in automatic whitebalance mode,
+    and tell the camera how fast it should react to changes in lighting, and 
+    with how much delay. Valid values are 0..65535.
+ */
+ struct pwc_wb_speed
+ {
+ 	int control_speed;
+ 	int control_delay;
+ 
+ };
+ 
+ /* Used with VIDIOCPWC[SG]LED */
+ struct pwc_leds
+ {
+ 	int led_on;			/* Led on-time; range = 0..25000 */
+ 	int led_off;			/* Led off-time; range = 0..25000  */
+ };
+ 
+ /* Image size (used with GREALSIZE) */
+ struct pwc_imagesize
+ {
+ 	int width;
+ 	int height;
+ };
+ 
+ /* Defines and structures for Motorized Pan & Tilt */
+ #define PWC_MPT_PAN		0x01
+ #define PWC_MPT_TILT		0x02
+ #define PWC_MPT_TIMEOUT		0x04 /* for status */
+ 
+ /* Set angles; when absolute != 0, the angle is absolute and the 
+    driver calculates the relative offset for you. This can only
+    be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
+    absolute angles.
+  */   
+ struct pwc_mpt_angles
+ {
+ 	int absolute;		/* write-only */
+ 	int pan;		/* degrees * 100 */
+ 	int tilt;		/* degress * 100 */
+ };
+ 
+ /* Range of angles of the camera, both horizontally and vertically.
+  */
+ struct pwc_mpt_range
+ {
+ 	int pan_min, pan_max;		/* degrees * 100 */
+ 	int tilt_min, tilt_max;
+ };
+ 
+ struct pwc_mpt_status
+ {
+ 	int status;
+ 	int time_pan;
+ 	int time_tilt;
+ };
+ 
+ 
+ /* This is used for out-of-kernel decompression. With it, you can get
+    all the necessary information to initialize and use the decompressor
+    routines in standalone applications.
+  */   
+ struct pwc_video_command
+ {
+ 	int type;		/* camera type (645, 675, 730, etc.) */
+ 	int release;		/* release number */
+ 
+         int size;		/* one of PSZ_* */
+         int alternate;
+ 	int command_len;	/* length of USB video command */
+ 	unsigned char command_buf[13];	/* Actual USB video command */
+ 	int bandlength;		/* >0 = compressed */
+ 	int frame_size;		/* Size of one (un)compressed frame */
+ };
+ 
+ /* Flags for PWCX subroutines. Not all modules honour all flags. */
+ #define PWCX_FLAG_PLANAR	0x0001
+ #define PWCX_FLAG_BAYER		0x0008
+ 
+ 
+ /* IOCTL definitions */
+ 
+  /* Restore user settings */
+ #define VIDIOCPWCRUSER		_IO('v', 192)
+  /* Save user settings */
+ #define VIDIOCPWCSUSER		_IO('v', 193)
+  /* Restore factory settings */
+ #define VIDIOCPWCFACTORY	_IO('v', 194)
+ 
+  /* You can manipulate the compression factor. A compression preference of 0
+     means use uncompressed modes when available; 1 is low compression, 2 is
+     medium and 3 is high compression preferred. Of course, the higher the
+     compression, the lower the bandwidth used but more chance of artefacts
+     in the image. The driver automatically chooses a higher compression when
+     the preferred mode is not available.
+   */
+  /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
+ #define VIDIOCPWCSCQUAL		_IOW('v', 195, int)
+  /* Get preferred compression quality */
+ #define VIDIOCPWCGCQUAL		_IOR('v', 195, int)
+ 
+ 
+ /* Retrieve serial number of camera */
+ #define VIDIOCPWCGSERIAL	_IOR('v', 198, struct pwc_serial)
+ 
+  /* This is a probe function; since so many devices are supported, it
+     becomes difficult to include all the names in programs that want to
+     check for the enhanced Philips stuff. So in stead, try this PROBE;
+     it returns a structure with the original name, and the corresponding
+     Philips type.
+     To use, fill the structure with zeroes, call PROBE and if that succeeds,
+     compare the name with that returned from VIDIOCGCAP; they should be the
+     same. If so, you can be assured it is a Philips (OEM) cam and the type
+     is valid.
+  */
+ #define VIDIOCPWCPROBE		_IOR('v', 199, struct pwc_probe)
+ 
+  /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
+ #define VIDIOCPWCSAGC		_IOW('v', 200, int)
+  /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
+ #define VIDIOCPWCGAGC		_IOR('v', 200, int)
+  /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
+ #define VIDIOCPWCSSHUTTER	_IOW('v', 201, int)
+ 
+  /* Color compensation (Auto White Balance) */
+ #define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance)
+ #define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance)
+ 
+  /* Auto WB speed */
+ #define VIDIOCPWCSAWBSPEED	_IOW('v', 203, struct pwc_wb_speed)
+ #define VIDIOCPWCGAWBSPEED	_IOR('v', 203, struct pwc_wb_speed)
+ 
+  /* LEDs on/off/blink; int range 0..65535 */
+ #define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds)
+ #define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds)
+ 
+   /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
+ #define VIDIOCPWCSCONTOUR	_IOW('v', 206, int)
+ #define VIDIOCPWCGCONTOUR	_IOR('v', 206, int)
+ 
+   /* Backlight compensation; 0 = off, otherwise on */
+ #define VIDIOCPWCSBACKLIGHT	_IOW('v', 207, int)
+ #define VIDIOCPWCGBACKLIGHT	_IOR('v', 207, int)
+ 
+   /* Flickerless mode; = 0 off, otherwise on */
+ #define VIDIOCPWCSFLICKER	_IOW('v', 208, int)
+ #define VIDIOCPWCGFLICKER	_IOR('v', 208, int)  
+ 
+   /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
+ #define VIDIOCPWCSDYNNOISE	_IOW('v', 209, int)
+ #define VIDIOCPWCGDYNNOISE	_IOR('v', 209, int)
+ 
+  /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
+ #define VIDIOCPWCGREALSIZE	_IOR('v', 210, struct pwc_imagesize)
+ 
+  /* Motorized pan & tilt functions */ 
+ #define VIDIOCPWCMPTRESET	_IOW('v', 211, int)
+ #define VIDIOCPWCMPTGRANGE	_IOR('v', 211, struct pwc_mpt_range)
+ #define VIDIOCPWCMPTSANGLE	_IOW('v', 212, struct pwc_mpt_angles)
+ #define VIDIOCPWCMPTGANGLE	_IOR('v', 212, struct pwc_mpt_angles)
+ #define VIDIOCPWCMPTSTATUS	_IOR('v', 213, struct pwc_mpt_status)
+ 
+  /* Get the USB set-video command; needed for initializing libpwcx */
+ #define VIDIOCPWCGVIDCMD	_IOR('v', 215, struct pwc_video_command)
+ struct pwc_table_init_buffer {
+    int len;
+    char *buffer;
+ 
+ };
+ #define VIDIOCPWCGVIDTABLE	_IOR('v', 216, struct pwc_table_init_buffer)
+ 
+ /*
+  * This is private command used when communicating with v4l2.
+  * In the future all private ioctl will be remove/replace to 
+  * use interface offer by v4l2.
+  */
+ 
+ #define V4L2_CID_PRIVATE_SAVE_USER       (V4L2_CID_PRIVATE_BASE + 0)
+ #define V4L2_CID_PRIVATE_RESTORE_USER    (V4L2_CID_PRIVATE_BASE + 1)
+ #define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
+ 
+ 
+ #endif
