summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2014-07-29 18:40:33 +0200
committerTimo Dritschler <timo.dritschler@kit.edu>2014-07-29 18:40:33 +0200
commit7a00d434ea5d020a58ad3d9f76c3169faa99404a (patch)
treeae79cf2cbd258229f508301d1f53c9612da92339
parent3aa569acc828050133e20a93308fdb8904f0bf7f (diff)
downloaduca-7a00d434ea5d020a58ad3d9f76c3169faa99404a.tar.gz
uca-7a00d434ea5d020a58ad3d9f76c3169faa99404a.tar.bz2
uca-7a00d434ea5d020a58ad3d9f76c3169faa99404a.tar.xz
uca-7a00d434ea5d020a58ad3d9f76c3169faa99404a.zip
Added proper handling for 'frames-per-second' property to uca-camera base class
-rw-r--r--src/uca-camera.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c
index e1d218c..cbc0e90 100644
--- a/src/uca-camera.c
+++ b/src/uca-camera.c
@@ -156,8 +156,14 @@ uca_camera_set_property (GObject *object, guint property_id, const GValue *value
case PROP_FRAMES_PER_SECOND:
{
gdouble frames_per_second;
-
frames_per_second = g_value_get_double (value);
+
+ gfloat max_framerate;
+ g_object_get (object, "sensor-max-frame-rate", &max_framerate, NULL);
+
+ if (max_framerate < frames_per_second)
+ frames_per_second = max_framerate;
+
g_object_set (object, "exposure-time", 1. / frames_per_second, NULL);
}
break;
@@ -206,7 +212,16 @@ uca_camera_get_property(GObject *object, guint property_id, GValue *value, GPara
gdouble exposure_time;
g_object_get (object, "exposure-time", &exposure_time, NULL);
- g_value_set_double (value, 1. / exposure_time);
+ if (exposure_time > 0)
+ {
+ g_value_set_double (value, 1. / exposure_time);
+ }
+ else
+ {
+ gfloat max_framerate;
+ g_object_get (object, "sensor-max-frame-rate", &max_framerate, NULL);
+ g_value_set_double (value, max_framerate);
+ }
}
break;
@@ -453,7 +468,7 @@ uca_camera_class_init (UcaCameraClass *klass)
g_param_spec_double(uca_camera_props[PROP_FRAMES_PER_SECOND],
"Frames per second",
"Frames per second",
- 0.0, G_MAXDOUBLE, 1.0,
+ G_MINDOUBLE, G_MAXDOUBLE, 1.0,
G_PARAM_READWRITE);
camera_properties[PROP_HAS_STREAMING] =