summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cameras/uca-pco-camera.c19
-rw-r--r--test/grab.c7
2 files changed, 22 insertions, 4 deletions
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c
index 953bef3..bba69c2 100644
--- a/src/cameras/uca-pco-camera.c
+++ b/src/cameras/uca-pco-camera.c
@@ -681,7 +681,24 @@ static void uca_pco_camera_set_property(GObject *object, guint property_id, cons
break;
case PROP_SENSOR_PIXELRATE:
- pco_set_pixelrate(priv->pco, g_value_get_uint(value));
+ {
+ guint desired_pixel_rate = g_value_get_uint(value);
+ guint32 pixel_rate = 0;
+
+ for (guint i = 0; i < priv->pixelrates->n_values; i++) {
+ if (g_value_get_uint(g_value_array_get_nth(priv->pixelrates, i)) == desired_pixel_rate) {
+ pixel_rate = desired_pixel_rate;
+ break;
+ }
+ }
+
+ if (pixel_rate != 0) {
+ if (pco_set_pixelrate(priv->pco, pixel_rate) != PCO_NOERROR)
+ g_warning("Cannot set pixel rate");
+ }
+ else
+ g_warning("%i Hz is not possible. Please check the \"sensor-pixelrates\" property", desired_pixel_rate);
+ }
break;
case PROP_DOUBLE_IMAGE_MODE:
diff --git a/test/grab.c b/test/grab.c
index b23420c..5e163b9 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -38,7 +38,7 @@ int main(int argc, char *argv[])
{
GError *error = NULL;
(void) signal(SIGINT, sigint_handler);
- guint sensor_width, sensor_height, roi_width, roi_height, roi_x, roi_y, bits;
+ guint sensor_width, sensor_height, roi_width, roi_height, roi_x, roi_y, bits, sensor_rate;
g_type_init();
camera = uca_camera_new("pco", &error);
@@ -65,10 +65,11 @@ int main(int argc, char *argv[])
"roi-x", &roi_x,
"roi-y", &roi_y,
"sensor-bitdepth", &bits,
+ "sensor-pixelrate", &sensor_rate,
NULL);
- g_print("Sensor: %ix%i px, ROI %ix%i @ (%i, %i)\n",
- sensor_width, sensor_height, roi_width, roi_height, roi_x, roi_y);
+ g_print("Sensor: %ix%i px, ROI %ix%i @ (%i, %i) and %i Hz\n",
+ sensor_width, sensor_height, roi_width, roi_height, roi_x, roi_y, sensor_rate);
const int pixel_size = bits == 8 ? 1 : 2;
gpointer buffer = g_malloc0(roi_width * roi_height * pixel_size);