[Gridflow-cvs] [svn] commit: r3843 - in /trunk: abstractions/#camera.pd format/videodev.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Tue Jun 10 13:50:52 EDT 2008


Author: matju
Date: Tue Jun 10 13:50:51 2008
New Revision: 3843

Log:
added norm setting (PAL NTSC SECAM auto)

Modified:
    trunk/abstractions/#camera.pd
    trunk/format/videodev.c

Modified: trunk/abstractions/#camera.pd
==============================================================================
--- trunk/abstractions/#camera.pd (original)
+++ trunk/abstractions/#camera.pd Tue Jun 10 13:50:51 2008
@@ -1,5 +1,5 @@
 #N canvas 754 321 422 304 10;
-#X obj 82 6 cnv 15 184 56 empty empty empty 20 12 0 14 -233017 -66577
+#X obj 82 6 cnv 15 184 68 empty empty empty 20 12 0 14 -233017 -66577
 0;
 #X obj 144 9 hradio 12 1 0 4 \$0-s_channel \$0-channel _0_1_2_3 -2
 7 1 10 -233017 -195568 -195568 0;
@@ -68,16 +68,16 @@
 #X obj 540 221 s \$0-sizec;
 #X obj 531 243 s \$0-width;
 #X obj 521 263 s \$0-height;
+#X obj 331 265 route2 color;
+#X obj 331 246 r \$0-colorspace;
 #X obj 141 8 receives \$0-s_ channel tuner frequency brightness contrast
 colour hue whiteness white_mode white_red white_blue white_speed white_delay
 auto_gain framerate noise_reduction compression pwc size colorspace
-;
+norm;
 #X msg 134 116 list channel tuner frequency brightness contrast colour
 hue whiteness white_mode white_red white_blue white_speed white_delay
 auto_gain framerate noise_reduction compression pwc size colorspace
-;
-#X obj 331 265 route2 color;
-#X obj 331 246 r \$0-colorspace;
+norm;
 #X connect 1 0 34 0;
 #X connect 2 0 28 0;
 #X connect 3 0 51 0;
@@ -131,7 +131,7 @@
 #X connect 48 0 49 0;
 #X connect 51 0 59 0;
 #X connect 51 1 0 0;
-#X connect 51 2 65 0;
+#X connect 51 2 67 0;
 #X connect 51 3 58 0;
 #X connect 53 0 43 0;
 #X connect 54 0 24 0;
@@ -144,20 +144,20 @@
 #X connect 60 0 62 0;
 #X connect 60 0 63 0;
 #X connect 60 1 21 0;
-#X connect 64 0 45 0;
-#X connect 64 1 45 1;
-#X connect 65 0 47 0;
-#X connect 66 0 52 0;
-#X connect 66 1 42 0;
-#X connect 67 0 66 0;
+#X connect 64 0 52 0;
+#X connect 64 1 42 0;
+#X connect 65 0 64 0;
+#X connect 66 0 45 0;
+#X connect 66 1 45 1;
+#X connect 67 0 47 0;
 #X restore 34 345 pd camera;
 #X obj 7 364 outlet image;
 #X obj 7 307 inlet;
 #X obj 144 21 hradio 12 1 0 4 \$0-s_tuner \$0-tuner _0_1_2_3 -2 7 1
 10 -233017 -195568 -195568 0;
-#X obj 134 45 hsl 129 12 0 65635 0 0 \$0-s_frequency \$0-frequency
+#X obj 134 59 hsl 129 12 0 65635 0 0 \$0-s_frequency \$0-frequency
 frequency 4 7 1 10 -233017 -195568 -195568 0 1;
-#X obj 84 45 nbx 5 12 0 65535 0 0 \$0-s_frequency \$0-frequency empty
+#X obj 84 59 nbx 5 12 0 65535 0 0 \$0-s_frequency \$0-frequency empty
 4 7 1 10 -233017 -195568 -195568 0 256;
 #X obj 46 307 r \$0-o;
 #X text 85 10 channel:;
