diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-03-20 10:03:52 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2013-03-20 10:03:52 +0100 |
commit | ff7f3216fe76e0a4598bdf737671a5e25a780ded (patch) | |
tree | 611970247e33c4af6b1a2a6345bb39b3cb05295e /plugins/pco/uca-pco-camera.c | |
parent | 71acacfd31e36fcb314d0d75306d26f9518e1d6a (diff) | |
download | uca-ff7f3216fe76e0a4598bdf737671a5e25a780ded.tar.gz uca-ff7f3216fe76e0a4598bdf737671a5e25a780ded.tar.bz2 uca-ff7f3216fe76e0a4598bdf737671a5e25a780ded.tar.xz uca-ff7f3216fe76e0a4598bdf737671a5e25a780ded.zip |
uca_camera_grab takes a gpointer and returns bool
Diffstat (limited to 'plugins/pco/uca-pco-camera.c')
-rw-r--r-- | plugins/pco/uca-pco-camera.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/plugins/pco/uca-pco-camera.c b/plugins/pco/uca-pco-camera.c index de68001..4a0cce6 100644 --- a/plugins/pco/uca-pco-camera.c +++ b/plugins/pco/uca-pco-camera.c @@ -565,12 +565,12 @@ uca_pco_camera_trigger(UcaCamera *camera, GError **error) "Could not trigger frame acquisition"); } -static void -uca_pco_camera_grab(UcaCamera *camera, gpointer *data, GError **error) +static gboolean +uca_pco_camera_grab(UcaCamera *camera, gpointer data, GError **error) { static const gint MAX_TIMEOUT = 5; - g_return_if_fail(UCA_IS_PCO_CAMERA(camera)); + g_return_val_if_fail (UCA_IS_PCO_CAMERA(camera), FALSE); UcaPcoCameraPrivate *priv = UCA_PCO_CAMERA_GET_PRIVATE(camera); gboolean is_readout = FALSE; @@ -580,7 +580,7 @@ uca_pco_camera_grab(UcaCamera *camera, gpointer *data, GError **error) if (priv->current_image == priv->num_recorded_images) { g_set_error (error, UCA_CAMERA_ERROR, UCA_CAMERA_ERROR_END_OF_STREAM, "End of data stream"); - return; + return FALSE; } /* @@ -595,19 +595,20 @@ uca_pco_camera_grab(UcaCamera *camera, gpointer *data, GError **error) priv->last_frame = Fg_getLastPicNumberBlockingEx(priv->fg, priv->last_frame + 1, priv->fg_port, MAX_TIMEOUT, priv->fg_mem); if (priv->last_frame <= 0) { - guint err = FG_OK + 1; - FG_SET_ERROR(err, priv->fg, UCA_PCO_CAMERA_ERROR_FG_GENERAL); + g_set_error (error, UCA_PCO_CAMERA_ERROR, + UCA_PCO_CAMERA_ERROR_FG_GENERAL, + "%s", Fg_getLastErrorDescription(priv->fg)); + return FALSE; } guint16 *frame = Fg_getImagePtrEx(priv->fg, priv->last_frame, priv->fg_port, priv->fg_mem); - if (*data == NULL) - *data = g_malloc0(priv->frame_width * priv->frame_height * priv->num_bytes); - if (priv->description->type == CAMERATYPE_PCO_EDGE) - pco_get_reorder_func(priv->pco)((guint16 *) *data, frame, priv->frame_width, priv->frame_height); + pco_get_reorder_func(priv->pco)((guint16 *) data, frame, priv->frame_width, priv->frame_height); else - memcpy((gchar *) *data, (gchar *) frame, priv->frame_width * priv->frame_height * priv->num_bytes); + memcpy((gchar *) data, (gchar *) frame, priv->frame_width * priv->frame_height * priv->num_bytes); + + return TRUE; } static void |