diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-18 09:37:35 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-18 09:37:35 +0100 |
commit | 40d450c588a9f2548e6ae677d4d448bdec5d6a6a (patch) | |
tree | 024dd76eca988ccc2c194bc70084aa223089fc53 /src/cameras/dummy.c | |
parent | 406445e7694222e16da863908d93c87c27778ec3 (diff) | |
download | uca-40d450c588a9f2548e6ae677d4d448bdec5d6a6a.tar.gz uca-40d450c588a9f2548e6ae677d4d448bdec5d6a6a.tar.bz2 uca-40d450c588a9f2548e6ae677d4d448bdec5d6a6a.tar.xz uca-40d450c588a9f2548e6ae677d4d448bdec5d6a6a.zip |
Pass registered user data to callback
Diffstat (limited to 'src/cameras/dummy.c')
-rw-r--r-- | src/cameras/dummy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c index 53351f8..60dea7f 100644 --- a/src/cameras/dummy.c +++ b/src/cameras/dummy.c @@ -130,7 +130,7 @@ static void *uca_dummy_grab_thread(void *arg) while (dc->thread_running) { uca_dummy_memcpy(cam, dc->buffer); - cam->callback(cam->current_frame, dc->buffer); + cam->callback(cam->current_frame, dc->buffer, cam->user_callback); cam->current_frame++; usleep(sleep_time); } @@ -233,10 +233,12 @@ uint32_t uca_dummy_stop_recording(struct uca_camera *cam) return UCA_NO_ERROR; } -uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb) +uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb, void *user) { - if (cam->callback == NULL) + if (cam->callback == NULL) { cam->callback = cb; + cam->user_callback = user; + } else return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED; @@ -277,6 +279,7 @@ uint32_t uca_dummy_init(struct uca_camera **cam, struct uca_grabber *grabber) uca->current_frame = 0; uca->grabber = NULL; uca->callback = NULL; + uca->user_callback = NULL; struct dummy_cam *dummy_cam = (struct dummy_cam *) malloc(sizeof(struct dummy_cam)); dummy_cam->bitdepth = 8; |