Enlightenment CVS committal
Author : gilbertt
Project : misc
Module : camE
Dir : misc/camE
Modified Files:
example.camErc example.camErc.ssh pwc-ioctl.h webcam.c
Log Message:
Patch from Alexander Wirtz <[EMAIL PROTECTED]>
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/example.camErc,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- example.camErc 25 Feb 2004 12:01:45 -0000 1.26
+++ example.camErc 19 Jul 2004 16:07:47 -0000 1.27
@@ -79,6 +79,10 @@
# (0-100)
pwc_wb_red = 50
pwc_wb_blue = 50
+
+# Backlight compensation mode
+# switched off, when set to 0
+pwc_backlight_mode = 1
########################################################
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/example.camErc.ssh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- example.camErc.ssh 25 Jun 2003 08:22:38 -0000 1.9
+++ example.camErc.ssh 19 Jul 2004 16:07:47 -0000 1.10
@@ -53,6 +53,10 @@
# (0-100)
pwc_wb_red = 50
pwc_wb_blue = 50
+
+# Backlight compensation mode
+# switched off, when set to 0
+pwc_backlight_mode = 1
########################################################
# where to log activity. comment out this line to disable logging
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/pwc-ioctl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- pwc-ioctl.h 27 Feb 2002 19:23:38 -0000 1.2
+++ pwc-ioctl.h 19 Jul 2004 16:07:47 -0000 1.3
@@ -1,8 +1,8 @@
#ifndef PWC_IOCTL_H
#define PWC_IOCTL_H
-/* (C) 2001 Nemosoft Unv. [EMAIL PROTECTED]
-
+/* (C) 2001-2004 Nemosoft Unv. [EMAIL PROTECTED]
+
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
@@ -18,16 +18,24 @@
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
+ 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.
-
+ specified in the Video4Linux API.
+
The #define names are built up like follows:
VIDIOC VIDeo IOCtl prefix
PWC Philps WebCam
@@ -37,13 +45,21 @@
*/
+ /* 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.
-
- In 'Snapshot' mode the camera freezes its automatic exposure and colour
+
+ In 'Snapshot' mode the camera freezes its automatic exposure and colour
balance controls.
*/
#define PWC_FPS_SHIFT 16
@@ -52,6 +68,26 @@
#define PWC_FPS_SNAPSHOT 0x00400000
+/* 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
@@ -63,11 +99,10 @@
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;
+ When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
otherwise undefined.
- read_red and read_blue are read-only.
+ 'read_red' and 'read_blue' are read-only.
*/
-
struct pwc_whitebalance
{
int mode;
@@ -75,6 +110,17 @@
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
@@ -83,8 +129,70 @@
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 */
@@ -104,6 +212,22 @@
/* 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 */
@@ -115,9 +239,41 @@
#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
- /* Turn LED on/off ; int range 0..65535 */
+ /* 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)
- /* Get state of LED; int range 0..65535 */
#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)
+
#endif
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/webcam.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- webcam.c 25 Jun 2004 23:53:47 -0000 1.72
+++ webcam.c 19 Jul 2004 16:07:47 -0000 1.73
@@ -121,6 +121,7 @@
char *pwc_wb_mode = "auto";
int pwc_wb_red = 50;
int pwc_wb_blue = 50;
+int pwc_backlight_mode = 1;
int crop = 0;
int crop_x = 0;
@@ -261,6 +262,8 @@
struct video_capability grab_cap;
struct video_channel grab_chan;
struct video_mbuf vid_mbuf;
+ struct pwc_probe probe;
+ int IsPhilips = 0;
int type;
if ((grab_fd = open(grab_device, O_RDWR)) == -1) {
@@ -291,8 +294,20 @@
ioctl(grab_fd, VIDIOCGMBUF, &vid_mbuf);
camlog("%s detected\n", grab_cap.name);
+ if (sscanf(grab_cap.name, "Philips %d webcam", &type) == 1)
+ IsPhilips = 1;
+ else {
+ /* No match yet; try the PROBE */
+ if (ioctl(grab_fd, VIDIOCPWCPROBE, &probe) == 0) {
+ if (!strcmp(grab_cap.name, probe.name)) {
+ IsPhilips = 1;
+ type = probe.type;
+ }
+ }
+ }
+
/* special philips features */
- if (sscanf(grab_cap.name, "Philips %d webcam", &type) > 0) {
+ if (IsPhilips) {
struct video_window vwin;
int shutter = -1;
int gain = -1;
@@ -340,6 +355,9 @@
if (ioctl(grab_fd, VIDIOCPWCSAWB, &wb) < 0)
perror("trying to set pwc white balance mode");
+
+ if (ioctl(grab_fd, VIDIOCPWCSBACKLIGHT, &pwc_backlight_mode) < 0)
+ perror("trying to set backlight compensation mode");
}
/* set image source and TV norm */
@@ -1460,6 +1478,8 @@
pwc_wb_red = i;
if (-1 != (i = cfg_get_int("grab", "pwc_wb_blue")))
pwc_wb_blue = i;
+ if (-1 != (i = cfg_get_int("grab", "pwc_backlight_mode")))
+ pwc_backlight_mode = i;
if (-1 != (i = cfg_get_int("grab", "flip_horizontal")))
flip_horizontal = 1;
if (-1 != (i = cfg_get_int("grab", "flip_vertical")))
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs