auto switch device NDK API

Signed-off-by: zhangchao <zhangchao338@huawei.com>
This commit is contained in:
zhangchao 2024-10-12 14:56:16 +08:00
parent 0fd1243fe2
commit c5c943d9bc
3 changed files with 93 additions and 0 deletions

View File

@ -973,6 +973,24 @@ typedef struct Camera_FrameShutterEndInfo {
int32_t captureId;
} Camera_FrameShutterEndInfo;
/**
* @brief Auto device switch status info.
*
* @since 13
* @version 1.0
*/
typedef struct Camera_AutoDeviceSwitchStatusInfo {
/**
* is device switched.
*/
bool isDeviceSwitched;
/**
* is device capability changed.
*/
bool isDeviceCapabilityChanged;
} Camera_AutoDeviceSwitchStatusInfo;
/**
* @brief Creates a CameraManager instance.
*

View File

@ -602,5 +602,21 @@
{
"first_introduced": "12",
"name": "OH_PhotoNative_Release"
},
{
"first_introduced": "13",
"name": "OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback"
},
{
"first_introduced": "13",
"name": "OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback"
},
{
"first_introduced": "13",
"name": "OH_CaptureSession_IsAutoSwitchDeviceSupported"
},
{
"first_introduced": "13",
"name": "OH_CaptureSession_EnableAutoSwitchDevice"
}
]

View File

@ -94,6 +94,16 @@ typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera
typedef void (*OH_CaptureSession_OnSmoothZoomInfo)(Camera_CaptureSession* session,
Camera_SmoothZoomInfo* smoothZoomInfo);
/**
* @brief Capture session device switch status callback.
*
* @param session the {@link Camera_CaptureSession} which deliver the callback.
* @param autoDeviceSwitchStatusInfo the {@link Camera_AutoDeviceSwitchStatusInfo} which delivered by the callback.
* @since 13
*/
typedef void (*OH_CaptureSession_OnAutoDeviceSwitchStatusChange)(Camera_CaptureSession* session,
Camera_AutoDeviceSwitchStatusInfo* autoDeviceSwitchStatusInfo);
/**
* @brief A listener for capture session.
*
@ -857,6 +867,55 @@ Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* se
Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session,
OH_NativeBuffer_ColorSpace colorSpace);
/**
* @brief Register device switch event callback.
*
* @param session the {@link Camera_CaptureSession} instance.
* @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be registered.
* @return {@link #CAMERA_OK} if the method call succeeds.
* {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
* @since 13
*/
Camera_ErrorCode OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
/**
* @brief Unregister device switch event callback.
*
* @param session the {@link Camera_CaptureSession} instance.
* @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be unregistered.
* @return {@link #CAMERA_OK} if the method call succeeds.
* {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
* @since 13
*/
Camera_ErrorCode OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session,
OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange);
/**
* @brief Check whether auto device switch is supported.
*
* @param session the {@link Camera_CaptureSession} instance.
* @param isSupported the result of whether auto device switch supported.
* @return {@link #CAMERA_OK} if the method call succeeds.
* {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
* {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
* @since 13
*/
Camera_ErrorCode OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession* session, bool* isSupported);
/**
* @brief Enable auto switch or not for the camera device.
*
* @param session the {@link Camera_CaptureSession} instance.
* @param enabled the flag of enable auto switch or not.
* @return {@link #CAMERA_OK} if the method call succeeds.
* {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
* {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
* {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
* @since 13
*/
Camera_ErrorCode OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession* session, bool enabled);
#ifdef __cplusplus
}
#endif