diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-21 12:37:12 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-21 12:37:12 +0100 |
commit | 195ead4d9aa4f1ed244558d49cee348a5ae6e939 (patch) | |
tree | ce8cb54595b89b8cc9adb683b453d0e0999454f0 /test | |
parent | ef5dfb7febd8881158e493451a27a2500ced14cb (diff) | |
download | uca-195ead4d9aa4f1ed244558d49cee348a5ae6e939.tar.gz uca-195ead4d9aa4f1ed244558d49cee348a5ae6e939.tar.bz2 uca-195ead4d9aa4f1ed244558d49cee348a5ae6e939.tar.xz uca-195ead4d9aa4f1ed244558d49cee348a5ae6e939.zip |
Fix grabber allocation and callback registration for me4 and pf
Diffstat (limited to 'test')
-rw-r--r-- | test/grab.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/grab.c b/test/grab.c index 3e429ed..34b90c8 100644 --- a/test/grab.c +++ b/test/grab.c @@ -4,6 +4,10 @@ #include "uca.h" #include "uca-cam.h" +#define handle_error(errno) {if ((errno) != UCA_NO_ERROR) printf("error at <%s:%i>\n", \ + __FILE__, __LINE__);} + + int main(int argc, char *argv[]) { struct uca *u = uca_init(NULL); @@ -15,24 +19,24 @@ int main(int argc, char *argv[]) /* take first camera */ struct uca_camera *cam = u->cameras; - uint32_t val = 1; - cam->set_property(cam, UCA_PROP_EXPOSURE, &val); + uint32_t val = 2000; + handle_error(cam->set_property(cam, UCA_PROP_EXPOSURE, &val)); val = 0; - cam->set_property(cam, UCA_PROP_DELAY, &val); + handle_error(cam->set_property(cam, UCA_PROP_DELAY, &val)); uint32_t width, height, bits; - cam->get_property(cam, UCA_PROP_WIDTH, &width, 0); - cam->get_property(cam, UCA_PROP_HEIGHT, &height, 0); - cam->get_property(cam, UCA_PROP_BITDEPTH, &bits, 0); + handle_error(cam->get_property(cam, UCA_PROP_WIDTH, &width, 0)); + handle_error(cam->get_property(cam, UCA_PROP_HEIGHT, &height, 0)); + handle_error(cam->get_property(cam, UCA_PROP_BITDEPTH, &bits, 0)); - uca_cam_alloc(cam, 10); + handle_error(uca_cam_alloc(cam, 10)); const int pixel_size = bits == 8 ? 1 : 2; uint16_t *buffer = (uint16_t *) malloc(width * height * pixel_size); - cam->start_recording(cam); - cam->grab(cam, (char *) buffer, NULL); - cam->stop_recording(cam); + handle_error(cam->start_recording(cam)); + handle_error(cam->grab(cam, (char *) buffer, NULL)); + handle_error(cam->stop_recording(cam)); uca_destroy(u); FILE *fp = fopen("out.raw", "wb"); |