[Gridflow-cvs] [svn] commit: r3872 - /trunk/format/dc1394.c

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Thu Jun 12 12:46:02 EDT 2008


Author: matju
Date: Thu Jun 12 12:46:01 2008
New Revision: 3872

Log:
attempting to use format 7

Modified:
    trunk/format/dc1394.c

Modified: trunk/format/dc1394.c
==============================================================================
--- trunk/format/dc1394.c (original)
+++ trunk/format/dc1394.c Thu Jun 12 12:46:01 2008
@@ -149,6 +149,8 @@
 	int useport;
 	int usenode;
 	int framerate_e;
+	int height;
+	int width;
 	dc1394_cameracapture camera;
 	\constructor (t_symbol *mode) {
 		bool gotone=false;
@@ -174,6 +176,8 @@
 		if (!gotone) RAISE("no cameras available");
 		this->rh = dc1394_create_handle(useport);
 		framerate_e = FRAMERATE_30;
+		height = 480;
+		width = 640;
 		setup();
 	}
 	\decl 0 bang ();
@@ -184,7 +188,25 @@
 	//\attr uint16 contrast();
 	//\attr uint16 whiteness();
 	void setup ();
+	\decl 0 get (t_symbol *s=0);
+	\decl 0 size (int height, int width);
 };
+
+\def 0 get (t_symbol *s=0) {
+	FObject::_0_get(argc,argv,s);
+	t_atom a[2];
+	if (!s) {
+		SETFLOAT(a+0,camera.frame_height);
+		SETFLOAT(a+1,camera.frame_width);
+		outlet_anything(bself->outlets[0],gensym("size"),2,a); // abnormal (does not use nested list)
+	}
+}
+\def 0 size (int height, int width) {
+	//dc1394_set_format7_image_size(rh,usenode,0,width,height);
+	this->height = height;
+	this->width = width;
+	setup();
+}
 
 \def unsigned brightness () {unsigned value;  dc1394_get_brightness(rh,usenode,&value); return value;}
 \def 0        brightness    (unsigned value) {dc1394_set_brightness(rh,usenode, value);}
@@ -192,11 +214,12 @@
 \def 0        hue           (unsigned value) {dc1394_set_hue(       rh,usenode, value);}
 \def unsigned colour     () {unsigned value;  dc1394_get_saturation(rh,usenode,&value); return value;}
 \def 0        colour        (unsigned value) {dc1394_set_saturation(rh,usenode, value);}
-
-
+  
 void FormatDC1394::setup () {
-	if (dc1394_setup_capture(rh,usenode,0,FORMAT_VGA_NONCOMPRESSED,MODE_640x480_MONO,SPEED_400,framerate_e,&camera)!=DC1394_SUCCESS)
-		RAISE("dc1394_setup_capture error");
+//	if (dc1394_setup_capture(rh,usenode,0,FORMAT_VGA_NONCOMPRESSED,MODE_640x480_MONO,SPEED_400,framerate_e,&camera)!=DC1394_SUCCESS)
+//		RAISE("dc1394_setup_capture error");
+	if (dc1394_setup_format7_capture(rh,usenode,0,MODE_FORMAT7_0,SPEED_400,USE_MAX_AVAIL,0,0,width,height,&camera)!=DC1394_SUCCESS)
+		RAISE("dc1394_setup_format7_capture error");
         if (dc1394_set_trigger_mode(rh,usenode,TRIGGER_MODE_0) != DC1394_SUCCESS) RAISE("dc1394_set_trigger_mode error");
  	if (dc1394_start_iso_transmission(rh,usenode)!=DC1394_SUCCESS) RAISE("dc1394_start_iso_transmission error");
 }
@@ -215,8 +238,12 @@
 	//if (dc1394_get_one_shot(rh,usenode,&is_on)!=DC1394_SUCCESS) RAISE("dc1394_get_one_shot error");
 	if (dc1394_single_capture(rh,&camera)!=DC1394_SUCCESS) RAISE("dc1394_single_capture error");
 	//if (dc1394_stop_iso_transmission(rh,usenode)!=DC1394_SUCCESS) RAISE("dc1394_stop_iso_transmission error");
-	out=new GridOutlet(this,0,new Dim(480,640,1));
+	out=new GridOutlet(this,0,new Dim(height,width,1));
 	out->send(out->dim->prod(),(uint8 *)camera.capture_buffer);
+	post("frame_height=%d",camera.frame_height);
+	post("frame_width=%d" ,camera.frame_width);
+	post("quadlets_per_frame=%d" ,camera.quadlets_per_frame);
+	post("quadlets_per_packet=%d" ,camera.quadlets_per_packet);
 }
 
 \end class FormatDC1394 {install_format("#io.dc1394",4,"");}



More information about the Gridflow-cvs mailing list