[aravis] fake: add AcquisitionFrameRate feature.



commit 7993718e994298c002ca22ee776635b4002cb6ef
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Mon May 17 15:17:58 2010 +0200

    fake: add AcquisitionFrameRate feature.
    
    Fix the wait_for_next_frame function by using frame_period instead
    of exposure time.

 src/arv-fake-camera.xml |   16 ++++++++++++++++
 src/arvfakecamera.c     |    5 ++++-
 src/arvfakecamera.h     |    5 ++++-
 src/tests/fake.c        |    7 +++++--
 4 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/arv-fake-camera.xml b/src/arv-fake-camera.xml
index 47a2b59..ff4b461 100644
--- a/src/arv-fake-camera.xml
+++ b/src/arv-fake-camera.xml
@@ -285,6 +285,22 @@
 		<Endianess>LittleEndian</Endianess>
 	</IntReg>
 
+	<Converter Name="AcquisitionFrameRate" NameSpace="Standard">
+		<Description>Frame rate, in frames per second.</Description>
+		<FormulaTo>(1000000 / FROM)</FormulaTo>
+		<FormulaFrom>(1000000 / TO)</FormulaFrom>
+		<pValue>AcquisitionFramePeriodRegister</pValue>
+	</Converter>
+
+	<IntReg Name="AcquisitionFramePeriodRegister" NameSpace="Custom">
+		<Address>0x138</Address>
+		<Length>4</Length>
+		<AccessMode>RW</AccessMode>
+		<pPort>Device</pPort>
+		<Sign>Unsigned</Sign>
+		<Endianess>LittleEndian</Endianess>
+	</IntReg>
+
 	<Enumeration Name="TriggerSelector" NameSpace="Standard">
 		<EnumEntry Name="FrameStart" NameSpace="Standard">
 			<Value>0</Value>
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index f658518..6dbd5ac 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -116,7 +116,8 @@ arv_fake_camera_wait_for_next_frame (ArvFakeCamera *camera)
 	if (_get_register (camera, ARV_FAKE_CAMERA_REGISTER_TRIGGER_MODE) == 1)
 		frame_period_time_ns = 1000000000L / camera->priv->trigger_frequency;
 	else
-		frame_period_time_ns = (guint64) _get_register (camera, ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US) *
+		frame_period_time_ns = (guint64) _get_register (camera,
+								ARV_FAKE_CAMERA_REGISTER_ACQUISITION_FRAME_PERIOD_US) *
 			1000L;
 
 	clock_gettime (CLOCK_MONOTONIC, &time);
@@ -271,6 +272,8 @@ arv_fake_camera_new (const char *serial_number)
 
 	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_ACQUISITION, 0);
 	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_ACQUISITION_MODE, 1);
+	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_ACQUISITION_FRAME_PERIOD_US,
+					1000000.0 / ARV_FAKE_CAMERA_ACQUISITION_FRAME_RATE_DEFAULT);
 	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US,
 					ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT);
 
diff --git a/src/arvfakecamera.h b/src/arvfakecamera.h
index d0a65a9..919a460 100644
--- a/src/arvfakecamera.h
+++ b/src/arvfakecamera.h
@@ -55,6 +55,8 @@ G_BEGIN_DECLS
 
 #define ARV_FAKE_CAMERA_REGISTER_ACQUISITION_MODE	0x12c
 
+#define ARV_FAKE_CAMERA_REGISTER_ACQUISITION_FRAME_PERIOD_US	0x138
+
 #define ARV_FAKE_CAMERA_REGISTER_FRAME_START_OFFSET		0x000
 #define ARV_FAKE_CAMERA_REGISTER_ACQUISITION_START_OFFSET	0x020
 
@@ -65,7 +67,8 @@ G_BEGIN_DECLS
 #define ARV_FAKE_CAMERA_REGISTER_ACQUISITION		0x124
 #define ARV_FAKE_CAMERA_REGISTER_EXPOSURE_TIME_US	0x120
 
-#define ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT	20000.0
+#define ARV_FAKE_CAMERA_ACQUISITION_FRAME_RATE_DEFAULT	25.0
+#define ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT	10000.0
 
 /* Analog control */
 
diff --git a/src/tests/fake.c b/src/tests/fake.c
index 4df6878..c6b3855 100644
--- a/src/tests/fake.c
+++ b/src/tests/fake.c
@@ -82,11 +82,14 @@ fake_device_test (void)
 	g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_BINNING_HORIZONTAL_DEFAULT);
 	int_value = arv_device_get_integer_feature_value (device, "BinningVertical");
 	g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_BINNING_VERTICAL_DEFAULT);
-	dbl_value = arv_device_get_float_feature_value (device,  "ExposureTimeAbs");
-	g_assert_cmpfloat (dbl_value, ==, ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT);
 	int_value = arv_device_get_integer_feature_value (device, "PixelFormat");
 	g_assert_cmpint (int_value, ==, ARV_FAKE_CAMERA_PIXEL_FORMAT_DEFAULT);
 
+	dbl_value = arv_device_get_float_feature_value (device, "AcquisitionFrameRate");
+	g_assert_cmpfloat (dbl_value, ==, ARV_FAKE_CAMERA_ACQUISITION_FRAME_RATE_DEFAULT);
+	dbl_value = arv_device_get_float_feature_value (device,  "ExposureTimeAbs");
+	g_assert_cmpfloat (dbl_value, ==, ARV_FAKE_CAMERA_EXPOSURE_TIME_US_DEFAULT);
+
 	int_value = arv_device_get_integer_feature_value (device, "GainRaw");
 	g_assert_cmpint (int_value, ==, 0);
 	int_value = arv_device_get_integer_feature_value (device, "GainAuto");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]