aboutsummaryrefslogtreecommitdiff
path: root/modules/image_io/pdp_v4l.c
diff options
context:
space:
mode:
authorTom Schouten <doelie@users.sourceforge.net>2006-09-01 13:45:31 +0000
committerTom Schouten <doelie@users.sourceforge.net>2006-09-01 13:45:31 +0000
commit7591a024f184bd385d35583d19d86c1d5f2531ba (patch)
tree77aa0c44ccb700eb9a2b16e1b246e3c8026c40ed /modules/image_io/pdp_v4l.c
parent91dd6b68f0f209ad015a303095bb1df018dca71e (diff)
pdp current darcs merge
svn path=/trunk/externals/pdp/; revision=5816
Diffstat (limited to 'modules/image_io/pdp_v4l.c')
-rw-r--r--modules/image_io/pdp_v4l.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/image_io/pdp_v4l.c b/modules/image_io/pdp_v4l.c
index 85c34f1..7f16842 100644
--- a/modules/image_io/pdp_v4l.c
+++ b/modules/image_io/pdp_v4l.c
@@ -184,6 +184,18 @@ static void pdp_v4l_close_error(t_pdp_v4l *x)
if(x->x_open_retry) x->x_open_retry--;
}
+static void pdp_v4l_pwc_agc(t_pdp_v4l *x, float gain){
+ gain *= (float)(1<<16);
+ int g = (int)gain;
+ if (g < 0) g = -1; // automatic
+ if (g > 1<<16) g = 1<<16 - 1; // fixed
+
+ //post("pdp_v4l: setting agc to %d", g);
+ if (ioctl(x->x_tvfd, VIDIOCPWCSAGC, &g)){
+ post("pdp_v4l: pwc: VIDIOCPWCSAGC");
+ //goto closit;
+ }
+}
static void pdp_v4l_pwc_init(t_pdp_v4l *x)
{
@@ -206,10 +218,21 @@ static void pdp_v4l_pwc_init(t_pdp_v4l *x)
post("pdp_v4l: detected pwc");
+
if(ioctl(x->x_tvfd, VIDIOCPWCRUSER)){
perror("pdp_v4l: pwc: VIDIOCPWCRUSER");
goto closit;
}
+
+ /* this is a workaround:
+ we disable AGC after restoring user prefs
+ something is wrong with newer cams (like Qickcam 4000 pro)
+ */
+
+ if (1){
+ pdp_v4l_pwc_agc(x, 1.0);
+ }
+
if (ioctl(x->x_tvfd, VIDIOCGWIN, &x->x_vwin)){
perror("pdp_v4l: pwc: VIDIOCGWIN");
@@ -824,6 +847,7 @@ void pdp_v4l_setup(void)
class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_dim, gensym("dim"), A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_freq, gensym("freq"), A_FLOAT, A_NULL);
class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_freqMHz, gensym("freqMHz"), A_FLOAT, A_NULL);
+ class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_pwc_agc, gensym("gain"), A_FLOAT, A_NULL);
class_addmethod(pdp_v4l_class, (t_method)pdp_v4l_format, gensym("captureformat"), A_SYMBOL, A_NULL);