diff options
author | Alex Ray <aray@google.com> | 2013-07-03 17:54:19 -0700 |
---|---|---|
committer | Alex Ray <aray@google.com> | 2013-10-17 16:50:48 -0700 |
commit | 61f7a0c1c1aa481d798116e5a218df04630886e6 (patch) | |
tree | f402943f42231adf3ed56edb22947ea6a8f08d5f /modules/camera/Camera.h | |
parent | f75ccb96b103c70199fe84d2b9ff0a9d027e326e (diff) | |
download | hardware_libhardware-61f7a0c1c1aa481d798116e5a218df04630886e6.zip hardware_libhardware-61f7a0c1c1aa481d798116e5a218df04630886e6.tar.gz hardware_libhardware-61f7a0c1c1aa481d798116e5a218df04630886e6.tar.bz2 |
modules: camera: Abstract device-specific camera
ExampleCamera represents a specific (e.g. front or back) camera device,
and contains all the device and logic for that device/sensor.
Change-Id: Iecc1a1d905501a66edb6e3994ff93d8761b82f8b
Diffstat (limited to 'modules/camera/Camera.h')
-rw-r--r-- | modules/camera/Camera.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/modules/camera/Camera.h b/modules/camera/Camera.h index be672f9..53672ae 100644 --- a/modules/camera/Camera.h +++ b/modules/camera/Camera.h @@ -28,12 +28,14 @@ namespace default_camera_hal { // This is constructed when the HAL module is loaded, one per physical camera. // It is opened by the framework, and must be closed before it can be opened // again. +// This is an abstract class, containing all logic and data shared between all +// camera devices (front, back, etc) and common to the ISP. class Camera { public: // id is used to distinguish cameras. 0 <= id < NUM_CAMERAS. // module is a handle to the HAL module, used when the device is opened. Camera(int id); - ~Camera(); + virtual ~Camera(); // Common Camera Device Operations (see <hardware/camera_common.h>) int open(const hw_module_t *module, hw_device_t **device); @@ -49,12 +51,20 @@ class Camera { void getMetadataVendorTagOps(vendor_tag_query_ops_t *ops); void dump(int fd); - // Camera device handle returned to framework for use - camera3_device_t mDevice; + + protected: + // Initialize static camera characteristics for individual device + virtual camera_metadata_t *initStaticInfo() = 0; + // Verify settings are valid for a capture + virtual bool isValidCaptureSettings(const camera_metadata_t *) = 0; + // Separate initialization method for individual devices when opened + virtual int initDevice() = 0; + // Accessor used by initDevice() + void setTemplate(int type, camera_metadata_t *static_info); private: - // Separate initialization method for static metadata - camera_metadata_t *initStaticInfo(); + // Camera device handle returned to framework for use + camera3_device_t mDevice; // Reuse a stream already created by this device Stream *reuseStream(camera3_stream_t *astream); // Destroy all streams in a stream array, and the array itself @@ -65,8 +75,6 @@ class Camera { void setupStreams(Stream **array, int count); // Copy new settings for re-use and clean up old settings. void setSettings(const camera_metadata_t *new_settings); - // Verify settings are valid for a capture - bool isValidCaptureSettings(const camera_metadata_t *settings); // Verify settings are valid for reprocessing an input buffer bool isValidReprocessSettings(const camera_metadata_t *settings); // Process an output buffer @@ -74,6 +82,8 @@ class Camera { camera3_stream_buffer_t *out); // Send a shutter notify message with start of exposure time void notifyShutter(uint32_t frame_number, uint64_t timestamp); + // Is type a valid template type (and valid index into mTemplates) + bool isValidTemplateType(int type); // Identifier used by framework to distinguish cameras const int mId; @@ -97,7 +107,7 @@ class Camera { // Number of streams in mStreams int mNumStreams; // Static array of standard camera settings templates - Metadata *mTemplates[CAMERA3_TEMPLATE_COUNT]; + camera_metadata_t *mTemplates[CAMERA3_TEMPLATE_COUNT]; // Most recent request settings seen, memoized to be reused camera_metadata_t *mSettings; }; |