diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-12-14 16:20:24 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-12-14 16:20:24 +0100 |
commit | bd7013de1e06a759e519ee5f9c203f4c03f25e83 (patch) | |
tree | df626c06f0320dab6aaf01f665c6a96d206312b9 /test | |
parent | 29b0567b035ec45c1d78423a8d96821cdaf85787 (diff) | |
download | libuca-bd7013de1e06a759e519ee5f9c203f4c03f25e83.tar.gz libuca-bd7013de1e06a759e519ee5f9c203f4c03f25e83.tar.bz2 libuca-bd7013de1e06a759e519ee5f9c203f4c03f25e83.tar.xz libuca-bd7013de1e06a759e519ee5f9c203f4c03f25e83.zip |
Add: pco.4000 support
Diffstat (limited to 'test')
-rw-r--r-- | test/control.c | 13 | ||||
-rw-r--r-- | test/grab.c | 3 |
2 files changed, 14 insertions, 2 deletions
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); |