[aravis] viewer: disable frame rate entry if feature is not available.



commit 8fba30d5cecc4581dcbb89da24bbaea3e138474e
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Jun 19 15:22:37 2012 +0200

    viewer: disable frame rate entry if feature is not available.

 docs/reference/aravis/aravis-sections.txt |    1 +
 src/arvcamera.c                           |   20 ++++++++++++++++++++
 src/arvcamera.h                           |    2 ++
 viewer/arvviewer.c                        |    4 ++++
 4 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 157c5de..1de2eb1 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -26,6 +26,7 @@ arv_camera_start_acquisition
 arv_camera_stop_acquisition
 arv_camera_set_acquisition_mode
 arv_camera_get_acquisition_mode
+arv_camera_is_frame_rate_available
 arv_camera_set_frame_rate
 arv_camera_get_frame_rate
 arv_camera_set_trigger
diff --git a/src/arvcamera.c b/src/arvcamera.c
index beabb3b..ee25cb5 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -853,6 +853,26 @@ arv_camera_get_device (ArvCamera *camera)
 }
 
 /**
+ * arv_camera_is_frame_rate_available:
+ * @camera: a #ArvCamera
+ * Returns: TRUE if FrameRate feature is available
+ */
+
+gboolean
+arv_camera_is_frame_rate_available (ArvCamera *camera)
+{
+	g_return_val_if_fail (ARV_IS_CAMERA (camera), FALSE);
+
+	switch (camera->priv->vendor) {
+		case ARV_CAMERA_VENDOR_BASLER:
+		case ARV_CAMERA_VENDOR_PROSILICA:
+			return arv_device_get_feature (camera->priv->device, "AcquisitionFrameRateAbs") != NULL;
+		case ARV_CAMERA_VENDOR_UNKNOWN:
+		default:
+			return arv_device_get_feature (camera->priv->device, "AcquisitionFrameRate") != NULL;
+	}
+}
+/**
  * arv_camera_is_exposure_time_available:
  * @camera: a #ArvCamera
  * Returns: TRUE if Exposure Time feature is available.
diff --git a/src/arvcamera.h b/src/arvcamera.h
index 770ef2d..18b209a 100644
--- a/src/arvcamera.h
+++ b/src/arvcamera.h
@@ -84,6 +84,8 @@ void		arv_camera_stop_acquisition		(ArvCamera *camera);
 void			arv_camera_set_acquisition_mode 	(ArvCamera *camera, ArvAcquisitionMode value);
 ArvAcquisitionMode 	arv_camera_get_acquisition_mode 	(ArvCamera *camera);
 
+gboolean 	arv_camera_is_frame_rate_available 	(ArvCamera *camera);
+
 void		arv_camera_set_frame_rate		(ArvCamera *camera, double frame_rate);
 double 		arv_camera_get_frame_rate 		(ArvCamera *camera);
 void		arv_camera_set_trigger			(ArvCamera *camera, const char *source);
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index 2352df5..6df16ee 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -421,6 +421,7 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	double gain_min, gain_max;
 	gboolean auto_gain, auto_exposure;
 	const char *caps_string;
+	gboolean is_frame_rate_available;
 	gboolean is_exposure_available;
 	gboolean is_exposure_auto_available;
 	gboolean is_gain_available;
@@ -472,6 +473,7 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	auto_gain = arv_camera_get_gain_auto (viewer->camera) != ARV_AUTO_OFF;
 	auto_exposure = arv_camera_get_gain_auto (viewer->camera) != ARV_AUTO_OFF;
 
+	is_frame_rate_available = arv_camera_is_frame_rate_available (viewer->camera);
 	is_exposure_available = arv_camera_is_exposure_time_available (viewer->camera);
 	is_exposure_auto_available = arv_camera_is_exposure_auto_available (viewer->camera);
 	is_gain_available = arv_camera_is_gain_available (viewer->camera);
@@ -491,6 +493,8 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	gtk_range_set_range (GTK_RANGE (viewer->exposure_hscale), 0.0, 1.0);
 	gtk_range_set_range (GTK_RANGE (viewer->gain_hscale), gain_min, gain_max);
 
+	gtk_widget_set_sensitive (viewer->frame_rate_entry, is_frame_rate_available);
+
 	string = g_strdup_printf ("%g", frame_rate);
 	gtk_entry_set_text (GTK_ENTRY (viewer->frame_rate_entry), string);
 	g_free (string);



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