diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cameras/pco.c | 4 | ||||
-rw-r--r-- | src/cameras/pf.c | 6 | ||||
-rw-r--r-- | src/cameras/simple.c | 4 | ||||
-rw-r--r-- | src/uca-cam.h | 6 | ||||
-rw-r--r-- | src/uca-grabber.h | 2 | ||||
-rw-r--r-- | src/uca.c | 52 | ||||
-rw-r--r-- | src/uca.h | 88 |
7 files changed, 81 insertions, 81 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c index 2e02dfe..4510fa6 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -71,7 +71,7 @@ static uint32_t uca_pco_destroy(struct uca_camera_priv *cam) return UCA_NO_ERROR; } -static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data) +static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data) { struct uca_grabber_priv *grabber = cam->grabber; struct pco_desc *pco_d = GET_PCO_DESC(cam); @@ -144,7 +144,7 @@ static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_prope } -static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num) +static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num) { pco_handle pco = GET_PCO(cam); struct uca_grabber_priv *grabber = cam->grabber; diff --git a/src/cameras/pf.c b/src/cameras/pf.c index 1812aaf..829b94a 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -24,7 +24,7 @@ #include "uca-grabber.h" struct uca_pf_map { - enum uca_property_ids uca_prop; + uca_property_ids uca_prop; const char *pf_prop; }; @@ -63,7 +63,7 @@ static int uca_pf_set_uint32_property(TOKEN token, void *data, uint32_t *update_ return pfDevice_SetProperty(0, token, &value); } -static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data) +static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data) { struct uca_grabber_priv *grabber = cam->grabber; TOKEN token = INVALID_TOKEN; @@ -121,7 +121,7 @@ static uint32_t uca_pf_set_property(struct uca_camera_priv *cam, enum uca_proper } -static uint32_t uca_pf_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num) +static uint32_t uca_pf_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num) { TOKEN t; /* You gotta love developers who name types capitalized... */ PFValue value; diff --git a/src/cameras/simple.c b/src/cameras/simple.c index 368eb62..9b8be9a 100644 --- a/src/cameras/simple.c +++ b/src/cameras/simple.c @@ -23,7 +23,7 @@ #include "uca-grabber.h" -static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data) +static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, uca_property_ids property, void *data) { struct uca_grabber_priv *grabber = cam->grabber; int err = UCA_NO_ERROR; @@ -43,7 +43,7 @@ static uint32_t uca_simple_set_property(struct uca_camera_priv *cam, enum uca_pr } -static uint32_t uca_simple_get_property(struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num) +static uint32_t uca_simple_get_property(struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num) { struct uca_grabber_priv *grabber = cam->grabber; uint32_t value32 = 0; diff --git a/src/uca-cam.h b/src/uca-cam.h index 08b7941..5535dd0 100644 --- a/src/uca-cam.h +++ b/src/uca-cam.h @@ -57,8 +57,8 @@ struct uca_camera_priv *uca_cam_new(void); typedef struct uca_camera_priv { /* virtual methods to be overridden by concrete cameras */ uint32_t (*destroy) (struct uca_camera_priv *cam); - uint32_t (*set_property) (struct uca_camera_priv *cam, enum uca_property_ids property, void *data); - uint32_t (*get_property) (struct uca_camera_priv *cam, enum uca_property_ids property, void *data, size_t num); + uint32_t (*set_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data); + uint32_t (*get_property) (struct uca_camera_priv *cam, uca_property_ids property, void *data, size_t num); uint32_t (*start_recording) (struct uca_camera_priv *cam); uint32_t (*stop_recording) (struct uca_camera_priv *cam); uint32_t (*trigger) (struct uca_camera_priv *cam); @@ -68,7 +68,7 @@ typedef struct uca_camera_priv { uint32_t (*readout) (struct uca_camera_priv *cam); struct uca_grabber_priv *grabber; /**< grabber associated with this camera */ - enum uca_cam_state state; /**< camera state handled in uca.c */ + uca_cam_state state; /**< camera state handled in uca.c */ uint32_t frame_width; /**< current frame width */ uint32_t frame_height; /**< current frame height */ uint64_t current_frame; /**< last grabbed frame number */ diff --git a/src/uca-grabber.h b/src/uca-grabber.h index 8104d1f..414b9ac 100644 --- a/src/uca-grabber.h +++ b/src/uca-grabber.h @@ -127,7 +127,7 @@ typedef uint32_t (*uca_grabber_grab) (struct uca_grabber_priv *grabber, void **b * * \param[in] cb Callback function for when a frame arrived */ -typedef uint32_t (*uca_grabber_register_callback) (struct uca_grabber_priv *grabber, uca_cam_grab_callback cb, void *meta_data, void *user); +typedef uca_buffer_status (*uca_grabber_register_callback) (struct uca_grabber_priv *grabber, uca_cam_grab_callback cb, void *meta_data, void *user); /** @@ -65,7 +65,7 @@ const char *uca_unit_map[] = { "" }; -static struct uca_property property_map[UCA_PROP_LAST+1] = { +static uca_property property_map[UCA_PROP_LAST+1] = { { "General.Name", uca_na, uca_string, uca_read }, { "Image.Width", uca_pixel, uca_uint32t, uca_readwrite }, { "Image.Width.Min", uca_pixel, uca_uint32t, uca_read }, @@ -124,16 +124,16 @@ static pthread_mutex_t g_uca_init_lock = PTHREAD_MUTEX_INITIALIZER; #define uca_unlock(lock) #endif -struct uca *g_uca = NULL; +uca *g_uca = NULL; -struct uca *uca_init(const char *config_filename) +uca *uca_init(const char *config_filename) { uca_lock(); if (g_uca != NULL) { uca_unlock(); return g_uca; } - g_uca = (struct uca *) malloc(sizeof(struct uca)); + g_uca = (uca *) malloc(sizeof(uca)); g_uca->cameras = NULL; uca_grabber_init grabber_inits[] = { @@ -179,13 +179,13 @@ struct uca *uca_init(const char *config_filename) * each camera must make sure to check for such a situation. */ if (grabber != NULL) { - g_uca->grabbers = (struct uca_grabber *) malloc(sizeof(struct uca_grabber)); + g_uca->grabbers = (uca_grabber *) malloc(sizeof(uca_grabber)); g_uca->grabbers->priv = grabber; g_uca->grabbers->next = NULL; } i = 0; - struct uca_camera *current = NULL; + uca_camera *current = NULL; /* Probe each camera that is configured and append a found camera to the * linked list. */ while (cam_inits[i] != NULL) { @@ -193,13 +193,13 @@ struct uca *uca_init(const char *config_filename) uca_cam_init init = cam_inits[i]; if (init(&cam, grabber) == UCA_NO_ERROR) { if (current == NULL) { - g_uca->cameras = (struct uca_camera *) malloc(sizeof(struct uca_camera)); + g_uca->cameras = (uca_camera *) malloc(sizeof(uca_camera)); g_uca->cameras->priv = cam; g_uca->cameras->next = NULL; current = g_uca->cameras; } else { - current->next = (struct uca_camera *) malloc(sizeof(struct uca_camera)); + current->next = (uca_camera *) malloc(sizeof(uca_camera)); current->next->priv = cam; current = current->next; } @@ -218,11 +218,11 @@ struct uca *uca_init(const char *config_filename) return g_uca; } -void uca_destroy(struct uca *u) +void uca_destroy(uca *u) { uca_lock(); if (u != NULL) { - struct uca_camera *cam = u->cameras, *tmp; + uca_camera *cam = u->cameras, *tmp; struct uca_camera_priv *cam_priv; while (cam != NULL) { tmp = cam; @@ -232,7 +232,7 @@ void uca_destroy(struct uca *u) free(tmp); } - struct uca_grabber *grabber = u->grabbers, *tmpg; + uca_grabber *grabber = u->grabbers, *tmpg; struct uca_grabber_priv *grabber_priv; while (grabber != NULL) { tmpg = grabber; @@ -247,12 +247,12 @@ void uca_destroy(struct uca *u) uca_unlock(); } -uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *prop_id) +uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id) { int i = 0; while (property_map[i].name != NULL) { if (!strcmp(property_map[i].name, property_name)) { - *prop_id = (enum uca_property_ids) i; + *prop_id = (uca_property_ids) i; return UCA_NO_ERROR; } i++; @@ -260,21 +260,21 @@ uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *p return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID; } -struct uca_property *uca_get_full_property(enum uca_property_ids property_id) +uca_property *uca_get_full_property(uca_property_ids property_id) { if ((property_id >= 0) && (property_id < UCA_PROP_LAST)) return &property_map[property_id]; return NULL; } -const char* uca_get_property_name(enum uca_property_ids property_id) +const char* uca_get_property_name(uca_property_ids property_id) { if ((property_id >= 0) && (property_id < UCA_PROP_LAST)) return property_map[property_id].name; return UCA_NO_ERROR; } -uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers) +uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers) { uint32_t bitdepth; struct uca_camera_priv *priv = cam->priv; @@ -285,25 +285,25 @@ uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers) return UCA_NO_ERROR; } -enum uca_cam_state uca_cam_get_state(struct uca_camera *cam) +uca_cam_state uca_cam_get_state(uca_camera *cam) { struct uca_camera_priv *priv = cam->priv; return priv->state; } -uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids property, void *data) +uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data) { struct uca_camera_priv *priv = cam->priv; return priv->set_property(priv, property, data); } -uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids property, void *data, size_t num) +uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num) { struct uca_camera_priv *priv = cam->priv; return priv->get_property(priv, property, data, num); } -uint32_t uca_cam_start_recording(struct uca_camera *cam) +uint32_t uca_cam_start_recording(uca_camera *cam) { struct uca_camera_priv *priv = cam->priv; if (priv->state == UCA_CAM_RECORDING) @@ -315,7 +315,7 @@ uint32_t uca_cam_start_recording(struct uca_camera *cam) return err; } -uint32_t uca_cam_stop_recording(struct uca_camera *cam) +uint32_t uca_cam_stop_recording(uca_camera *cam) { struct uca_camera_priv *priv = cam->priv; if (priv->state != UCA_CAM_RECORDING) @@ -327,7 +327,7 @@ uint32_t uca_cam_stop_recording(struct uca_camera *cam) return err; } -uint32_t uca_cam_trigger(struct uca_camera *cam) +uint32_t uca_cam_trigger(uca_camera *cam) { struct uca_camera_priv *priv = cam->priv; if (priv->state != UCA_CAM_RECORDING) @@ -335,13 +335,13 @@ uint32_t uca_cam_trigger(struct uca_camera *cam) return priv->trigger(priv); } -uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user) +uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user) { struct uca_camera_priv *priv = cam->priv; return priv->register_callback(priv, callback, user); } -uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer) +uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer) { struct uca_camera_priv *priv = cam->priv; if (priv->release_buffer != NULL) @@ -349,7 +349,7 @@ uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer) return UCA_ERR_NOT_IMPLEMENTED; } -uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data) +uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data) { struct uca_camera_priv *priv = cam->priv; if ((priv->state != UCA_CAM_RECORDING) && (priv->state != UCA_CAM_READOUT)) @@ -357,7 +357,7 @@ uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data) return priv->grab(priv, buffer, meta_data); } -uint32_t uca_cam_readout(struct uca_camera *cam) +uint32_t uca_cam_readout(uca_camera *cam) { struct uca_camera_priv *priv = cam->priv; if (priv->state == UCA_CAM_RECORDING) @@ -84,7 +84,7 @@ extern "C" { /* The property IDs must start with 0 and must be continuous. Whenever this * library is released, the IDs must not change to guarantee binary compatibility! */ -enum uca_property_ids { +typedef enum { UCA_PROP_NAME = 0, UCA_PROP_WIDTH, UCA_PROP_WIDTH_MIN, @@ -141,7 +141,7 @@ enum uca_property_ids { UCA_PROP_CORRECTION_MODE, UCA_PROP_LAST -}; +} uca_property_ids; /* Possible timestamp modes for UCA_PROP_TIMESTAMP_MODE */ #define UCA_TIMESTAMP_NONE 0x00 @@ -169,7 +169,7 @@ enum uca_property_ids { * the values into their respective target value. It is also used for human * interfaces. */ -enum uca_unit { +typedef enum { uca_pixel, /**< number of pixels */ uca_bits, /**< number of bits */ uca_ns, /**< nanoseconds */ @@ -181,7 +181,7 @@ enum uca_unit { uca_dc, /**< degree celsius */ uca_bool, /**< 1 or 0 for true and false */ uca_na /**< no unit available (for example modes) */ -}; +} uca_unit; /** * The data type of this property. @@ -190,33 +190,33 @@ enum uca_unit { * must be respected and correct data transfered, as the values are * interpreted like defined here. */ -enum uca_types { +typedef enum { uca_uint32t, uca_uint8t, uca_string -}; +} uca_types; /** * Access rights determine if uca_cam_get_property() and/or * uca_cam_set_property() can be used with this property. */ -enum uca_access_rights { +typedef enum { uca_read = 0x01, /**< property can be read */ uca_write = 0x02, /**< property can be written */ uca_readwrite = 0x01 | 0x02 /**< property can be read and written */ -}; +} uca_access_rights; /** * Describes the current state of the camera. * * \see uca_cam_get_state() */ -enum uca_cam_state { +typedef enum { UCA_CAM_CONFIGURABLE, /**< Camera can be configured and is not recording */ UCA_CAM_ARMED, /**< Camera is ready for recording */ UCA_CAM_RECORDING, /**< Camera is currently recording */ UCA_CAM_READOUT /**< Camera recorded and is currently in readout mode */ -}; +} uca_cam_state; /** * Specify if the callback function keeps the buffer and will call @@ -225,10 +225,10 @@ enum uca_cam_state { * * \since 0.5 */ -enum uca_buffer_status { +typedef enum { UCA_BUFFER_KEEP, /**< Keep the buffer and call ufo_cam_release_buffer() manually */ UCA_BUFFER_RELEASE /**< Buffer is released upon return */ -}; +} uca_buffer_status; /** * A uca_property_t describes a vendor-independent property used by cameras and @@ -236,7 +236,7 @@ enum uca_buffer_status { * unit, a type and some access rights. * \see uca_get_full_property() */ -typedef struct uca_property { +typedef struct { /** * A human-readable string for this property. * @@ -247,11 +247,11 @@ typedef struct uca_property { */ const char *name; - enum uca_unit unit; - enum uca_types type; - enum uca_access_rights access; + uca_unit unit; + uca_types type; + uca_access_rights access; -} uca_property_t; +} uca_property; union uca_value { uint32_t u32; @@ -277,7 +277,7 @@ union uca_value { * * \note The meta data parameter is not yet specified but just a place holder. */ -typedef enum uca_buffer_status (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user); +typedef uca_buffer_status (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user); extern const char *uca_unit_map[]; /**< maps unit numbers to corresponding strings */ @@ -339,24 +339,24 @@ struct uca_camera_priv; * uca_camera is an opaque structure that is only accessed with the uca_cam_* * methods. */ -struct uca_camera { +typedef struct uca_camera { struct uca_camera *next; struct uca_camera_priv* priv; -}; +} uca_camera; struct uca_grabber_priv; -struct uca_grabber { +typedef struct uca_grabber { struct uca_grabber *next; struct uca_grabber_priv* priv; -}; +} uca_grabber; /** * Keeps a list of cameras and grabbers. */ -typedef struct uca { - struct uca_camera *cameras; - struct uca_grabber *grabbers; -} uca_t; +typedef struct { + uca_camera *cameras; + uca_grabber *grabbers; +} uca; /** * Initialize the unified camera access interface. @@ -369,29 +369,29 @@ typedef struct uca { * * \note uca_init() is thread-safe if a Pthread-implementation is available. */ -struct uca *uca_init(const char *config_filename); +uca *uca_init(const char *config_filename); /** * Free resources of the unified camera access interface * * \note uca_destroy() is thread-safe if a Pthread-implementation is available. */ -void uca_destroy(struct uca *u); +void uca_destroy(uca *u); /** * Convert a property string to the corresponding ID */ -uint32_t uca_get_property_id(const char *property_name, enum uca_property_ids *prop_id); +uint32_t uca_get_property_id(const char *property_name, uca_property_ids *prop_id); /** * Convert a property ID to the corresponding string */ -const char* uca_get_property_name(enum uca_property_ids property_id); +const char* uca_get_property_name(uca_property_ids property_id); /** * Return the full property structure for a given ID */ -uca_property_t *uca_get_full_property(enum uca_property_ids property_id); +uca_property *uca_get_full_property(uca_property_ids property_id); /** * Allocates buffer memory for the internal frame grabber. @@ -403,7 +403,7 @@ uca_property_t *uca_get_full_property(enum uca_property_ids property_id); * \param[in] n_buffers Number of sub-buffers with size frame_width*frame_height. * \return Error code */ -uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers); +uint32_t uca_cam_alloc(uca_camera *cam, uint32_t n_buffers); /** * Retrieve current state of the camera. @@ -412,7 +412,7 @@ uint32_t uca_cam_alloc(struct uca_camera *cam, uint32_t n_buffers); * \return A value from the uca_cam_state enum representing the current state of * the camera. */ -enum uca_cam_state uca_cam_get_state(struct uca_camera *cam); +uca_cam_state uca_cam_get_state(uca_camera *cam); /** @@ -426,7 +426,7 @@ enum uca_cam_state uca_cam_get_state(struct uca_camera *cam); * \return UCA_ERR_PROP_INVALID if property is not supported on the camera or * UCA_ERR_PROP_VALUE_OUT_OF_RANGE if value cannot be set. */ -uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids property, void *data); +uint32_t uca_cam_set_property(uca_camera *cam, uca_property_ids property, void *data); /** * Get a property. @@ -439,7 +439,7 @@ uint32_t uca_cam_set_property(struct uca_camera *cam, enum uca_property_ids prop * * \return UCA_ERR_PROP_INVALID if property is not supported on the camera */ -uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids property, void *data, size_t num); +uint32_t uca_cam_get_property(uca_camera *cam, uca_property_ids property, void *data, size_t num); /** * Begin recording. @@ -450,7 +450,7 @@ uint32_t uca_cam_get_property(struct uca_camera *cam, enum uca_property_ids prop * \param[in] cam A uca_camera object * \return Error code */ -uint32_t uca_cam_start_recording(struct uca_camera *cam); +uint32_t uca_cam_start_recording(uca_camera *cam); /** * Stop recording. @@ -458,18 +458,18 @@ uint32_t uca_cam_start_recording(struct uca_camera *cam); * \param[in] cam A uca_camera object * \return Error code */ -uint32_t uca_cam_stop_recording(struct uca_camera *cam); +uint32_t uca_cam_stop_recording(uca_camera *cam); /** * Send a software trigger signal to start a sensor read-out. * - * This method is only useful when UCA_PROP_TRIGGER_MODE is set to - * UCA_TRIGGER_SOFTWARE. + * This method is only useful when #UCA_PROP_TRIGGER_MODE is set to + * #UCA_TRIGGER_SOFTWARE. * * \param[in] cam A uca_camera object * \return Error code */ -uint32_t uca_cam_trigger(struct uca_camera *cam); +uint32_t uca_cam_trigger(uca_camera *cam); /** * Register callback for given frame grabber. To actually start receiving @@ -480,7 +480,7 @@ uint32_t uca_cam_trigger(struct uca_camera *cam); * \param[in] user User data that is passed to the callback function * \return Error code */ -uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user); +uint32_t uca_cam_register_callback(uca_camera *cam, uca_cam_grab_callback callback, void *user); /** * Release the buffer that was given in the grab callback. @@ -491,7 +491,7 @@ uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback * \see uca_cam_register_callback(), uca_cam_grab_callback * \since 0.5 */ -uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer); +uint32_t uca_cam_release_buffer(uca_camera *cam, void *buffer); /** * \brief Grab one image from the camera @@ -508,7 +508,7 @@ uint32_t uca_cam_release_buffer(struct uca_camera *cam, void *buffer); * \note The meta data parameter is not yet specified but just a place holder. * */ -uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data); +uint32_t uca_cam_grab(uca_camera *cam, char *buffer, void *meta_data); /** * \brief Initiate read out for recording based cameras like pco.dimax or @@ -521,7 +521,7 @@ uint32_t uca_cam_grab(struct uca_camera *cam, char *buffer, void *meta_data); * \param[in] cam A uca_camera object * \return Error code */ -uint32_t uca_cam_readout(struct uca_camera *cam); +uint32_t uca_cam_readout(uca_camera *cam); #define uca_set_void(p, type, value) { *((type *) p) = (type) value; } |