diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-03-18 10:56:03 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-03-18 10:57:06 +0100 |
commit | 55e168dc445de34e23c6935c32c99473cf312983 (patch) | |
tree | 4f98114e7b3c44f16bf29cd8c7ed5d1356755266 /plugins/ufo | |
parent | 7c5017db105a74af7c622d3529ac9c2c203f99d7 (diff) | |
download | uca-55e168dc445de34e23c6935c32c99473cf312983.tar.gz uca-55e168dc445de34e23c6935c32c99473cf312983.tar.bz2 uca-55e168dc445de34e23c6935c32c99473cf312983.tar.xz uca-55e168dc445de34e23c6935c32c99473cf312983.zip |
Spawn a thread because pcilib_stream blocks
Diffstat (limited to 'plugins/ufo')
-rw-r--r-- | plugins/ufo/uca-ufo-camera.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/plugins/ufo/uca-ufo-camera.c b/plugins/ufo/uca-ufo-camera.c index d7dfb4e..f68614e 100644 --- a/plugins/ufo/uca-ufo-camera.c +++ b/plugins/ufo/uca-ufo-camera.c @@ -132,7 +132,8 @@ read_register_value (pcilib_t *handle, const gchar *name) return (guint) reg_value; } -static int event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *user) +static int +event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *user) { UcaCamera *camera = UCA_CAMERA(user); UcaUfoCameraPrivate *priv = UCA_UFO_CAMERA_GET_PRIVATE(camera); @@ -145,9 +146,9 @@ static int event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, return PCILIB_STREAMING_CONTINUE; } - camera->grab_func(buffer, camera->user_data); - pcilib_return_data(priv->handle, event_id, PCILIB_EVENT_DATA, buffer); - pcilib_trigger(priv->handle, PCILIB_EVENT0, 0, NULL); + camera->grab_func (buffer, camera->user_data); + pcilib_return_data (priv->handle, event_id, PCILIB_EVENT_DATA, buffer); + pcilib_trigger (priv->handle, PCILIB_EVENT0, 0, NULL); return PCILIB_STREAMING_CONTINUE; } @@ -241,6 +242,17 @@ setup_pcilib (UcaUfoCameraPrivate *priv) return TRUE; } +static gpointer +stream_async (UcaCamera *camera) +{ + UcaUfoCameraPrivate *priv; + + priv = UCA_UFO_CAMERA_GET_PRIVATE (camera); + pcilib_trigger(priv->handle, PCILIB_EVENT0, 0, NULL); + pcilib_stream(priv->handle, &event_callback, camera); + return NULL; +} + static void uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) { @@ -264,8 +276,7 @@ uca_ufo_camera_start_recording(UcaCamera *camera, GError **error) priv->timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000); if (transfer_async) { - pcilib_trigger(priv->handle, PCILIB_EVENT0, 0, NULL); - pcilib_stream(priv->handle, &event_callback, camera); + g_thread_create ((GThreadFunc) stream_async, camera, FALSE, error); } } |