summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/grabbers/me4.c5
-rw-r--r--src/uca.c3
-rw-r--r--src/uca.h1
-rw-r--r--test/grab-async.c6
-rw-r--r--test/grab.c2
5 files changed, 12 insertions, 5 deletions
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index 48d0756..a157206 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -215,8 +215,10 @@ static uint32_t uca_me4_grab(struct uca_grabber_priv *grabber, void **buffer, ui
else
last_frame = Fg_getLastPicNumberEx(me4->fg, PORT_A, me4->mem);
- if (last_frame <= 0)
+ if (last_frame <= 0) {
+ *buffer = NULL;
return UCA_ERR_GRABBER | UCA_ERR_FRAME_TRANSFER;
+ }
*frame_number = (uint64_t) last_frame;
*buffer = Fg_getImagePtrEx(me4->fg, last_frame, PORT_A, me4->mem);
@@ -274,6 +276,7 @@ uint32_t uca_me4_init(struct uca_grabber_priv **grabber)
Fg_getParameter(fg, FG_TIMEOUT, &me4->timeout, PORT_A);
+ me4->timeout = 1;
uca->user = me4;
uca->destroy = &uca_me4_destroy;
uca->set_property = &uca_me4_set_property;
diff --git a/src/uca.c b/src/uca.c
index 191092c..59155cc 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -327,7 +327,7 @@ uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback
uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
struct uca_camera_priv *priv = cam->priv;
- if (priv->state != UCA_CAM_RECORDING)
+ if ((priv->state != UCA_CAM_RECORDING) && (priv->state != UCA_CAM_READOUT))
return UCA_ERR_CAMERA | UCA_ERR_NOT_RECORDING;
return priv->grab(priv, buffer, meta_data);
}
@@ -339,6 +339,7 @@ uint32_t uca_cam_readout(struct uca_camera *cam)
return UCA_ERR_CAMERA | UCA_ERR_IS_RECORDING;
if (priv->readout == NULL)
return UCA_ERR_CAMERA | UCA_ERR_NOT_IMPLEMENTED;
+ priv->state = UCA_CAM_READOUT;
return priv->readout(priv);
}
diff --git a/src/uca.h b/src/uca.h
index 03d0f4f..c4a9128 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -196,6 +196,7 @@ enum uca_cam_state {
UCA_CAM_CONFIGURABLE, /**< Camera can be configured and is not recording */
UCA_CAM_ARMED, /**< Camera is ready for recording */
UCA_CAM_RECORDING, /**< Camera is currently recording */
+ UCA_CAM_READOUT /**< Camera recorded and is currently in readout mode */
};
diff --git a/test/grab-async.c b/test/grab-async.c
index 945bf15..22774d7 100644
--- a/test/grab-async.c
+++ b/test/grab-async.c
@@ -51,11 +51,11 @@ int main(int argc, char *argv[])
uca_cam_register_callback(cam, &grab_callback, &props);
uca_cam_start_recording(cam);
- printf("grabbing for 2 seconds\n");
- sleep(2);
+ printf("grabbing for 1 second ... ");
+ fflush(stdout);
+ sleep(1);
uca_cam_stop_recording(cam);
printf("done\n");
- fflush(stdout);
uca_destroy(u);
return 0;
diff --git a/test/grab.c b/test/grab.c
index 59a4fb3..d4f458a 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -36,6 +36,8 @@ int main(int argc, char *argv[])
handle_error(uca_cam_set_property(cam, UCA_PROP_DELAY, &val));
val = UCA_TIMESTAMP_ASCII | UCA_TIMESTAMP_BINARY;
handle_error(uca_cam_set_property(cam, UCA_PROP_TIMESTAMP_MODE, &val));
+ val = 1;
+ handle_error(uca_cam_set_property(cam, UCA_PROP_GRAB_AUTO, &val));
uint32_t width, height, bits;
handle_error(uca_cam_get_property(cam, UCA_PROP_WIDTH, &width, 0));