@@ -167,27 +167,27 @@
 #X text 9 7 device:;
 #X obj 11 25 vradio 15 1 0 10 \$0-s_device \$0-device empty 0 -6 0
 8 -241291 -1 -1 0;
-#X obj 82 67 cnv 15 184 172 empty empty empty 20 12 0 14 -233017 -66577
+#X obj 82 80 cnv 15 184 172 empty empty empty 20 12 0 14 -233017 -66577
 0;
-#X obj 134 81 hsl 129 12 0 65535 0 0 \$0-s_brightness \$0-brightness
+#X obj 134 94 hsl 129 12 0 65535 0 0 \$0-s_brightness \$0-brightness
 brightness 4 7 1 10 -62784 -44926 -1 3500 0;
-#X obj 134 105 hsl 129 12 0 65535 0 0 \$0-s_hue \$0-hue hue 4 7 1 10
+#X obj 134 118 hsl 129 12 0 65535 0 0 \$0-s_hue \$0-hue hue 4 7 1 10
 -62784 -44926 -1 12800 0;
-#X obj 134 69 hsl 129 12 0 65535 0 0 \$0-s_contrast \$0-contrast contrast
+#X obj 134 82 hsl 129 12 0 65535 0 0 \$0-s_contrast \$0-contrast contrast
 4 7 1 10 -62784 -44926 -1 12600 0;
-#X obj 134 117 hsl 129 12 0 65535 0 0 \$0-s_whiteness \$0-whiteness
+#X obj 134 130 hsl 129 12 0 65535 0 0 \$0-s_whiteness \$0-whiteness
 whiteness 4 7 1 10 -62784 -44926 -1 12400 0;
-#X obj 134 93 hsl 129 12 0 65535 0 0 \$0-s_colour \$0-colour colour
+#X obj 134 106 hsl 129 12 0 65535 0 0 \$0-s_colour \$0-colour colour
 4 7 1 10 -62784 -44926 -1 6400 0;
-#X obj 84 69 nbx 5 12 0 65535 0 0 \$0-s_contrast \$0-contrast empty
+#X obj 84 82 nbx 5 12 0 65535 0 0 \$0-s_contrast \$0-contrast empty
 4 7 1 10 -62784 -44926 -1 64512 256;
-#X obj 84 81 nbx 5 12 0 65535 0 0 \$0-s_brightness \$0-brightness empty
+#X obj 84 94 nbx 5 12 0 65535 0 0 \$0-s_brightness \$0-brightness empty
 4 7 1 10 -62784 -44926 -1 17920 256;
-#X obj 84 93 nbx 5 12 0 65535 0 0 \$0-s_colour \$0-colour empty 4 7
-1 10 -62784 -44926 -1 32768 256;
-#X obj 84 105 nbx 5 12 0 65535 0 0 \$0-s_hue \$0-hue empty 4 7 1 10
+#X obj 84 106 nbx 5 12 0 65535 0 0 \$0-s_colour \$0-colour empty 4
+7 1 10 -62784 -44926 -1 32768 256;
+#X obj 84 118 nbx 5 12 0 65535 0 0 \$0-s_hue \$0-hue empty 4 7 1 10
 -62784 -44926 -1 65535 256;
-#X obj 84 117 nbx 5 12 0 65535 0 0 \$0-s_whiteness \$0-whiteness empty
+#X obj 84 130 nbx 5 12 0 65535 0 0 \$0-s_whiteness \$0-whiteness empty
 4 7 1 10 -62784 -44926 -1 63488 256;
 #X obj 271 139 cnv 15 144 170 empty empty empty 20 12 0 14 -233017
 -66577 0;
@@ -222,28 +222,28 @@
 #X obj 341 117 bng 12 250 50 0 \$0-size7 \$0-sizec 288x352 16 6 1 10
 -233017 -195568 -195568;
 #X obj 357 36 nbx 5 14 -1e+37 1e+37 0 0 \$0-s_framerate \$0-framerate
-empty 0 -6 1 10 -62784 -44926 -1 0 256;
-#X obj 134 165 hsl 129 12 0 65535 0 0 \$0-s_white_blue \$0-white_blue
+empty 0 -6 1 10 -233017 -195568 -195568 10 256;
+#X obj 134 178 hsl 129 12 0 65535 0 0 \$0-s_white_blue \$0-white_blue
 white_blue 4 7 1 10 -233017 -195568 -195568 3050 0;
