diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-01 09:58:23 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-01 09:58:23 +0200 |
commit | 5d04be2bb442fb9e52bdc1ea490c498cf8667a24 (patch) | |
tree | 3c03ba827f106db287e776385d2272e607ca35d6 /src/cameras/uca-pco-camera.c | |
parent | acef0fad9a74a133b65c0754082a8cf875387699 (diff) | |
download | uca-5d04be2bb442fb9e52bdc1ea490c498cf8667a24.tar.gz uca-5d04be2bb442fb9e52bdc1ea490c498cf8667a24.tar.bz2 uca-5d04be2bb442fb9e52bdc1ea490c498cf8667a24.tar.xz uca-5d04be2bb442fb9e52bdc1ea490c498cf8667a24.zip |
Allow only possible pixel rates when setting
Diffstat (limited to 'src/cameras/uca-pco-camera.c')
-rw-r--r-- | src/cameras/uca-pco-camera.c | 19 |
1 files changed, 18 insertions, 1 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: |