diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-10-19 14:29:57 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-10-19 14:29:57 +0200 |
commit | 338c435be149cdc0a64e548d3ff3a86d12b1ac38 (patch) | |
tree | 1fac47f734c5746d545f730d5a05c73eb3c74669 | |
parent | f4447a4d02d21c4820d8e469b27f308326f77922 (diff) | |
download | libuca-338c435be149cdc0a64e548d3ff3a86d12b1ac38.tar.gz libuca-338c435be149cdc0a64e548d3ff3a86d12b1ac38.tar.bz2 libuca-338c435be149cdc0a64e548d3ff3a86d12b1ac38.tar.xz libuca-338c435be149cdc0a64e548d3ff3a86d12b1ac38.zip |
Fix: timestamp mode
-rw-r--r-- | src/cameras/pco.c | 20 | ||||
-rw-r--r-- | test/control.c | 3 | ||||
-rw-r--r-- | test/grab.c | 3 |
3 files changed, 21 insertions, 5 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c index fd277af..955ee6d 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -90,7 +90,21 @@ static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_prope return uca_pco_set_delay(cam, (uint32_t *) data); case UCA_PROP_TIMESTAMP_MODE: - return pco_set_timestamp_mode(GET_PCO(cam), *((uint16_t *) data)); + { + uint32_t mode = *((uint32_t *) data); + if (mode & UCA_TIMESTAMP_ASCII) { + if (mode & UCA_TIMESTAMP_BINARY) + return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_BINARYANDASCII); + else { + printf("hello\n"); + return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_ASCII); + } + } + else if (mode & UCA_TIMESTAMP_BINARY) + return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_BINARY); + else + return pco_set_timestamp_mode(GET_PCO(cam), TIMESTAMP_MODE_OFF); + } case UCA_PROP_HOTPIXEL_CORRECTION: return pco_set_hotpixel_correction(GET_PCO(cam), *(uint32_t *) data); @@ -318,9 +332,9 @@ uint32_t uca_pco_init(struct uca_camera_priv **cam, struct uca_grabber_priv *gra pco_set_scan_mode(pco, PCO_SCANMODE_SLOW); pco_set_rec_state(pco, 0); - pco_set_timestamp_mode(pco, UCA_TIMESTAMP_ASCII); + pco_set_timestamp_mode(pco, TIMESTAMP_MODE_ASCII); pco_set_timebase(pco, 1, 1); - pco_arm_camera(pco); + /* pco_arm_camera(pco); */ /* Prepare frame grabber for recording */ int val = 0; diff --git a/test/control.c b/test/control.c index 44befe8..156fea3 100644 --- a/test/control.c +++ b/test/control.c @@ -358,6 +358,9 @@ int main(int argc, char *argv[]) uca_cam_get_property(cam, UCA_PROP_HEIGHT, &height, 0); uca_cam_get_property(cam, UCA_PROP_BITDEPTH, &bits_per_sample, 0); + uint32_t mode = UCA_TIMESTAMP_ASCII | UCA_TIMESTAMP_BINARY; + uca_cam_set_property(cam, UCA_PROP_TIMESTAMP_MODE, &mode); + g_thread_init(NULL); gdk_threads_init(); gtk_init (&argc, &argv); diff --git a/test/grab.c b/test/grab.c index ab3263f..6ade84a 100644 --- a/test/grab.c +++ b/test/grab.c @@ -54,8 +54,7 @@ int main(int argc, char *argv[]) int counter = 0; while ((error == UCA_NO_ERROR) && (counter < 20)) { - error = uca_cam_grab(cam, (char *) buffer, NULL); - printf("error = 0x%x\n", error); + handle_error(uca_cam_grab(cam, (char *) buffer, NULL)); snprintf(filename, FILENAME_MAX, "frame-%08i.raw", counter++); FILE *fp = fopen(filename, "wb"); fwrite(buffer, width*height, pixel_size, fp); |