diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-02-03 11:09:54 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-02-03 11:09:54 +0100 |
commit | c9c94390c520ad496082222858c0f1285f1432df (patch) | |
tree | e0cec60e2e99a7eba3dca63399054f89097f8d9a /src/uca.h | |
parent | 6461f2e549876cb54456925f47094bb53e2c8672 (diff) | |
download | libuca-c9c94390c520ad496082222858c0f1285f1432df.tar.gz libuca-c9c94390c520ad496082222858c0f1285f1432df.tar.bz2 libuca-c9c94390c520ad496082222858c0f1285f1432df.tar.xz libuca-c9c94390c520ad496082222858c0f1285f1432df.zip |
Callback function have to notify caller about buffer
If they return a UCA_BUFFER_KEEP they have to call uca_cam_release_buffer() in
the future. If returning UCA_BUFFER_RELEASE, this is done by the caller.
Diffstat (limited to 'src/uca.h')
-rw-r--r-- | src/uca.h | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -216,6 +216,15 @@ enum uca_cam_state { UCA_CAM_READOUT /**< Camera recorded and is currently in readout mode */ }; +/** + * Specify if the callback function keeps the buffer and will call + * ufo_cam_release_buffer() at later time or if after returning the buffer can + * be released automatically. + */ +enum uca_buffer_status { + UCA_BUFFER_KEEP, + UCA_BUFFER_RELEASE +}; /** * A uca_property_t describes a vendor-independent property used by cameras and @@ -253,14 +262,14 @@ union uca_value { * receive data as soon as it is delivered. * * \param[in] image_number Current frame number - * \param[in] buffer Image data + * \param[in] buffer Image data. * \param[in] meta_data Meta data provided by the camera specifying per-frame * data. * \param[in] user User data registered in uca_cam_register_callback() * * \note The meta data parameter is not yet specified but just a place holder. */ -typedef void (*uca_cam_grab_callback) (uint64_t image_number, void *buffer, void *meta_data, void *user); +typedef enum 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 */ @@ -454,7 +463,6 @@ uint32_t uca_cam_stop_recording(struct uca_camera *cam); */ uint32_t uca_cam_trigger(struct uca_camera *cam); - /** * Register callback for given frame grabber. To actually start receiving * frames, call uca_grabber_acquire(). @@ -467,6 +475,17 @@ uint32_t uca_cam_trigger(struct uca_camera *cam); uint32_t uca_cam_register_callback(struct uca_camera *cam, uca_cam_grab_callback callback, void *user); /** + * Release the buffer that was given in the grab callback. + * + * \param[in] cam A uca_camera object + * \param[in] buffer The buffer that was passed to the 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); + +/** * \brief Grab one image from the camera * * The grabbing involves a memory copy because we might have to decode the image |