diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index e5faf336c140e94faf771e865c161e19bb25efa2..1af3bf3ca35d30f4f6e02ba30c16bb109057d82f 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -602,5 +602,29 @@ { "first_introduced": "12", "name": "OH_PhotoNative_Release" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_RegisterDeviceSwitchCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_UnregisterDeviceSwitchCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_RegisterDeviceCapabilityChangeCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_UnregisterDeviceCapabilityChangeCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_IsAutoSwitchDeviceSupported" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_EnableAutoSwitchDevice" } ] diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 5f19ac7242812b8d06c30338ccf7aca2a2cc8a28..633df625f5a65bc1358ed1a04536037f9487b453 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -94,6 +94,24 @@ 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 callback. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param isSwitched the device switch status which delivered by the callback. + * @since 13 + */ +typedef void (*OH_CaptureSession_OnDeviceSwitched)(Camera_CaptureSession* session, bool* isSwitched); + +/** + * @brief Capture session device capability change callback. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param isChanged the device capability change status which delivered by the callback. + * @since 13 + */ +typedef void (*OH_CaptureSession_OnDeviceCapabilityChanged)(Camera_CaptureSession* session, bool* isChanged); + /** * @brief A listener for capture session. * @@ -857,6 +875,79 @@ 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 deviceSwitchCallback the {@link OH_CaptureSession_OnDeviceSwitched} 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_RegisterDeviceSwitchCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnDeviceSwitched deviceSwitchCallback); + +/** + * @brief Unregister device switch event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param deviceSwitchCallback the {@link OH_CaptureSession_OnDeviceSwitched} 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_UnregisterDeviceSwitchCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnDeviceSwitched deviceSwitchCallback); + +/** + * @brief Register device capability change event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param deviceCapabilityChangeCallback the {@link OH_CaptureSession_OnDeviceCapabilityChanged} 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_RegisterDeviceCapabilityChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnDeviceCapabilityChanged deviceCapabilityChangeCallback); + +/** + * @brief Unregister device capability change event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param deviceCapabilityChangeCallback the {@link OH_CaptureSession_OnDeviceCapabilityChanged} 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_UnregisterDeviceCapabilityChangeCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnDeviceCapabilityChanged deviceCapabilityChangeCallback); + +/** + * @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