summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cameras/pco.c34
-rw-r--r--src/grabbers/me4.c1
-rw-r--r--src/uca-grabber.h1
-rw-r--r--test/control.c13
-rw-r--r--test/grab.c3
5 files changed, 41 insertions, 11 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index 00ceee5..12b71f7 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -295,7 +295,7 @@ static uint32_t uca_pco_grab(struct uca_camera_priv *cam, char *buffer, void *me
pco_desc_t *pco_d = GET_PCO_DESC(cam);
pco_handle pco = pco_d->pco;
- if (cam->state == UCA_CAM_READOUT && pco_d->type == CAMERATYPE_PCO_DIMAX_STD) {
+ if (cam->state == UCA_CAM_READOUT) {
if (pco_d->current_image == pco_d->num_recorded_images)
return UCA_ERR_NO_MORE_IMAGES;
@@ -389,17 +389,33 @@ uint32_t uca_pco_init(struct uca_camera_priv **cam, struct uca_grabber_priv *gra
/* Prepare frame grabber for recording */
int val = 0;
- if (pco_d->type == CAMERATYPE_PCO_EDGE)
- val = UCA_CL_8BIT_FULL_10;
- else if (pco_d->type == CAMERATYPE_PCO_DIMAX_STD)
- val = UCA_CL_SINGLE_TAP_8;
+ switch (pco_d->type) {
+ case CAMERATYPE_PCO_EDGE:
+ val = UCA_CL_8BIT_FULL_10;
+ break;
+ case CAMERATYPE_PCO_DIMAX_STD:
+ val = UCA_CL_SINGLE_TAP_8;
+ break;
+ case CAMERATYPE_PCO4000:
+ val = UCA_CL_SINGLE_TAP_16;
+ break;
+ default:
+ break;
+ }
grabber->set_property(grabber, UCA_GRABBER_CAMERALINK_TYPE, &val);
val = 0;
- if (pco_d->type == CAMERATYPE_PCO_EDGE)
- val = UCA_FORMAT_GRAY8;
- else if (pco_d->type == CAMERATYPE_PCO_DIMAX_STD)
- val = UCA_FORMAT_GRAY16;
+ switch (pco_d->type) {
+ case CAMERATYPE_PCO_EDGE:
+ val = UCA_FORMAT_GRAY8;
+ break;
+ case CAMERATYPE_PCO_DIMAX_STD:
+ case CAMERATYPE_PCO4000:
+ val = UCA_FORMAT_GRAY16;
+ break;
+ default:
+ break;
+ }
grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val);
val = UCA_TRIGGER_AUTO;
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index a157206..74813d1 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -42,6 +42,7 @@ static struct uca_sisofg_map_t uca_to_fg[] = {
{ UCA_FORMAT_GRAY8, FG_GRAY, false },
{ UCA_FORMAT_GRAY16, FG_GRAY16, false },
{ UCA_CL_SINGLE_TAP_8, FG_CL_SINGLETAP_8_BIT, false },
+ { UCA_CL_SINGLE_TAP_16, FG_CL_SINGLETAP_16_BIT, false },
{ UCA_CL_8BIT_FULL_8, FG_CL_8BIT_FULL_8, false },
{ UCA_CL_8BIT_FULL_10, FG_CL_8BIT_FULL_10, false },
{ UCA_TRIGGER_AUTO, FREE_RUN, false },
diff --git a/src/uca-grabber.h b/src/uca-grabber.h
index a350cc0..c502ea5 100644
--- a/src/uca-grabber.h
+++ b/src/uca-grabber.h
@@ -23,6 +23,7 @@ enum uca_grabber_constants {
UCA_FORMAT_GRAY16,
UCA_CL_SINGLE_TAP_8,
+ UCA_CL_SINGLE_TAP_16,
UCA_CL_8BIT_FULL_8,
UCA_CL_8BIT_FULL_10
};
diff --git a/test/control.c b/test/control.c
index 156fea3..0f31573 100644
--- a/test/control.c
+++ b/test/control.c
@@ -91,7 +91,11 @@ void *grab_thread(void *args)
int counter = 0;
while (data->running) {
- uca_cam_grab(cam, (char *) data->buffer, NULL);
+ if (uca_cam_grab(cam, (char *) data->buffer, NULL) != UCA_NO_ERROR) {
+ sleep(1);
+ continue;
+ }
+
if (data->store) {
snprintf(filename, FILENAME_MAX, "frame-%i-%08i.raw", data->timestamp, counter++);
FILE *fp = fopen(filename, "wb");
@@ -99,6 +103,8 @@ void *grab_thread(void *args)
fclose(fp);
}
+ /* FIXME: We should actually check if this is really a new frame and
+ * just do nothing if it is an already displayed one. */
if (data->pixel_size == 1)
convert_8bit_to_rgb(data->pixels, data->buffer, data->width, data->height);
else if (data->pixel_size == 2)
@@ -360,6 +366,10 @@ int main(int argc, char *argv[])
uint32_t mode = UCA_TIMESTAMP_ASCII | UCA_TIMESTAMP_BINARY;
uca_cam_set_property(cam, UCA_PROP_TIMESTAMP_MODE, &mode);
+ uint32_t val = 1;
+ uca_cam_set_property(cam, UCA_PROP_GRAB_AUTO, &val);
+ val = 0;
+ uca_cam_set_property(cam, UCA_PROP_GRAB_SYNCHRONOUS, &val);
g_thread_init(NULL);
gdk_threads_init();
@@ -404,6 +414,7 @@ int main(int argc, char *argv[])
td.scale = 65535.0f;
td.statusbar = GTK_STATUSBAR(gtk_builder_get_object(builder, "statusbar"));
td.statusbar_context_id = gtk_statusbar_get_context_id(td.statusbar, "Recording Information");
+ td.store = FALSE;
gtk_builder_connect_signals(builder, &td);
diff --git a/test/grab.c b/test/grab.c
index d4f458a..bcee9aa 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -50,6 +50,7 @@ int main(int argc, char *argv[])
uint16_t *buffer = (uint16_t *) malloc(width * height * pixel_size);
handle_error(uca_cam_start_recording(cam));
+ sleep(3);
uint32_t error = UCA_NO_ERROR;
char filename[FILENAME_MAX];
@@ -62,8 +63,8 @@ int main(int argc, char *argv[])
fwrite(buffer, width*height, pixel_size, fp);
fclose(fp);
}
-
handle_error(uca_cam_stop_recording(cam));
+
uca_destroy(u);
free(buffer);