-#X obj 84 165 nbx 5 12 0 65535 0 0 \$0-s_white_blue \$0-white_blue
+#X obj 84 178 nbx 5 12 0 65535 0 0 \$0-s_white_blue \$0-white_blue
 empty 4 7 1 10 -233017 -195568 -195568 15616 256;
-#X obj 134 153 hsl 129 12 0 65535 0 0 \$0-s_white_red \$0-white_red
+#X obj 134 166 hsl 129 12 0 65535 0 0 \$0-s_white_red \$0-white_red
 white_red 4 7 1 10 -233017 -195568 -195568 2800 0;
-#X obj 84 153 nbx 5 12 0 65535 0 0 \$0-s_white_red \$0-white_red empty
+#X obj 84 166 nbx 5 12 0 65535 0 0 \$0-s_white_red \$0-white_red empty
 4 7 1 10 -233017 -195568 -195568 14336 256;
-#X obj 84 141 tgl 12 0 \$0-s_white_mode \$0-white_mode manual_white_balance
+#X obj 84 154 tgl 12 0 \$0-s_white_mode \$0-white_mode manual_white_balance
 20 7 1 10 -233017 -195568 -195568 1 1;
-#X obj 134 189 hsl 129 12 0 65535 0 0 \$0-s_white_delay \$0-white_delay
+#X obj 134 202 hsl 129 12 0 65535 0 0 \$0-s_white_delay \$0-white_delay
 white_delay 4 7 1 10 -233017 -195568 -195568 5000 0;
-#X obj 84 189 nbx 5 12 0 65535 0 0 \$0-s_white_delay \$0-white_delay
+#X obj 84 202 nbx 5 12 0 65535 0 0 \$0-s_white_delay \$0-white_delay
 empty 4 7 1 10 -233017 -195568 -195568 25600 256;
-#X obj 134 177 hsl 129 12 0 65535 0 0 \$0-s_white_speed \$0-white_speed
+#X obj 134 190 hsl 129 12 0 65535 0 0 \$0-s_white_speed \$0-white_speed
 white_speed 4 7 1 10 -233017 -195568 -195568 10319 0;
-#X obj 84 177 nbx 5 12 0 65535 0 0 \$0-s_white_speed \$0-white_speed
+#X obj 84 190 nbx 5 12 0 65535 0 0 \$0-s_white_speed \$0-white_speed
 empty 4 7 1 10 -233017 -195568 -195568 52832 256;
-#X obj 134 201 hsl 129 12 0 65535 0 0 \$0-s_auto_gain \$0-auto_gain
+#X obj 134 214 hsl 129 12 0 65535 0 0 \$0-s_auto_gain \$0-auto_gain
 auto_gain 4 7 1 10 -233017 -195568 -195568 0 0;
-#X obj 84 201 nbx 5 12 0 65535 0 0 \$0-s_auto_gain \$0-auto_gain empty
+#X obj 84 214 nbx 5 12 0 65535 0 0 \$0-s_auto_gain \$0-auto_gain empty
 4 7 1 10 -233017 -195568 -195568 0 256;
 #X text 29 160 *OFF*;
 #X text 30 24 #0;
@@ -255,10 +255,10 @@
 #X text 30 114 #6;
 #X text 30 129 #7;
 #X text 314 51 presets:;
-#X text 91 129 ------- PWC ONLY: -------;
-#X obj 84 213 hradio 12 1 0 4 \$0-s_noise_reduction \$0-noise_reduction
+#X text 91 142 ------- PWC ONLY: -------;
+#X obj 84 226 hradio 12 1 0 4 \$0-s_noise_reduction \$0-noise_reduction
 _0_1_2_3_noise_reduction -2 7 1 10 -233017 -195568 -195568 3;
