diff options
Diffstat (limited to 'src/cameras')
-rw-r--r-- | src/cameras/dummy.c | 27 | ||||
-rw-r--r-- | src/cameras/pco.c | 39 | ||||
-rw-r--r-- | src/cameras/pf.c | 20 |
3 files changed, 42 insertions, 44 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c index 5bb609a..58aa591 100644 --- a/src/cameras/dummy.c +++ b/src/cameras/dummy.c @@ -29,7 +29,7 @@ typedef struct dummy_cam { } dummy_cam_t; -static const char digits[10][20] = { +static const char g_digits[10][20] = { /* 0 */ { 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, @@ -96,13 +96,12 @@ const int DIGIT_WIDTH = 4; const int DIGIT_HEIGHT = 5; #define GET_DUMMY(uca) ((struct dummy_cam *)(uca->user)) -#define set_void(p, type, value) { *((type *) p) = value; } static void uca_dummy_print_number(char *buffer, int number, int x, int y, int width) { for (int i = 0; i < DIGIT_WIDTH; i++) { for (int j = 0; j < DIGIT_HEIGHT; j++) { - buffer[(y+j)*width + (x+i)] = digits[number][j*DIGIT_WIDTH+i]; + buffer[(y+j)*width + (x+i)] = g_digits[number][j*DIGIT_WIDTH+i]; } } } @@ -191,31 +190,31 @@ static uint32_t uca_dummy_get_property(struct uca_camera *cam, enum uca_property break; case UCA_PROP_WIDTH: - set_void(data, uint32_t, cam->frame_width); + uca_set_void(data, uint32_t, cam->frame_width); break; case UCA_PROP_WIDTH_MIN: - set_void(data, uint32_t, 1); + uca_set_void(data, uint32_t, 1); break; case UCA_PROP_WIDTH_MAX: - set_void(data, uint32_t, 4096); + uca_set_void(data, uint32_t, 4096); break; case UCA_PROP_HEIGHT: - set_void(data, uint32_t, cam->frame_height); + uca_set_void(data, uint32_t, cam->frame_height); break; case UCA_PROP_HEIGHT_MIN: - set_void(data, uint32_t, 1); + uca_set_void(data, uint32_t, 1); break; case UCA_PROP_HEIGHT_MAX: - set_void(data, uint32_t, 4096); + uca_set_void(data, uint32_t, 4096); break; case UCA_PROP_BITDEPTH: - set_void(data, uint32_t, 8); + uca_set_void(data, uint32_t, 8); break; default: @@ -224,7 +223,7 @@ static uint32_t uca_dummy_get_property(struct uca_camera *cam, enum uca_property return UCA_NO_ERROR; } -uint32_t uca_dummy_start_recording(struct uca_camera *cam) +static uint32_t uca_dummy_start_recording(struct uca_camera *cam) { if (cam->callback != NULL) { #ifdef HAVE_PTHREADS @@ -240,7 +239,7 @@ uint32_t uca_dummy_start_recording(struct uca_camera *cam) return UCA_NO_ERROR; } -uint32_t uca_dummy_stop_recording(struct uca_camera *cam) +static uint32_t uca_dummy_stop_recording(struct uca_camera *cam) { struct dummy_cam *dc = GET_DUMMY(cam); if (cam->callback != NULL) { @@ -252,7 +251,7 @@ 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, void *user) +static uint32_t uca_dummy_register_callback(struct uca_camera *cam, uca_cam_grab_callback cb, void *user) { if (cam->callback == NULL) { cam->callback = cb; @@ -264,7 +263,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, void *meta_data) +static uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer, void *meta_data) { if (cam->callback != NULL) return UCA_ERR_CAMERA | UCA_ERR_CALLBACK | UCA_ERR_ALREADY_REGISTERED; diff --git a/src/cameras/pco.c b/src/cameras/pco.c index 15fec3c..29fb70e 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -15,7 +15,7 @@ typedef struct pco_desc { #define GET_PCO_DESC(cam) ((struct pco_desc *) cam->user) #define GET_PCO(cam) (((struct pco_desc *)(cam->user))->pco) -#define set_void(p, type, value) { *((type *) p) = (type) value; } +#define uca_set_void(p, type, value) { *((type *) p) = (type) value; } static uint32_t uca_pco_set_exposure(struct uca_camera *cam, uint32_t *exposure) @@ -120,7 +120,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i { SC2_Temperature_Response temperature; if (pco_read_property(pco, GET_TEMPERATURE, &temperature, sizeof(temperature)) == PCO_NOERROR) - set_void(data, uint32_t, temperature.sCCDtemp / 10); + uca_set_void(data, uint32_t, temperature.sCCDtemp / 10); } break; @@ -128,32 +128,32 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i { SC2_Temperature_Response temperature; if (pco_read_property(pco, GET_TEMPERATURE, &temperature, sizeof(temperature)) == PCO_NOERROR) - set_void(data, uint32_t, temperature.sCamtemp); + uca_set_void(data, uint32_t, temperature.sCamtemp); } break; case UCA_PROP_WIDTH: - set_void(data, uint32_t, cam->frame_width); + uca_set_void(data, uint32_t, cam->frame_width); break; case UCA_PROP_WIDTH_MIN: - set_void(data, uint32_t, 1); + uca_set_void(data, uint32_t, 1); break; case UCA_PROP_WIDTH_MAX: - set_void(data, uint32_t, pco->description.wMaxHorzResStdDESC); + uca_set_void(data, uint32_t, pco->description.wMaxHorzResStdDESC); break; case UCA_PROP_HEIGHT: - set_void(data, uint32_t, cam->frame_height); + uca_set_void(data, uint32_t, cam->frame_height); break; case UCA_PROP_HEIGHT_MIN: - set_void(data, uint32_t, 1); + uca_set_void(data, uint32_t, 1); break; case UCA_PROP_HEIGHT_MAX: - set_void(data, uint32_t, pco->description.wMaxVertResStdDESC); + uca_set_void(data, uint32_t, pco->description.wMaxVertResStdDESC); break; case UCA_PROP_X_OFFSET: @@ -170,11 +170,11 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i break; case UCA_PROP_DELAY_MIN: - set_void(data, uint32_t, pco->description.dwMinDelayDESC); + uca_set_void(data, uint32_t, pco->description.dwMinDelayDESC); break; case UCA_PROP_DELAY_MAX: - set_void(data, uint32_t, pco->description.dwMaxDelayDESC); + uca_set_void(data, uint32_t, pco->description.dwMaxDelayDESC); break; case UCA_PROP_EXPOSURE: @@ -185,15 +185,15 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i break; case UCA_PROP_EXPOSURE_MIN: - set_void(data, uint32_t, pco->description.dwMinExposureDESC); + uca_set_void(data, uint32_t, pco->description.dwMinExposureDESC); break; case UCA_PROP_EXPOSURE_MAX: - set_void(data, uint32_t, pco->description.dwMaxExposureDESC); + uca_set_void(data, uint32_t, pco->description.dwMaxExposureDESC); break; case UCA_PROP_BITDEPTH: - set_void(data, uint32_t, 16); + uca_set_void(data, uint32_t, 16); break; case UCA_PROP_GRAB_TIMEOUT: @@ -202,7 +202,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i uint32_t err = cam->grabber->get_property(cam->grabber, UCA_PROP_GRAB_TIMEOUT, &timeout); if (err != UCA_NO_ERROR) return err; - set_void(data, uint32_t, timeout); + uca_set_void(data, uint32_t, timeout); } break; @@ -212,7 +212,7 @@ static uint32_t uca_pco_get_property(struct uca_camera *cam, enum uca_property_i return UCA_NO_ERROR; } -uint32_t uca_pco_start_recording(struct uca_camera *cam) +static uint32_t uca_pco_start_recording(struct uca_camera *cam) { uint32_t err = UCA_ERR_CAMERA | UCA_ERR_INIT; struct pco_edge *pco = GET_PCO(cam); @@ -223,14 +223,14 @@ uint32_t uca_pco_start_recording(struct uca_camera *cam) return cam->grabber->acquire(cam->grabber, -1); } -uint32_t uca_pco_stop_recording(struct uca_camera *cam) +static uint32_t uca_pco_stop_recording(struct uca_camera *cam) { if (pco_set_rec_state(GET_PCO(cam), 0) != PCO_NOERROR) return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_UNCLASSIFIED; return UCA_NO_ERROR; } -uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data) +static 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); @@ -241,7 +241,7 @@ uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data) return UCA_NO_ERROR; } -uint32_t uca_pco_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user) +static uint32_t uca_pco_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user) { if (cam->callback == NULL) { cam->callback = callback; @@ -277,6 +277,7 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber) uca->start_recording = &uca_pco_start_recording; uca->stop_recording = &uca_pco_stop_recording; uca->grab = &uca_pco_grab; + uca->register_callback = &uca_pco_register_callback; /* Prepare camera for recording */ pco_set_scan_mode(pco, PCO_SCANMODE_SLOW); diff --git a/src/cameras/pf.c b/src/cameras/pf.c index 86fe5e6..b787f5c 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -7,8 +7,6 @@ #include "uca-cam.h" #include "uca-grabber.h" -#define set_void(p, type, value) { *((type *) p) = value; } - struct uca_pf_map { enum uca_property_ids uca_prop; const char *pf_prop; @@ -115,7 +113,7 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id /* Handle all special cases */ switch (property) { case UCA_PROP_BITDEPTH: - set_void(data, uint32_t, 8); + uca_set_void(data, uint32_t, 8); return UCA_NO_ERROR; default: @@ -131,16 +129,16 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id switch (value.type) { case PF_INT: - set_void(data, uint32_t, value.value.i); + uca_set_void(data, uint32_t, value.value.i); break; case PF_FLOAT: - set_void(data, uint32_t, (uint32_t) floor((value.value.f * 1000.0)+0.5)); + uca_set_void(data, uint32_t, (uint32_t) floor((value.value.f * 1000.0)+0.5)); break; case PF_STRING: if (property == UCA_PROP_FRAMERATE) { - set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5)); + uca_set_void(data, uint32_t, (uint32_t) floor(atof(value.value.p)+0.5)); } else { strncpy((char *) data, value.value.p, num); @@ -148,7 +146,7 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id break; case PF_MODE: - set_void(data, uint32_t, (uint32_t) value.value.i); + uca_set_void(data, uint32_t, (uint32_t) value.value.i); break; default: @@ -163,17 +161,17 @@ static uint32_t uca_pf_get_property(struct uca_camera *cam, enum uca_property_id return cam->grabber->get_property(cam->grabber, property, data); } -uint32_t uca_pf_start_recording(struct uca_camera *cam) +static uint32_t uca_pf_start_recording(struct uca_camera *cam) { return cam->grabber->acquire(cam->grabber, -1); } -uint32_t uca_pf_stop_recording(struct uca_camera *cam) +static uint32_t uca_pf_stop_recording(struct uca_camera *cam) { return cam->grabber->stop_acquire(cam->grabber); } -uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata) +static 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); @@ -184,7 +182,7 @@ uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata) return UCA_NO_ERROR; } -uint32_t uca_pf_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user) +static uint32_t uca_pf_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user) { if (cam->callback == NULL) { cam->callback = callback; |