/* Copyright (C) 2011, 2012 Matthias Vogelgesang (Karlsruhe Institute of Technology) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA */ #ifndef __UNIFIED_CAMERA_ACCESS_CAM_H #define __UNIFIED_CAMERA_ACCESS_CAM_H #include #ifdef __cplusplus extern "C" { #endif /** * \file uca-cam.h * \brief Abstract camera model * * The uca_camera_priv_t structure represents a common interface for cameras regardless of * their connectivity. Each camera that adheres to this model must provide an * initialization function implementing uca_cam_init() that probes the device * and sets all function pointers to their respective implementations. */ enum uca_property_ids; /* * --- non-virtual methods ---------------------------------------------------- */ typedef uint32_t (*uca_cam_init) (struct uca_camera_priv **cam, struct uca_grabber_priv *grabber); /** * Allocates memory for a new uca_camera_priv structure and initializes all fields to * sane values. * * \return Pointer to block of memory for a uca_camera_priv structure * * \note This is is a utility function used internally by drivers */ struct uca_camera_priv *uca_cam_new(void); /** * Represents a camera abstraction, that concrete cameras must implement. */ 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 (*start_recording) (struct uca_camera_priv *cam); uint32_t (*stop_recording) (struct uca_camera_priv *cam); uint32_t (*trigger) (struct uca_camera_priv *cam); uint32_t (*register_callback) (struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user); uint32_t (*grab) (struct uca_camera_priv *cam, char *buffer, void *meta_data); 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 */ uint32_t frame_width; /**< current frame width */ uint32_t frame_height; /**< current frame height */ uint64_t current_frame; /**< last grabbed frame number */ uca_cam_grab_callback callback; void *callback_user; /**< user data for callback */ void *user; /**< private user data to be used by the camera driver */ } uca_camera_priv_t; #ifdef __cplusplus } #endif #endif