-#X obj 84 225 hradio 12 1 0 4 \$0-s_compression \$0-compression _0_1_2_3_compression
+#X obj 84 238 hradio 12 1 0 4 \$0-s_compression \$0-compression _0_1_2_3_compression
 -2 7 1 10 -233017 -195568 -195568 3;
 #X obj 11 181 tgl 12 0 \$0-s_pwc \$0-pwc empty 20 7 1 10 -62784 -44926
 -1 0 1;
@@ -283,6 +283,12 @@
 #X restore 7 326 pd command_filtre;
 #X obj 7 345 #in;
 #X text 272 36 framerate:;
+#X obj 202 9 vradio 12 1 0 4 \$0-s_norm \$0-norm empty 0 -8 0 10 -233017
+-195568 -195568 0;
+#X text 215 8 PAL;
+#X text 215 20 NTSC;
+#X text 214 32 SECAM;
+#X text 214 43 auto;
 #X connect 2 0 80 0;
 #X connect 4 0 79 0;
 #X connect 8 0 80 0;

Modified: trunk/format/videodev.c
==============================================================================
--- trunk/format/videodev.c (original)
+++ trunk/format/videodev.c Tue Jun 10 13:50:51 2008
@@ -233,7 +233,7 @@
 	bool use_mmap, use_pwc;
 	P<BitPacking> bit_packing;
 	P<Dim> dim;
-	bool has_frequency, has_tuner;
+	bool has_frequency, has_tuner, has_norm;
 	int fd;
 	int palettes; /* bitfield */
 
@@ -241,6 +241,7 @@
 		queuesize=0; queuemax=2; next_frame=0; use_mmap=true; use_pwc=false; bit_packing=0; dim=0;
 		has_frequency=false;
 		has_tuner=false;
+		has_norm=false;
 		image=0;
 		f = fopen(filename.data(),"r+");
 		if (!f) RAISE("can't open device '%s': %s",filename.data(),strerror(errno));
@@ -260,7 +261,7 @@
 
 	\attr int channel();
 	\attr int tuner();
-	\decl 0 norm (int value);
+	\attr int norm();
 	\decl 0 size (int sy, int sx);
 	\decl 0 transfer (string sym, int queuemax=2);
 
@@ -300,10 +301,11 @@
 	// this is abnormal for a get-function
 	if (s==gensym("frequency") && !has_frequency  ) return;
 	if (s==gensym("tuner")     && !has_tuner      ) return;
+	if (s==gensym("norm")      && !has_norm       ) return;
 	if (s==gensym("channel")   && vcaps.channels<2) return;
-	if (!use_pwc && (s==gensym("white_mode") || s==gensym("white_red") || s==gensym("white_blue") ||
-		s==gensym("white_speed") || s==gensym("white_delay") || s==gensym("auto_gain") ||
-		s==gensym("noise_reduction") || s==gensym("compression") || s==gensym("framerate"))) return;
+	if (!use_pwc && (s==gensym("white_mode")      || s==gensym("white_red")   || s==gensym("white_blue") ||
+			 s==gensym("white_speed")     || s==gensym("white_delay") || s==gensym("auto_gain")  ||
+			 s==gensym("noise_reduction") || s==gensym("compression") || s==gensym("framerate"))) return;
 	FObject::_0_get(argc,argv,s);
 }
 
@@ -528,6 +530,13 @@
 	}
 }
 
+\def int norm () {
+	VideoTuner vtuner;
+	vtuner.tuner = current_tuner;
+	if (0> IOCTL(fd, VIDIOCGTUNER, &vtuner)) {post("no tuner #%d", current_tuner); return -1;}
+	return vtuner.mode;
+}
+
 \def 0 tuner (int value) {
 	VideoTuner vtuner;
 	vtuner.tuner = current_tuner = value;
@@ -535,6 +544,7 @@
 	vtuner.mode = VIDEO_MODE_NTSC; //???
 	gfpost(&vtuner);
 	WIOCTL(fd, VIDIOCSTUNER, &vtuner);
+	has_norm = (vtuner.mode<=3);
 	int meuh;
 	has_frequency = (ioctl(fd, VIDIOCGFREQ, &meuh)>=0);
 }



More information about the Gridflow-cvs mailing list