camera_module Struct Reference

#include <camera_common.h>

Data Fields

hw_module_t common
 
int(* get_number_of_cameras )(void)
 
int(* get_camera_info )(int camera_id, struct camera_info *info)
 
int(* set_callbacks )(const camera_module_callbacks_t *callbacks)
 
void(* get_vendor_tag_ops )(vendor_tag_ops_t *ops)
 
int(* open_legacy )(const struct hw_module_t *module, const char *id, uint32_t halVersion, struct hw_device_t **device)
 
int(* set_torch_mode )(const char *camera_id, bool enabled)
 
int(* init )()
 
void * reserved [5]
 

Detailed Description

Definition at line 646 of file camera_common.h.

Field Documentation

hw_module_t common

Common methods of the camera module. This must be the first member of camera_module as users of this structure will cast a hw_module_t to camera_module pointer in contexts where it's known the hw_module_t references a camera_module.

The return values for common.methods->open for camera_module are:

0: On a successful open of the camera device.

-ENODEV: The camera device cannot be opened due to an internal error.

-EINVAL: The input arguments are invalid, i.e. the id is invalid, and/or the module is invalid.

-EBUSY: The camera device was already opened for this camera id (by using this method or open_legacy), regardless of the device HAL version it was opened as.

-EUSERS: The maximal number of camera devices that can be opened concurrently were opened already, either by this method or the open_legacy method.

All other return values from common.methods->open will be treated as -ENODEV.

Definition at line 674 of file camera_common.h.

int(* get_camera_info)(int camera_id, struct camera_info *info)

get_camera_info:

Return the static camera information for a given camera device. This information may not change for a camera device.

Return values:

0: On a successful operation

-ENODEV: The information cannot be provided due to an internal error.

-EINVAL: The input arguments are invalid, i.e. the id is invalid, and/or the module is invalid.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_2_4 or higher:

When a camera is disconnected, its camera id becomes invalid. Calling this this method with this invalid camera id will get -EINVAL and NULL camera static metadata (camera_info.static_camera_characteristics).

Definition at line 727 of file camera_common.h.

int(* get_number_of_cameras)(void)

get_number_of_cameras:

Returns the number of camera devices accessible through the camera module. The camera devices are numbered 0 through N-1, where N is the value returned by this call. The name of the camera device for open() is simply the number converted to a string. That is, "0" for camera ID 0, "1" for camera ID 1.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_2_3 or lower:

The value here must be static, and cannot change after the first call to this method.

CAMERA_MODULE_API_VERSION_2_4 or higher:

The value here must be static, and must count only built-in cameras, which have CAMERA_FACING_BACK or CAMERA_FACING_FRONT camera facing values (camera_info.facing). The HAL must not include the external cameras (camera_info.facing == CAMERA_FACING_EXTERNAL) into the return value of this call. Frameworks will use camera_device_status_change callback to manage number of external cameras.

Definition at line 701 of file camera_common.h.

void(* get_vendor_tag_ops)(vendor_tag_ops_t *ops)

get_vendor_tag_ops:

Get methods to query for vendor extension metadata tag information. The HAL should fill in all the vendor tag operation methods, or leave ops unchanged if no vendor tags are defined.

The vendor_tag_ops structure used here is defined in: system/media/camera/include/system/vendor_tags.h

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_1_x/2_0/2_1: Not provided by HAL module. Framework may not call this function.

CAMERA_MODULE_API_VERSION_2_2: Valid to be called by the framework.

Definition at line 778 of file camera_common.h.

int(* init)()

init:

This method is called by the camera service before any other methods are invoked, right after the camera HAL library has been successfully loaded. It may be left as NULL by the HAL module, if no initialization in needed.

It can be used by HAL implementations to perform initialization and other one-time operations.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3: Not provided by HAL module. Framework will not call this function.

CAMERA_MODULE_API_VERSION_2_4: If not NULL, will always be called by the framework once after the HAL module is loaded, before any other HAL module method is called.

Return values:

0: On a successful operation.

-ENODEV: Initialization cannot be completed due to an internal error. The HAL must be assumed to be in a nonfunctional state.

