diff options
author | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-17 15:38:38 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de> | 2011-03-17 15:38:38 +0100 |
commit | 6de83f98c5f4d5fb696f413aa9dbe49ab4515661 (patch) | |
tree | 50095a8f5d39e6c2ad4fa91e06940873e9f1993c /src/uca-cam.h | |
parent | 65a2016becbb165afa4fdf16742f3586f83d0f30 (diff) | |
download | uca-6de83f98c5f4d5fb696f413aa9dbe49ab4515661.tar.gz uca-6de83f98c5f4d5fb696f413aa9dbe49ab4515661.tar.bz2 uca-6de83f98c5f4d5fb696f413aa9dbe49ab4515661.tar.xz uca-6de83f98c5f4d5fb696f413aa9dbe49ab4515661.zip |
Expose grab-by-callback via camera and add asynchronous grabbing example
Diffstat (limited to 'src/uca-cam.h')
-rw-r--r-- | src/uca-cam.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/uca-cam.h b/src/uca-cam.h index 822f011..ca80ec9 100644 --- a/src/uca-cam.h +++ b/src/uca-cam.h @@ -129,6 +129,28 @@ typedef uint32_t (*uca_cam_start_recording) (struct uca_camera *cam); typedef uint32_t (*uca_cam_stop_recording) (struct uca_camera *cam); /** + * Function pointer to a grab callback. + * + * Register such a callback function with uca_cam_register_callback() to + * receive data as soon as it is delivered. + * + * \param[in] image_number Current frame number + * + * \param[in] buffer Image data + */ +typedef void (*uca_cam_grab_callback) (uint32_t image_number, void *buffer); + +/** + * Register callback for given frame grabber. To actually start receiving + * frames, call uca_grabber_acquire(). + * + * \param[in] grabber The grabber for which the callback should be installed + * + * \param[in] cb Callback function for when a frame arrived + */ +typedef uint32_t (*uca_cam_register_callback) (struct uca_camera *cam, uca_cam_grab_callback cb); + +/** * \brief Grab one image from the camera * * The grabbing involves a memory copy because we might have to decode the image @@ -182,6 +204,13 @@ typedef struct uca_camera { */ uca_cam_grab grab; + /** + * Method to register an frame acquisition callback. + * + * \see uca_cam_register_callback + */ + uca_cam_register_callback register_callback; + /* Private */ /** * Method to close the camera. @@ -189,11 +218,13 @@ typedef struct uca_camera { */ uca_cam_destroy destroy; - struct uca_grabber *grabber; /**< grabber associated with this camera */ - enum uca_cam_state state; /**< camera state */ + /* private */ + struct uca_grabber *grabber; /**< grabber associated with this camera */ + enum uca_cam_state state; /**< camera state */ uint32_t frame_width; /**< current frame width */ uint32_t frame_height; /**< current frame height */ uint32_t current_frame; /**< last grabbed frame number */ + uca_cam_grab_callback callback; void *user; /**< private user data to be used by the camera driver */ } uca_camera_t; |