diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-03-23 09:36:41 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-03-23 09:36:41 +0100 |
commit | 8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af (patch) | |
tree | 5b39b777aec9dd10b61b1d117fd97c33cc397019 | |
parent | bc152fef853627c971b1fc9eb3aab985af83b248 (diff) | |
download | libuca-8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af.tar.gz libuca-8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af.tar.bz2 libuca-8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af.tar.xz libuca-8c48a8ad1c6153770c24ae2e8a9b0f9efedfc4af.zip |
Some very important person at SiSo decided to have 64-bit frame numbers on 64-
bit systems and 32-bit frame numbers on 32-bit systems. This commit changes the
API to the former, which means it now takes 1.44x10^10 years to have an overflow
at a very slow frame rate of 1000 frames per second.
-rw-r--r-- | src/grabbers/me4.c | 7 | ||||
-rw-r--r-- | src/uca-cam.h | 4 | ||||
-rw-r--r-- | src/uca-grabber.h | 2 | ||||
-rw-r--r-- | test/grab-async.c | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c index cc7af2c..f1073ff 100644 --- a/src/grabbers/me4.c +++ b/src/grabbers/me4.c @@ -138,9 +138,10 @@ uint32_t uca_me4_stop_acquire(struct uca_grabber *grabber) return UCA_NO_ERROR; } -uint32_t uca_me4_grab(struct uca_grabber *grabber, void **buffer, uint32_t *frame_number) +uint32_t uca_me4_grab(struct uca_grabber *grabber, void **buffer, uint64_t *frame_number) { - static int32_t last_frame = 0; + static frameindex_t last_frame = 0; + if (grabber->asynchronous) last_frame = Fg_getLastPicNumberEx(GET_FG(grabber), PORT_A, GET_MEM(grabber)); else @@ -149,7 +150,7 @@ uint32_t uca_me4_grab(struct uca_grabber *grabber, void **buffer, uint32_t *fram if (last_frame <= 0) return UCA_ERR_PROP_GENERAL; - *frame_number = last_frame; + *frame_number = (uint64_t) last_frame; *buffer = Fg_getImagePtrEx(GET_FG(grabber), last_frame, PORT_A, GET_MEM(grabber)); return UCA_NO_ERROR; } diff --git a/src/uca-cam.h b/src/uca-cam.h index d52f390..f12bb12 100644 --- a/src/uca-cam.h +++ b/src/uca-cam.h @@ -156,7 +156,7 @@ typedef uint32_t (*uca_cam_stop_recording) (struct uca_camera *cam); * * \note The meta data parameter is not yet specified but just a place holder. */ -typedef void (*uca_cam_grab_callback) (uint32_t image_number, void *buffer, void *meta_data, void *user); +typedef void (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user); /** * Register callback for given frame grabber. To actually start receiving @@ -248,7 +248,7 @@ typedef struct uca_camera { enum uca_cam_state state; /**< camera state */ uint32_t frame_width; /**< current frame width */ uint32_t frame_height; /**< current frame height */ - uint32_t current_frame; /**< last grabbed frame number */ + uint64_t current_frame; /**< last grabbed frame number */ uca_cam_grab_callback callback; void *callback_user; /**< user data for callback */ diff --git a/src/uca-grabber.h b/src/uca-grabber.h index b7a8736..024777e 100644 --- a/src/uca-grabber.h +++ b/src/uca-grabber.h @@ -99,7 +99,7 @@ typedef uint32_t (*uca_grabber_stop_acquire) (struct uca_grabber *grabber); * * \param[out] frame_number Number of the grabbed frame */ -typedef uint32_t (*uca_grabber_grab) (struct uca_grabber *grabber, void **buffer, uint32_t *frame_number); +typedef uint32_t (*uca_grabber_grab) (struct uca_grabber *grabber, void **buffer, uint64_t *frame_number); /** diff --git a/test/grab-async.c b/test/grab-async.c index 5f3694e..058ec3f 100644 --- a/test/grab-async.c +++ b/test/grab-async.c @@ -11,18 +11,18 @@ struct image_props { uint32_t bits; }; -void grab_callback(uint32_t image_number, void *buffer, void *meta_data, void *user) +void grab_callback(uint64_t image_number, void *buffer, void *meta_data, void *user) { struct image_props *props = (struct image_props *) user; const int pixel_size = props->bits == 8 ? 1 : 2; char filename[256]; - sprintf(filename, "out-%04i.raw", image_number); + sprintf(filename, "out-%04lu.raw", image_number); FILE *fp = fopen(filename, "wb"); fwrite(buffer, props->width * props->height, pixel_size, fp); fclose(fp); - printf("grabbed picture %i at %p (%ix%i @ %i bits)\n", image_number, buffer, props->width, props->height, props->bits); + printf("grabbed picture %lu at %p (%ix%i @ %i bits)\n", image_number, buffer, props->width, props->height, props->bits); } int main(int argc, char *argv[]) |