Camera
APIs for accessing Camera Device and to do Camera Capture. More...
Classes
Name | |
---|---|
struct | MLCameraMRConnectInfo |
struct | MLCameraConnectContext |
struct | MLCameraCaptureStreamCaps A structure to encapsulate stream capabilities. |
struct | MLCameraCaptureStreamConfig |
struct | MLCameraCaptureConfig |
struct | MLCameraPlaneInfo |
struct | MLCameraOutput |
struct | MLCameraIntrinsicCalibrationParameters Camera intrinsic parameter. |
struct | MLCameraResultExtras |
struct | MLCameraDeviceAvailabilityInfo |
struct | MLCameraDeviceAvailabilityStatusCallbacks |
struct | MLCameraDeviceStatusCallbacks |
struct | MLCameraCaptureCallbacks Capture callbacks to be implemented by client to receive capture status if callback mechanism is used. |
Types
Enums
Functions
Name | |
---|---|
void | MLCameraConnectContextInit(MLCameraConnectContext * inout_context) Initialize the connect context structure. |
void | MLCameraCaptureConfigInit(MLCameraCaptureConfig * inout_config) Initialize the capture config structure. |
void | MLCameraDeviceAvailabilityStatusCallbacksInit(MLCameraDeviceAvailabilityStatusCallbacks * inout_device_availability_status_callbacks) Initialize the callback structure. |
void | MLCameraDeviceStatusCallbacksInit(MLCameraDeviceStatusCallbacks * inout_device_status_callbacks) Initialize the callback structure. |
void | MLCameraCaptureCallbacksInit(MLCameraCaptureCallbacks * inout_capture_callbacks) Initialize the callback structure. |
MLResult | MLCameraInit(const MLCameraDeviceAvailabilityStatusCallbacks device_availability_status_callbacks, void user_data) Initialize ML Camera API, Register callback for device availability. If the user does not want to register device availability listener, MLCameraConnect can be called directly without MLCameraInit(). MLCameraDeInit should be used for unregistering callbacks and releasing resources acquired in MLCameraInit(). |
MLResult | MLCameraConnect(const MLCameraConnectContext input_context, MLCameraContext out_context) Connect to camera device. |
MLResult | MLCameraGetNumSupportedStreams(MLCameraContext context, uint32_t * out_num_supported_streams) Query the no of streams supported by camera device. |
MLResult | MLCameraGetStreamCaps(MLCameraContext context, const uint32_t stream_index, uint32_t inout_num_stream_caps, MLCameraCaptureStreamCaps inout_stream_caps) Query the stream capabilities. |
MLResult | MLCameraDisconnect(MLCameraContext context) Disconnect from camera device. |
MLResult | MLCameraDeInit() Uninitialize ML Camera API, unregister callback for device availability. Should be called after all camera devices are disconnected. After MLCameraDeInit, MLCameraInit can be called or MLCameraConnect can be called. |
MLResult | MLCameraPreCaptureAEAWB(MLCameraContext context) Trigger AEAWB Convergence. |
MLResult | MLCameraPrepareCapture(MLCameraContext context, const MLCameraCaptureConfig config, MLHandle out_request_handle) Prepare for capture. |
MLResult | MLCameraUpdateCaptureSettings(MLCameraContext context) Update capture setting. |
MLResult | MLCameraSetDeviceStatusCallbacks(MLCameraContext context, const MLCameraDeviceStatusCallbacks device_status_callbacks, void data) Set the client-implemented callbacks to convey camera device status. |
MLResult | MLCameraSetCaptureCallbacks(MLCameraContext context, const MLCameraCaptureCallbacks capture_callbacks, void data) Set the client-implemented callbacks to convey capture status. |
MLResult | MLCameraCaptureImage(MLCameraContext context, uint32_t num_images) Capture still image. |
MLResult | MLCameraCaptureVideoStart(MLCameraContext context) Start video capture. Capture either encoded video or YUV/RGBA frames. |
MLResult | MLCameraCapturePreviewStart(MLCameraContext context) Start preview provide raw frames through callback. |
MLResult | MLCameraCaptureVideoStop(MLCameraContext context) Stop video capture. |
MLResult | MLCameraCapturePreviewStop(MLCameraContext context) Stop preview. |
MLResult | MLCameraGetDeviceStatus(MLCameraContext context, uint32_t * out_device_status) Poll camera device status. |
MLResult | MLCameraGetDeviceAvailabilityStatus(MLCameraIdentifier cam_id, bool * out_device_availability_status) Poll camera device availability status. |
MLResult | MLCameraGetErrorCode(MLCameraContext context, MLCameraError * out_error_code) Obtain camera device error code. |
MLResult | MLCameraGetCameraCharacteristics(MLCameraContext context, MLHandle * out_characteristics_handle) Obtains handle for retrieving camera characteristics. |
Detailed Description
APIs for accessing Camera Device and to do Camera Capture.
Supported Camera Modes, Resolutions, Capture Type, Formats and FrameRates
Camera | Mode | Resolution | Capture Type | Formats | FrameRate |
---|---|---|---|---|---|
Main | Cam_Only | 640x480 1280x720 1280x960 1440x1080 1920x1080 2048x1536 | Preview | YUV | 15/30/60 |
Image | YUV/JPEG | 15/30/60 | |||
Video | YUV/RGB/Compressed | 15/30/60 | |||
2880x2160 3840x2160 4096x3072 | Preview | YUV | 15/30 | ||
Image | YUV/JPEG | 15/30 | |||
Video | YUV/RGB/Compressed | 15/30 |
Note:
15Fps only supported in Auto Exposure Mode.
When multiple streams are configured frame rate is constrained by max resolution.
FrameRate_None can be used when only Image capture_type is used.
Camera | Mode | Resolution | Capture Type | Formats | FrameRate |
---|---|---|---|---|---|
CV | Cam_Only | 640x480 1280x720 1280x960 1440x1080 1920x1080 2048x1536 | Image | YUV | 15/30/60 |
Video | YUV/RGB | 15/30/60 | |||
2880x2160 3840x2160 4096x3072 | Image | YUV | 15/30 | ||
Video | YUV/RGB | 15/30 |
Note:
15Fps only supported in Auto Exposure Mode
FrameRate_None can be used when only Image capture_type is used.
Camera | Mode | Resolution | Capture Type | Formats | FrameRate |
---|---|---|---|---|---|
Main | MR/Virtual_Only | 648x720 | Image | RBG/JPEG | 30/60 |
Video | RGB/Compressed | 30/60 | |||
960x720 | Image | RBG/JPEG | 30/60 | ||
Video | RGB/Compressed | 30/60 | |||
972x1080 | Image | RBG/JPEG | 30/60 | ||
Video | RGB/Compressed | 30/60 | |||
1440x1080 | Image | RBG/JPEG | 30/60 | ||
Video | RGB/Compressed | 30/60 | |||
1944x2160 | Image | RBG/JPEG | 30 | ||
Video | RGB/Compressed | 30 | |||
2880x2160 | Image | RBG/JPEG | 30 | ||
Video | RGB/Compressed | 30 |
Note: Quality and frame rate provided during connection should match the resolution and framerate in PrepareCapture.
Stringify the error codes returned by these APIs, call MLMediaResultGetString.
THIS API IS DEPRECATED IN FAVOR OF STANDARD ANDROID SDK AND NDK CAMERA APIs: https://developer.android.com/training/camera2https://developer.android.com/ndk/reference/group/camera
Shared Object:
- camera.magicleap*
Enums Documentation
Anonymous Enum 4
Enumerator | Value | Description |
---|---|---|
MLCAMERA_MAXSTREAMS | 2 | Max No of streams supported by logical camera. |
MLCameraIdentifier
Enumerator | Value | Description |
---|---|---|
MLCameraIdentifier_MAIN | 0 | x86 logical camera. |
MLCameraIdentifier_CV | CV logical camera. | |
MLCameraIdentifier_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Logical camera identifiers available for access.
MLCameraCaptureType
Enumerator | Value | Description |
---|---|---|
MLCameraCaptureType_Image | 0 | To capture an image. |
MLCameraCaptureType_Video | To capture a video. | |
MLCameraCaptureType_Preview | To capture a video and access the raw buffer of the frames. | |
MLCameraCaptureType_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Captures operation type.
MLCameraCaptureFrameRate
Enumerator | Value | Description |
---|---|---|
MLCameraCaptureFrameRate_None | 0 | None, used for still capture. |
MLCameraCaptureFrameRate_15FPS | Specified 15FPS. | |
MLCameraCaptureFrameRate_30FPS | Specified 30FPS. | |
MLCameraCaptureFrameRate_60FPS | Specified 60FPS. | |
MLCameraCaptureFrameRate_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Captures frame rate.
Call MLCameraPrepareCapture() to configure frame rate. Use MLCameraCaptureFrameRate_None when configuring only Image capture. Use MLCameraCaptureFrameRate_60fps only when resolution of captures <= 3MP(2048x1536). Use MLCameraCaptureFrameRate_15FPS only when MLCameraConnectFlag is MLCameraConnectFlag_CamOnly.
MLCameraMRQuality
Enumerator | Value | Description |
---|---|---|
MLCameraMRQuality_648x720 | 1 | Specifies 648 x 720 resolution. Aspect ratio: 9x10. |
MLCameraMRQuality_972x1080 | 2 | Specifies 972 x 1080 resolution. Aspect ratio: 9x10. |
MLCameraMRQuality_1944x2160 | 3 | Specifies 1944 x 2160 resolution. Aspect ratio: 9x10. MLCameraCaptureFrameRate_60FPS is not supported for this quality mode. |
MLCameraMRQuality_960x720 | 4 | Specifies 960 x 720 resolution. Aspect ratio: 4x3. |
MLCameraMRQuality_1440x1080 | 5 | Specifies 1440 x 1080 resolution. Aspect ratio: 4x3. |
MLCameraMRQuality_2880x2160 | 6 | Specifies 2880 x 2160 resolution. Aspect ratio: 4x3. MLCameraCaptureFrameRate_60FPS is not supported for this quality mode. |
MLCameraMRQuality_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Video Quality enumeration for mixed reality capture.
Use MLCameraGetStreamCaps to get the resolution.
MLCameraConnectFlag
Enumerator | Value | Description |
---|---|---|
MLCameraConnectFlag_CamOnly | 0x0 | Camera only frame capture. |
MLCameraConnectFlag_VirtualOnly | 0x1 | Virtual only capture. Only supported for MLCameraIdentifier_MAIN. |
MLCameraConnectFlag_MR | 0x2 | Mixed Reality capture. Only supported for MLCameraIdentifier_MAIN. |
MLCameraConnectFlag_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Flags to describe various modules in camera pipeline.
MLCameraMRBlendType
Enumerator | Value | Description |
---|---|---|
MLCameraMRBlendType_Additive | 1 | Additive blend type. It simply adds pixel values of real world and virtual layer. |
MLCameraMRBlendType_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Virtual and real content blending modes.
MLCameraDisconnectReason
Enumerator | Value | Description |
---|---|---|
MLCameraDisconnect_DeviceLost | 0 | Device lost. |
MLCameraDisconnect_PriorityLost | Priority lost. | |
MLCameraDisconnect_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Camera disconnect reason.
MLCameraError
Enumerator | Value | Description |
---|---|---|
MLCameraError_None | 0 | |
MLCameraError_Invalid | Invalid/Unknown Error. | |
MLCameraError_Disabled | Camera disabled. | |
MLCameraError_DeviceFailed | Camera device failed. | |
MLCameraError_ServiceFailed | Camera service failed. | |
MLCameraError_CaptureFailed | Capture failed. | |
MLCameraError_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Camera errors.
MLCameraOutputFormat
Enumerator | Value | Description |
---|---|---|
MLCameraOutputFormat_Unknown | ||
MLCameraOutputFormat_YUV_420_888 | YUV planar format. | |
MLCameraOutputFormat_JPEG | Compressed output stream. | |
MLCameraOutputFormat_RGBA_8888 | RGB32 format. | |
MLCameraOutputFormat_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Captured output format. These three parameters determine which formats are supported:
- Camera type: [Main, CV].
- Mode: [Real, MR, Virtual].
- Capture type: [Preview, Video, Image]. These are formats supported:
Format | Camera Type | Mode | Capture Type |
---|---|---|---|
YUV | Main CV | Real Real | Preview, Video, Image Video, Image |
RGBA | Main Main CR | Real MR, Virtual Real | Video Video, Image Video |
JPEG | Main | Real, MR, Virtual | Image |
MLCameraDeviceStatusFlag
Enumerator | Value | Description |
---|---|---|
MLCameraDeviceStatusFlag_Connected | 1 << 0 | Connected. |
MLCameraDeviceStatusFlag_Idle | 1 << 1 | Idle. |
MLCameraDeviceStatusFlag_Streaming | 1 << 2 | Opened. |
MLCameraDeviceStatusFlag_Disconnected | 1 << 3 | Disconnected. |
MLCameraDeviceStatusFlag_Error | 1 << 4 | Error. Call MLCameraGetErrorCode to obtain the error code. |
MLCameraDeviceStatusFlag_Ensure32Bits | 0x7FFFFFFF | Ensure enum is represented as 32 bits. |
Client can implement polling mechanism to retrieve device status and use these masks to view device status.
Anonymous Enum 5
Enumerator | Value | Description |
---|---|---|
MLCamera_MaxImagePlanes | 3 | Number of planes representing the image color space. |
Anonymous Enum 6
Enumerator | Value | Description |
---|---|---|
MLCameraIntrinsics_MaxDistortionCoefficients | 5 | Default distortion vector size. |
Camera distortion vector size.
API Level:
- 20
Types Documentation
MLCameraContext
typedef MLHandle MLCameraContext;
Camera context to be used while connecting to camera.
MLCameraMRConnectInfo
typedef struct MLCameraMRConnectInfo MLCameraMRConnectInfo;
A structure to encapsulate connection settings for MR capture.
MLCameraConnectContext
typedef struct MLCameraConnectContext MLCameraConnectContext;
A structure to encapsulate context for a CameraConnect Request.
MLCameraCaptureStreamCaps
typedef struct MLCameraCaptureStreamCaps MLCameraCaptureStreamCaps;
A structure to encapsulate stream capabilities.
The capabilities for each stream supported by logical camera device can be queried with MLCameraGetStreamCaps.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureStreamConfig
typedef struct MLCameraCaptureStreamConfig MLCameraCaptureStreamConfig;
A structure to encapsulate stream configurations.
MLCameraCaptureConfig
typedef struct MLCameraCaptureConfig MLCameraCaptureConfig;
A structure to encapsulate capture configuration.
MLCameraPlaneInfo
typedef struct MLCameraPlaneInfo MLCameraPlaneInfo;
Per plane info for captured output.
MLCameraOutput
typedef struct MLCameraOutput MLCameraOutput;
A structure to encapsulate captured output.
MLCameraIntrinsicCalibrationParameters
typedef struct MLCameraIntrinsicCalibrationParameters MLCameraIntrinsicCalibrationParameters;
Camera intrinsic parameter.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraResultExtras
typedef struct MLCameraResultExtras MLCameraResultExtras;
A structure to encapsulate various indices for a capture result.
MLCameraDeviceAvailabilityInfo
typedef struct MLCameraDeviceAvailabilityInfo MLCameraDeviceAvailabilityInfo;
A structure to represent info on camera availability.
MLCameraDeviceAvailabilityStatusCallbacks
typedef struct MLCameraDeviceAvailabilityStatusCallbacks MLCameraDeviceAvailabilityStatusCallbacks;
Device availability status callbacks to be implemented by client to receive device availability status.
MLCameraDeviceStatusCallbacks
typedef struct MLCameraDeviceStatusCallbacks MLCameraDeviceStatusCallbacks;
Device status callbacks to be implemented by client to receive device status if callback mechanism is used.
MLCameraCaptureCallbacks
typedef struct MLCameraCaptureCallbacks MLCameraCaptureCallbacks;
Capture callbacks to be implemented by client to receive capture status if callback mechanism is used.
This structure must be initialized by calling MLCameraCaptureCallbacksInit() before use.
Deprecated since 1.4.0. Scheduled for removal.
Functions Documentation
MLCameraConnectContextInit
static inline void MLCameraConnectContextInit(
MLCameraConnectContext * inout_context
)
Initialize the connect context structure.
Parameters
MLCameraConnectContext * | inout_context | MLCameraConnectContext structure to initialize. |
Required Permissions:
- None
Shall be called before calling MLCameraConnect().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureConfigInit
static inline void MLCameraCaptureConfigInit(
MLCameraCaptureConfig * inout_config
)
Initialize the capture config structure.
Parameters
MLCameraCaptureConfig * | inout_config | MLCameraCaptureConfig structure to initialize. |
Required Permissions:
- None
Shall be called before calling MLCameraPrepareCapture().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraDeviceAvailabilityStatusCallbacksInit
static inline void MLCameraDeviceAvailabilityStatusCallbacksInit(
MLCameraDeviceAvailabilityStatusCallbacks * inout_device_availability_status_callbacks
)
Initialize the callback structure.
Parameters
MLCameraDeviceAvailabilityStatusCallbacks * | inout_device_availability_status_callbacks | Device availability status callbacks structure to initialize. |
Required Permissions:
- None
Shall be called before calling MLCameraSetDeviceAvailabilityStatusCallbacks().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraDeviceStatusCallbacksInit
static inline void MLCameraDeviceStatusCallbacksInit(
MLCameraDeviceStatusCallbacks * inout_device_status_callbacks
)
Initialize the callback structure.
Parameters
MLCameraDeviceStatusCallbacks * | inout_device_status_callbacks | Device status callbacks structure to initialize. |
Required Permissions:
- None
Shall be called before calling MLCameraSetDeviceStatusCallbacks().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureCallbacksInit
static inline void MLCameraCaptureCallbacksInit(
MLCameraCaptureCallbacks * inout_capture_callbacks
)
Initialize the callback structure.
Parameters
MLCameraCaptureCallbacks * | inout_capture_callbacks | Capture status callbacks structure to initialize. |
Required Permissions:
- None
Shall be called before calling MLCameraSetCaptureCallbacks().
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraInit
MLResult MLCameraInit(
const MLCameraDeviceAvailabilityStatusCallbacks * device_availability_status_callbacks,
void * user_data
)
Initialize ML Camera API, Register callback for device availability. If the user does not want to register device availability listener, MLCameraConnect can be called directly without MLCameraInit(). MLCameraDeInit should be used for unregistering callbacks and releasing resources acquired in MLCameraInit().
Parameters
const MLCameraDeviceAvailabilityStatusCallbacks * | device_availability_status_callbacks | Callback to notify camera availability status. |
void * | user_data | Pointer to user context data (can be NULL). |
Returns
MLResult | MLResult_Ok | Camera is initialized and callbacks registered successfully. |
MLResult | MLResult_UnspecifiedFailure | The operation failed with an unspecified error. |
MLResult | MLResult_PermissionDenied | Necessary permission is missing. |
Required Permissions:
- android.permission.CAMERA (protection level: dangerous)
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraConnect
MLResult MLCameraConnect(
const MLCameraConnectContext * input_context,
MLCameraContext * out_context
)
Connect to camera device.
Parameters
const MLCameraConnectContext * | input_context | MLCameraConnectContext structure. |
MLCameraContext * | out_context | Camera context to be used in later APIs. |
Returns
MLResult | MLResult_InvalidParam | One of the parameters is invalid. |
MLResult | MLResult_UnspecifiedFailure | The operation failed with an unspecified error. |
MLResult | MLResult_Ok | Connected to camera device successfully. |
MLResult | MLMediaGenericResult_InvalidOperation | camera device already connected. |
MLResult | MLResult_PermissionDenied | Necessary permission is missing. |
Required Permissions:
- android.permission.CAMERA (protection level: dangerous)
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetNumSupportedStreams
MLResult MLCameraGetNumSupportedStreams(
MLCameraContext context,
uint32_t * out_num_supported_streams
)
Query the no of streams supported by camera device.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
uint32_t * | out_num_supported_streams | Number of streams supported by device. |
Returns
MLResult | MLResult_InvalidParam | One of the parameters is invalid. |
MLResult | MLResult_Ok | API call completed successfully. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetStreamCaps
MLResult MLCameraGetStreamCaps(
MLCameraContext context,
const uint32_t stream_index,
uint32_t * inout_num_stream_caps,
MLCameraCaptureStreamCaps * inout_stream_caps
)
Query the stream capabilities.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
const uint32_t | stream_index | Index of the stream for which to query capabilities. The index should be in the range [0 , num_supported_streams) where the num_supported_streams is from MLCameraGetNumSupportedStreams(). |
uint32_t * | inout_num_stream_caps | When the parameter inout_stream_caps is null, this is an output parameter which will hold the number of capabilities supported by the stream on function return. Otherwise this is an input parameter specifying the number of capabilities to retrieve, namely the size of the array pointed to by inout_stream_caps on return. The value should be in the range of [0, number-of-caps-retrieved]. |
MLCameraCaptureStreamCaps * | inout_stream_caps | This is either null or pointing to an array of MLCameraCaptureStreamCaps() on return. Note that caller is responsible for allocating and releasing the array. |
Returns
MLResult | MLResult_InvalidParam | One of the parameters is invalid. |
MLResult | MLResult_Ok | API call completed successfully. |
Required Permissions:
- None
Retrieves either the number of capabilities supported by the given stream or an array of capabilities for the given stream. To get the number of capabilities supported by the given stream, this API should be called with num_stream_caps being valid pointer and out_stream_caps being NULL. To retrieve the array of capabilities for the given stream, this API should be called with a valid num_stream_caps (that contains the size of the out_stream_caps) and out_stream_caps being a preallocated array of MLCameraCaptureStreamCaps of size specified by num_stream_caps.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraDisconnect
MLResult MLCameraDisconnect(
MLCameraContext context
)
Disconnect from camera device.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_Ok | Disconnected Camera device successfully. |
MLResult | MLMediaGenericResult_InvalidOperation | Camera device already disconnected or camera device is streaming. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraDeInit
MLResult MLCameraDeInit()
Uninitialize ML Camera API, unregister callback for device availability. Should be called after all camera devices are disconnected. After MLCameraDeInit, MLCameraInit can be called or MLCameraConnect can be called.
Returns
MLResult | MLResult_Ok | Deinitialization completed successfully. |
MLResult | MLMediaGenericResult_InvalidOperation | DeInit called when camera device is connected. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraPreCaptureAEAWB
MLResult MLCameraPreCaptureAEAWB(
MLCameraContext context
)
Trigger AEAWB Convergence.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid camera context. |
MLResult | MLResult_Ok | AEAWB convergence done. |
MLResult | MLResult_UnspecifiedFailure | Unspecified failure. |
MLResult | MLResult_Timeout | Timed out waiting for AEAWB convergence. |
MLResult | MLMediaGenericResult_InvalidOperation | Camera device not configured using MLCameraPrepareCapture() or camera device is streaming. |
Required Permissions:
- None
This API triggers AEAWB sequence and returns when AEAWB convergence has been achieved. The Users can either trigger and converge AEAWB metadata settings or use this API.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraPrepareCapture
MLResult MLCameraPrepareCapture(
MLCameraContext context,
const MLCameraCaptureConfig * config,
MLHandle * out_request_handle
)
Prepare for capture.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
const MLCameraCaptureConfig * | config | Capture configuration. |
MLHandle * | out_request_handle | Handle to the capture request metadata. Only valid if result is MLResult_Ok. |
Returns
MLResult | MLResult_InvalidParam | Failed to prepare for capture due to invalid input parameter. |
MLResult | MLResult_Ok | Prepared for capture successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed to prepare for capture due to internal error. |
MLResult | MLMediaGenericResult_InvalidOperation | Camera device in streaming state. |
Required Permissions:
- None
This API prepares for capture per specified MLCameraCaptureType by creating a capture request, and a handle to which is returned to the user, who can choose to manipulate the request data (metadata) via APIs defined in ml_camera_metadata_v2.h before performing the capture.
Shall be called after MLCameraConnect().
Note: When preparing capture the width and height parameters should match one of the values returned from MLCameraGetStreamCaps.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraUpdateCaptureSettings
MLResult MLCameraUpdateCaptureSettings(
MLCameraContext context
)
Update capture setting.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLMediaGenericResult_InvalidOperation | Camera not streaming video or not in preview. |
Required Permissions:
- None
This API updates the capture settings for an active preview/video stream. The API can be used to update capture settings like exposure compensation manual exposure settings like exposure time, iso setting.The capture settings can be changed in metadata handle returned by MLCameraPrepareCapture() and then this API can be called to apply the capture settings.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraSetDeviceStatusCallbacks
MLResult MLCameraSetDeviceStatusCallbacks(
MLCameraContext context,
const MLCameraDeviceStatusCallbacks * device_status_callbacks,
void * data
)
Set the client-implemented callbacks to convey camera device status.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
const MLCameraDeviceStatusCallbacks * | device_status_callbacks | Camera device status callbacks. |
void * | data | User metadata. |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLResult_Ok | Set device status callbacks successfully. |
Required Permissions:
- None
Client needs to implement the callbacks defined by MLCameraDeviceStatusCallbacks. The library passes the camera device status to the client via those callbacks.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraSetCaptureCallbacks
MLResult MLCameraSetCaptureCallbacks(
MLCameraContext context,
const MLCameraCaptureCallbacks * capture_callbacks,
void * data
)
Set the client-implemented callbacks to convey capture status.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
const MLCameraCaptureCallbacks * | capture_callbacks | Capture status callbacks. |
void * | data | User metadata. |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLResult_Ok | Set Capture callbacks successfully. |
MLResult | MLResult_UnspecifiedFailure | Internal error occurred. |
Required Permissions:
- None
Client needs to implement the callbacks defined by MLCameraCaptureCallbacks. The library passes the capture status to the client via those callbacks.
Shall be called before capture operation for preview/image/video.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureImage
MLResult MLCameraCaptureImage(
MLCameraContext context,
uint32_t num_images
)
Capture still image.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
uint32_t | num_images | Number of images to capture valid range is 1-10. |
Returns
MLResult | MLResult_InvalidParam | Invalid context or invalid num_images. |
MLResult | MLResult_Ok | Triggered image capture successfully. |
MLResult | MLMediaGenericResult_InvalidOperation | MLMediaGenericResult_InvalidOperation Capture device in invalid state or image stream not configured by MLCameraPrepareCapture(). |
MLResult | MLResult_UnspecifiedFailure | Internal error occurred. |
Required Permissions:
- None
The output image will be returned in capture callback on_image_buffer_available.
This is a blocking call, it will return after the end of on_image_buffer_available callback execution.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureVideoStart
MLResult MLCameraCaptureVideoStart(
MLCameraContext context
)
Start video capture. Capture either encoded video or YUV/RGBA frames.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid context input parameter. |
MLResult | MLResult_Ok | Started video capture successfully. |
MLResult | MLMediaGenericResult_InvalidOperation | Capture device in invalid state or video stream not configured by MLCameraPrepareCapture(). |
MLResult | MLResult_UnspecifiedFailure | Failed to start video recording due to internal error. |
Required Permissions:
- None
YUV/RGBA frames are provides through callback.For encoded video capture valid encoder input surface should be configured.The captured video YUV/RGBA frames will be returned to the application via on_video_buffer_available.
MLCameraCaptureVideoStop needs to be called to stop the capture.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCapturePreviewStart
MLResult MLCameraCapturePreviewStart(
MLCameraContext context
)
Start preview provide raw frames through callback.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLResult_Ok | Started preview successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed to start preview due to internal error. |
MLResult | MLMediaGenericResult_InvalidOperation | Capture device in invalid state or preview stream not configured by MLCameraPrepareCapture(). |
Required Permissions:
- None
The captured preview YUV frames will be returned to the application via on_preview_buffer_available.
MLCameraCapturePreviewStop needs to be called to stop the capture.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCaptureVideoStop
MLResult MLCameraCaptureVideoStop(
MLCameraContext context
)
Stop video capture.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLResult_Ok | Stopped video capture successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed to stop video recording due to internal error. |
MLResult | MLMediaGenericResult_InvalidOperation | Capture device in invalid state or video stream not streaming. |
Required Permissions:
- None
User should allow some time, i.e., >500ms, after MLCameraCaptureVideoStart and before calling this API, as captured frames are being encoded. Otherwise, MLResult_UnspecifiedFailure will be returned.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraCapturePreviewStop
MLResult MLCameraCapturePreviewStop(
MLCameraContext context
)
Stop preview.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
Returns
MLResult | MLResult_InvalidParam | Invalid context. |
MLResult | MLResult_Ok | Stopped video capture successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed to stop preview due to internal error. |
MLResult | MLMediaGenericResult_InvalidOperation | Capture device in invalid state or preview stream not streaming. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetDeviceStatus
MLResult MLCameraGetDeviceStatus(
MLCameraContext context,
uint32_t * out_device_status
)
Poll camera device status.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
uint32_t * | out_device_status | Device status. |
Returns
MLResult | MLResult_InvalidParam | Failed to obtain device status due to invalid input parameter. |
MLResult | MLResult_Ok | Obtained device status successfully. |
Required Permissions:
- None
Use MLCameraDeviceStatusFlag to view specific status bit. Call MLCameraGetErrorCode() to obtain the error code if MLCameraDeviceStatusFlag_Error bit is set.
Note: This API can still be used even if MLCameraSetDeviceStatusCallbacks() has been called.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetDeviceAvailabilityStatus
MLResult MLCameraGetDeviceAvailabilityStatus(
MLCameraIdentifier cam_id,
bool * out_device_availability_status
)
Poll camera device availability status.
Parameters
MLCameraIdentifier | cam_id | Camera Id for which the availability status is to be queried. |
bool * | out_device_availability_status | Device availability status. |
Returns
MLResult | MLResult_InvalidParam | Failed to obtain device status due to invalid input parameter. |
MLResult | MLResult_Ok | Obtained device status successfully. |
Required Permissions:
- None
Use MLCameraGetDeviceAvailabilityStatus to view specific status.
Note: This API can still be used even if availability status callback is not registered through MLCameraInit call.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetErrorCode
MLResult MLCameraGetErrorCode(
MLCameraContext context,
MLCameraError * out_error_code
)
Obtain camera device error code.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
MLCameraError * | out_error_code | Camera device error code. |
Returns
MLResult | MLResult_InvalidParam | Failed to obtain device error code due to invalid input parameter. |
MLResult | MLResult_Ok | Obtained camera device error code successfully. |
Required Permissions:
- None
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20
MLCameraGetCameraCharacteristics
MLResult MLCameraGetCameraCharacteristics(
MLCameraContext context,
MLHandle * out_characteristics_handle
)
Obtains handle for retrieving camera characteristics.
Parameters
MLCameraContext | context | Camera context obtained from MLCameraConnect(). |
MLHandle * | out_characteristics_handle | Handle to access camera characteristic metadata. Only valid if result is MLResult_Ok. |
Returns
MLResult | MLResult_InvalidParam | Failed to obtain camera characteristic handle due to invalid input parameter. |
MLResult | MLResult_Ok | Obtained camera characteristic handle successfully. |
MLResult | MLResult_UnspecifiedFailure | Failed due to internal error. |
Required Permissions:
- None
This API provides the handle for retrieving camera characteristics via APIs defined in ml_camera_metadata_v2.h.
Deprecated since 1.4.0. Scheduled for removal.
API Level:
- 20