diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-03-05 16:12:53 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-03-05 16:12:53 +0100 |
commit | 0483c86add2f496021560b82476d22e2497006be (patch) | |
tree | d0fbdd2f09760bf6719443cdceff6e53ee57ae1f /src/uca-camera.c | |
parent | 13acd5530fa2a6689b0a6a3ffa278d58c1428fe1 (diff) | |
download | libuca-0483c86add2f496021560b82476d22e2497006be.tar.gz libuca-0483c86add2f496021560b82476d22e2497006be.tar.bz2 libuca-0483c86add2f496021560b82476d22e2497006be.tar.xz libuca-0483c86add2f496021560b82476d22e2497006be.zip |
Complete async xfer infrastructure
Diffstat (limited to 'src/uca-camera.c')
-rw-r--r-- | src/uca-camera.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/uca-camera.c b/src/uca-camera.c index 88b6ddd..ac04b86 100644 --- a/src/uca-camera.c +++ b/src/uca-camera.c @@ -64,7 +64,16 @@ static GParamSpec *camera_properties[N_PROPERTIES] = { NULL, }; static void uca_camera_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + UcaCameraPrivate *priv = UCA_CAMERA_GET_PRIVATE(object); + + switch (property_id) { + case PROP_TRANSFER_ASYNCHRONOUSLY: + priv->transfer_async = g_value_get_boolean(value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); + } } static void uca_camera_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -76,6 +85,10 @@ static void uca_camera_get_property(GObject *object, guint property_id, GValue * g_value_set_boolean(value, priv->is_recording); break; + case PROP_TRANSFER_ASYNCHRONOUSLY: + g_value_set_boolean(value, priv->transfer_async); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } @@ -180,6 +193,8 @@ static void uca_camera_class_init(UcaCameraClass *klass) static void uca_camera_init(UcaCamera *camera) { + camera->grab_func = NULL; + camera->priv = UCA_CAMERA_GET_PRIVATE(camera); camera->priv->is_recording = FALSE; camera->priv->transfer_async = FALSE; @@ -230,6 +245,12 @@ void uca_camera_start_recording(UcaCamera *camera, GError **error) return; } + if (camera->priv->transfer_async && (camera->grab_func == NULL)) { + g_set_error(error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_NO_GRAB_FUNC, + "No grab callback function set"); + return; + } + GError *tmp_error = NULL; (*klass->start_recording)(camera, &tmp_error); @@ -280,9 +301,10 @@ void uca_camera_stop_recording(UcaCamera *camera, GError **error) * * Set the grab function that is called whenever a frame is readily transfered. */ -void uca_camera_set_grab_func(UcaCamera *camera, UcaCameraGrabFunc func) +void uca_camera_set_grab_func(UcaCamera *camera, UcaCameraGrabFunc func, gpointer user_data) { - /* TODO: implement */ + camera->grab_func = func; + camera->user_data = user_data; } void uca_camera_grab(UcaCamera *camera, gpointer data, GError **error) |