Definition at line 909 of file camera_common.h.

int(* open_legacy)(const struct hw_module_t *module, const char *id, uint32_t halVersion, struct hw_device_t **device)

open_legacy:

Open a specific legacy camera HAL device if multiple device HAL API versions are supported by this camera HAL module. For example, if the camera module supports both CAMERA_DEVICE_API_VERSION_1_0 and CAMERA_DEVICE_API_VERSION_3_2 device API for the same camera id, framework can call this function to open the camera device as CAMERA_DEVICE_API_VERSION_1_0 device.

This is an optional method. A Camera HAL module does not need to support more than one device HAL version per device, and such modules may return -ENOSYS for all calls to this method. For all older HAL device API versions that are not supported, it may return -EOPNOTSUPP. When above cases occur, The normal open() method (common.methods->open) will be used by the framework instead.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2: Not provided by HAL module. Framework will not call this function.

CAMERA_MODULE_API_VERSION_2_3: Valid to be called by the framework.

Return values:

0: On a successful open of the camera device.

-ENOSYS This method is not supported.

-EOPNOTSUPP: The requested HAL version is not supported by this method.

-EINVAL: The input arguments are invalid, i.e. the id is invalid, and/or the module is invalid.

-EBUSY: The camera device was already opened for this camera id (by using this method or common.methods->open method), regardless of the device HAL version it was opened as.

-EUSERS: The maximal number of camera devices that can be opened concurrently were opened already, either by this method or common.methods->open method.

Definition at line 824 of file camera_common.h.

void* reserved[5]

Definition at line 912 of file camera_common.h.

int(* set_callbacks)(const camera_module_callbacks_t *callbacks)

set_callbacks:

Provide callback function pointers to the HAL module to inform framework of asynchronous camera module events. The framework will call this function once after initial camera HAL module load, after the get_number_of_cameras() method is called for the first time, and before any other calls to the module.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_1_0, CAMERA_MODULE_API_VERSION_2_0:

Not provided by HAL module. Framework may not call this function.

CAMERA_MODULE_API_VERSION_2_1:

Valid to be called by the framework.

Return values:

0: On a successful operation

-ENODEV: The operation cannot be completed due to an internal error.

-EINVAL: The input arguments are invalid, i.e. the callbacks are null

Definition at line 758 of file camera_common.h.

int(* set_torch_mode)(const char *camera_id, bool enabled)

set_torch_mode:

Turn on or off the torch mode of the flash unit associated with a given camera ID. If the operation is successful, HAL must notify the framework torch state by invoking camera_module_callbacks.torch_mode_status_change() with the new state.

The camera device has a higher priority accessing the flash unit. When there are any resource conflicts, such as open() is called to open a camera device, HAL module must notify the framework through camera_module_callbacks.torch_mode_status_change() that the torch mode has been turned off and the torch mode state has become TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode become available again, HAL module must notify the framework through camera_module_callbacks.torch_mode_status_change() that the torch mode state has become TORCH_MODE_STATUS_AVAILABLE_OFF for set_torch_mode() to be called.

When the framework calls set_torch_mode() to turn on the torch mode of a flash unit, if HAL cannot keep multiple torch modes on simultaneously, HAL should turn off the torch mode that was turned on by a previous set_torch_mode() call and notify the framework that the torch mode state of that flash unit has become TORCH_MODE_STATUS_AVAILABLE_OFF.

Version information (based on camera_module_t.common.module_api_version):

CAMERA_MODULE_API_VERSION_1_x/2_0/2_1/2_2/2_3: Not provided by HAL module. Framework will not call this function.

CAMERA_MODULE_API_VERSION_2_4: Valid to be called by the framework.

Return values:

0: On a successful operation.

-ENOSYS: The camera device does not support this operation. It is returned if and only if android.flash.info.available is false.

-EBUSY: The camera device is already in use.

-EUSERS: The resources needed to turn on the torch mode are not available, typically because other camera devices are holding the resources to make using the flash unit not possible.

-EINVAL: camera_id is invalid.

Definition at line 878 of file camera_common.h.


The documentation for this struct was generated from the following file: