summaryrefslogtreecommitdiffstats
path: root/src/cameras
diff options
context:
space:
mode:
Diffstat (limited to 'src/cameras')
-rw-r--r--src/cameras/dummy.c8
-rw-r--r--src/cameras/ipe.c15
-rw-r--r--src/cameras/pco.c13
-rw-r--r--src/cameras/pf.c13
4 files changed, 42 insertions, 7 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c
index 226e476..5361301 100644
--- a/src/cameras/dummy.c
+++ b/src/cameras/dummy.c
@@ -139,7 +139,7 @@ static void *uca_dummy_grab_thread(void *arg)
while (dc->thread_running) {
uca_dummy_memcpy(cam, dc->buffer);
gettimeofday(&start, NULL);
- cam->callback(cam->current_frame, dc->buffer, cam->user_callback);
+ cam->callback(cam->current_frame, dc->buffer, NULL, cam->callback_user);
gettimeofday(&stop, NULL);
call_time = uca_dummy_time_diff(&start, &stop);
@@ -253,7 +253,7 @@ uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callba
{
if (cam->callback == NULL) {
cam->callback = cb;
- cam->user_callback = user;
+ cam->callback_user = user;
}
else
return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED;
@@ -261,7 +261,7 @@ uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callba
return UCA_NO_ERROR;
}
-uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer)
+uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
if (cam->callback != NULL)
return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED;
@@ -295,7 +295,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;
+ uca->callback_user = NULL;
struct dummy_cam *dummy_cam = (struct dummy_cam *) malloc(sizeof(struct dummy_cam));
dummy_cam->bitdepth = 8;
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c
index 4b3d021..a9f1ff2 100644
--- a/src/cameras/ipe.c
+++ b/src/cameras/ipe.c
@@ -88,11 +88,21 @@ static uint32_t uca_ipe_stop_recording(struct uca_camera *cam)
return UCA_NO_ERROR;
}
-static uint32_t uca_ipe_grab(struct uca_camera *cam, char *buffer)
+static uint32_t uca_ipe_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
return UCA_NO_ERROR;
}
+static uint32_t uca_ipe_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb, void *user)
+{
+ if (cam->callback == NULL) {
+ cam->callback = cb;
+ cam->callback_user = user;
+ return UCA_NO_ERROR;
+ }
+ return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED;
+}
+
static uint32_t uca_ipe_destroy(struct uca_camera *cam)
{
pcilib_close(GET_HANDLE(cam));
@@ -118,7 +128,10 @@ uint32_t uca_ipe_init(struct uca_camera **cam, struct uca_grabber *grabber)
uca->start_recording = &uca_ipe_start_recording;
uca->stop_recording = &uca_ipe_stop_recording;
uca->grab = &uca_ipe_grab;
+ uca->register_callback = &uca_ipe_register_callback;
+ uca->callback = NULL;
+ uca_>callback_user = NULL;
uca->state = UCA_CAM_CONFIGURABLE;
uca->user = handle;
*cam = uca;
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index 1ca16f4..59c689d 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -212,7 +212,7 @@ uint32_t uca_pco_stop_recording(struct uca_camera *cam)
return UCA_NO_ERROR;
}
-uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer)
+uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data)
{
uint16_t *frame;
uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
@@ -224,6 +224,17 @@ uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer)
return UCA_NO_ERROR;
}
+uint32_t uca_pco_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
+{
+ if (cam->callback == NULL) {
+ cam->callback = callback;
+ cam->callback_user = user;
+ cam->grabber->register_callback(cam->grabber, callback, NULL, user);
+ return UCA_NO_ERROR;
+ }
+ return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED;
+}
+
uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber)
{
if (grabber == NULL)
diff --git a/src/cameras/pf.c b/src/cameras/pf.c
index 7f6ad0f..ab6a490 100644
--- a/src/cameras/pf.c
+++ b/src/cameras/pf.c
@@ -171,7 +171,7 @@ uint32_t uca_pf_stop_recording(struct uca_camera *cam)
return UCA_NO_ERROR;
}
-uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer)
+uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata)
{
uint16_t *frame;
uint32_t err = cam->grabber->grab(cam->grabber, (void **) &frame, &cam->current_frame);
@@ -182,6 +182,17 @@ uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer)
return UCA_NO_ERROR;
}
+uint32_t uca_pf_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user)
+{
+ if (cam->callback == NULL) {
+ cam->callback = callback;
+ cam->callback_user = user;
+ cam->grabber->register_callback(cam->grabber, callback, NULL, user);
+ return UCA_NO_ERROR;
+ }
+ return UCA_ERR_GRABBER_CALLBACK_ALREADY_REGISTERED;
+}
+
static uint32_t uca_pf_destroy(struct uca_camera *cam)
{
pfDeviceClose(0);