[aravis] camera: quirk based implementation of frame rate get/set.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] camera: quirk based implementation of frame rate get/set.
- Date: Mon, 17 May 2010 13:00:05 +0000 (UTC)
commit c0e332872464e66c66bb4d0a5f1f76053bace996
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Mon May 17 14:58:59 2010 +0200
camera: quirk based implementation of frame rate get/set.
src/arvcamera.c | 39 +++++++++++++++++++++++++++++++++++++--
src/arvcamera.h | 6 ++++++
2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index b42c3c2..d0f5b72 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -36,6 +36,8 @@ static GObjectClass *parent_class = NULL;
struct _ArvCameraPrivate {
ArvDevice *device;
ArvGc *genicam;
+
+ ArvCameraVendor vendor;
};
ArvStream *
@@ -192,7 +194,20 @@ arv_camera_set_acquisition_frame_rate (ArvCamera *camera, double frame_rate)
{
g_return_if_fail (ARV_IS_CAMERA (camera));
- arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRate", frame_rate);
+ switch (camera->priv->vendor) {
+ case ARV_CAMERA_VENDOR_BASLER:
+ /* Fixme: use Raw and Base for access to the full frame rate range. */
+ arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRateAbs",
+ frame_rate);
+ break;
+ case ARV_CAMERA_VENDOR_PROSILICA:
+ arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRateAbs",
+ frame_rate);
+ break;
+ case ARV_CAMERA_VENDOR_UNKNOWN:
+ arv_device_set_float_feature_value (camera->priv->device, "AcquisitionFrameRate", frame_rate);
+ break;
+ }
}
double
@@ -200,7 +215,15 @@ arv_camera_get_acquisition_frame_rate (ArvCamera *camera)
{
g_return_val_if_fail (ARV_IS_CAMERA (camera), 0.0);
- return arv_device_get_integer_feature_value (camera->priv->device, "AcquisitionFrameRate");
+ switch (camera->priv->vendor) {
+ case ARV_CAMERA_VENDOR_BASLER:
+ return arv_device_get_integer_feature_value (camera->priv->device, "AcquisitionFrameRateAbs");
+ case ARV_CAMERA_VENDOR_PROSILICA:
+ return arv_device_get_integer_feature_value (camera->priv->device, "AcquisitionFrameRateAbs");
+ case ARV_CAMERA_VENDOR_UNKNOWN:
+ default:
+ return arv_device_get_integer_feature_value (camera->priv->device, "AcquisitionFrameRate");
+ }
}
void
@@ -308,6 +331,8 @@ arv_camera_new (const char *name)
{
ArvCamera *camera;
ArvDevice *device;
+ ArvCameraVendor vendor;
+ const char *vendor_name;
device = arv_new_device (name);
@@ -318,6 +343,16 @@ arv_camera_new (const char *name)
camera->priv->device = device;
camera->priv->genicam = arv_device_get_genicam (device);
+ vendor_name = arv_camera_get_vendor_name (camera);
+ if (g_strcmp0 (vendor_name, "Basler") == 0)
+ vendor = ARV_CAMERA_VENDOR_BASLER;
+ else if (g_strcmp0 (vendor_name, "Prosilica") == 0)
+ vendor = ARV_CAMERA_VENDOR_PROSILICA;
+ else
+ vendor = ARV_CAMERA_VENDOR_UNKNOWN;
+
+ camera->priv->vendor = vendor;
+
return camera;
}
diff --git a/src/arvcamera.h b/src/arvcamera.h
index 9fc8258..057e8b8 100644
--- a/src/arvcamera.h
+++ b/src/arvcamera.h
@@ -28,6 +28,12 @@
G_BEGIN_DECLS
+typedef enum {
+ ARV_CAMERA_VENDOR_UNKNOWN,
+ ARV_CAMERA_VENDOR_BASLER,
+ ARV_CAMERA_VENDOR_PROSILICA
+} ArvCameraVendor;
+
#define ARV_TYPE_CAMERA (arv_camera_get_type ())
#define ARV_CAMERA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_CAMERA, ArvCamera))
#define ARV_CAMERA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_CAMERA, ArvCameraClass))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]