From 95e24c12640ca65ad02830f5d505adebbd2ced94 Mon Sep 17 00:00:00 2001 From: cold_yixiu Date: Sun, 5 Nov 2023 12:11:02 +0800 Subject: [PATCH 1/3] add ndk interface description Signed-off-by: cold_yixiu --- .../entry/src/main/cpp/camera_manager.cpp | 6 +- .../unittest/src/v1_1/camera_ndk_unittest.cpp | 2 +- frameworks/native/ndk/camera_manager.cpp | 4 +- .../native/ndk/impl/capture_session_impl.cpp | 2 + .../kits/native/include/camera/camera.h | 443 ++++++++++++++---- .../native/include/camera/camera.ndk.json | 2 +- .../kits/native/include/camera/camera_input.h | 74 ++- .../native/include/camera/camera_manager.h | 153 +++++- .../native/include/camera/metadata_output.h | 83 +++- .../kits/native/include/camera/photo_output.h | 112 ++++- .../native/include/camera/preview_output.h | 44 ++ 11 files changed, 799 insertions(+), 126 deletions(-) diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.cpp b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.cpp index a0c962ca8..f52bb68c6 100644 --- a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.cpp +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.cpp @@ -33,7 +33,7 @@ NDKCamera::NDKCamera(char* str, uint32_t focusMode, uint32_t cameraDeviceIndex) { valid_ = false; ReleaseCamera(); - Camera_ErrorCode ret = OH_Camera_GetCameraMananger(&cameraManager_); + Camera_ErrorCode ret = OH_Camera_GetCameraManager(&cameraManager_); if (cameraManager_ == nullptr || ret != CAMERA_OK) { OH_LOG_ERROR(LOG_APP, "Get CameraManager failed."); } @@ -78,11 +78,11 @@ NDKCamera::~NDKCamera() OH_LOG_ERROR(LOG_APP, "Release OH_CameraManager_DeleteSupportedCameraOutputCapability. ok"); } - ret = OH_Camera_DeleteCameraMananger(cameraManager_); + ret = OH_Camera_DeleteCameraManager(cameraManager_); if (ret != CAMERA_OK) { OH_LOG_ERROR(LOG_APP, "Delete CameraManager failed."); } else { - OH_LOG_ERROR(LOG_APP, "Release OH_Camera_DeleteCameraMananger. ok"); + OH_LOG_ERROR(LOG_APP, "Release OH_Camera_DeleteCameraManager. ok"); } cameraManager_ = nullptr; } diff --git a/frameworks/native/camera/test/unittest/src/v1_1/camera_ndk_unittest.cpp b/frameworks/native/camera/test/unittest/src/v1_1/camera_ndk_unittest.cpp index 8f5a0ecfd..93fb1dadc 100644 --- a/frameworks/native/camera/test/unittest/src/v1_1/camera_ndk_unittest.cpp +++ b/frameworks/native/camera/test/unittest/src/v1_1/camera_ndk_unittest.cpp @@ -199,7 +199,7 @@ void CameraNdkUnitTest::SetUp() SetSelfTokenID(tokenId); OHOS::Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo(); - Camera_ErrorCode ret = OH_Camera_GetCameraMananger(&cameraManager); + Camera_ErrorCode ret = OH_Camera_GetCameraManager(&cameraManager); EXPECT_EQ(ret, 0); ret = OH_CameraManager_GetSupportedCameras(cameraManager, &cameraDevice, &cameraDeviceSize); EXPECT_EQ(ret, 0); diff --git a/frameworks/native/ndk/camera_manager.cpp b/frameworks/native/ndk/camera_manager.cpp index 760f82bf4..0a5aa2c78 100644 --- a/frameworks/native/ndk/camera_manager.cpp +++ b/frameworks/native/ndk/camera_manager.cpp @@ -22,13 +22,13 @@ extern "C" { #endif -Camera_ErrorCode OH_Camera_GetCameraMananger(Camera_Manager** cameraManager) +Camera_ErrorCode OH_Camera_GetCameraManager(Camera_Manager** cameraManager) { *cameraManager = new Camera_Manager(); return CAMERA_OK; } -Camera_ErrorCode OH_Camera_DeleteCameraMananger(Camera_Manager* cameraManager) +Camera_ErrorCode OH_Camera_DeleteCameraManager(Camera_Manager* cameraManager) { CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! cameraManager is null!"); diff --git a/frameworks/native/ndk/impl/capture_session_impl.cpp b/frameworks/native/ndk/impl/capture_session_impl.cpp index 6e241e3c0..b2b97b13f 100644 --- a/frameworks/native/ndk/impl/capture_session_impl.cpp +++ b/frameworks/native/ndk/impl/capture_session_impl.cpp @@ -172,7 +172,9 @@ Camera_ErrorCode Camera_CaptureSession::SetVideoStabilizationMode(Camera_VideoSt MEDIA_DEBUG_LOG("Camera_CaptureSession::SetVideoStabilizationMode is called"); VideoStabilizationMode innerVideoStabilizationMode = static_cast(mode); + innerCaptureSession_->LockForControl(); int32_t ret = innerCaptureSession_->SetVideoStabilizationMode(innerVideoStabilizationMode); + innerCaptureSession_->UnlockForControl(); return FrameworkToNdkCameraError(ret); } diff --git a/interfaces/kits/native/include/camera/camera.h b/interfaces/kits/native/include/camera/camera.h index 4437d53c1..09f825357 100644 --- a/interfaces/kits/native/include/camera/camera.h +++ b/interfaces/kits/native/include/camera/camera.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file camera.h + * + * @brief Declare the camera base concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_CAMERA_H #define NATIVE_INCLUDE_CAMERA_CAMERA_H @@ -24,17 +35,24 @@ extern "C" { #endif /** + * @brief camera manager + * + * A pointer can be created using {@link OH_Camera_GetCameraManager} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_Manager Camera_Manager; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera error code. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_ErrorCode { /** - * Camera operation success. + * Camera result is ok. */ CAMERA_OK = 0, @@ -44,31 +62,32 @@ typedef enum Camera_ErrorCode { CAMERA_INVALID_ARGUMENT = 7400101, /** - * Camera operation was not allowed. + * Operation not allowed. */ CAMERA_OPERATION_NOT_ALLOWED = 7400102, + /** - * Camera session not config. + * Session not config. */ CAMERA_SESSION_NOT_CONFIG = 7400103, /** - * Camera session not running. + * Session not running. */ CAMERA_SESSION_NOT_RUNNING = 7400104, /** - * Camera session config locked. + * Session config locked. */ CAMERA_SESSION_CONFIG_LOCKED = 7400105, /** - * Camera device setting locked. + * Device setting locked. */ CAMERA_DEVICE_SETTING_LOCKED = 7400106, /** - * Camera can not use cause of conflict. + * Can not use camera cause of conflict. */ CAMERA_CONFLICT_CAMERA = 7400107, @@ -78,7 +97,7 @@ typedef enum Camera_ErrorCode { CAMERA_DEVICE_DISABLED = 7400108, /** - * Camera can not use cause of preempted. + * Can not use camera cause of preempted. */ CAMERA_DEVICE_PREEMPTED = 7400109, @@ -89,433 +108,683 @@ typedef enum Camera_ErrorCode { } Camera_ErrorCode; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera status. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_Status { /** - * Camera operation success. + * Appear status. */ CAMERA_STATUS_APPEAR = 0, /** - * Parameter missing or parameter type incorrect. + * Disappear status. */ CAMERA_STATUS_DISAPPEAR = 1, /** - * Camera operation was not allowed. + * Available status. */ CAMERA_STATUS_AVAILABLE = 2, /** - * Camera operation was not allowed. + * Unavailable status. */ CAMERA_STATUS_UNAVAILABLE = 3 } Camera_Status; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera position. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_Position { /** - * Camera operation success. + * Unspecified position. */ CAMERA_POSITION_UNSPECIFIED = 0, /** - * Parameter missing or parameter type incorrect. + * Back position. */ CAMERA_POSITION_BACK = 1, /** - * Camera operation was not allowed. + * Front position. */ CAMERA_POSITION_FRONT = 2 } Camera_Position; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera type. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_Type { /** - * Camera operation success. + * Default camera type. */ CAMERA_TYPE_DEFAULT = 0, /** - * Parameter missing or parameter type incorrect. + * Wide camera. */ CAMERA_TYPE_WIDE_ANGLE = 1, /** - * Camera operation was not allowed. + * Ultra wide camera. */ CAMERA_TYPE_ULTRA_WIDE = 2, /** - * Camera operation was not allowed. + * Telephoto camera. */ CAMERA_TYPE_TELEPHOTO = 3, /** - * Camera operation was not allowed. + * True depth camera. */ CAMERA_TYPE_TRUE_DEPTH = 4 } Camera_Type; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera connection type. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_Connection { /** - * Camera operation success. + * Built-in camera. */ CAMERA_CONNECTION_BUILT_IN = 0, /** - * Parameter missing or parameter type incorrect. + * Camera connected using USB. */ CAMERA_CONNECTION_USB_PLUGIN = 1, /** - * Camera operation was not allowed. + * Remote camera. */ CAMERA_CONNECTION_REMOTE = 2 } Camera_Connection; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for camera format type. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_Format { /** - * Camera operation success. + * RGBA 8888 Format. */ CAMERA_FORMAT_RGBA_8888 = 3, /** - * Parameter missing or parameter type incorrect. + * YUV 420 Format. */ CAMERA_FORMAT_YUV_420_SP = 1003, /** - * Camera operation was not allowed. + * JPEG Format. */ CAMERA_FORMAT_JPEG = 2000 } Camera_Format; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for flash mode. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_FlashMode { /** - * Camera operation success. + * Close mode. */ FLASH_MODE_CLOSE = 0, /** - * Parameter missing or parameter type incorrect. + * Open mode. */ FLASH_MODE_OPEN = 1, /** - * Camera operation was not allowed. + * Auto mode. */ FLASH_MODE_AUTO = 2, /** - * Camera operation was not allowed. + * Always open mode. */ FLASH_MODE_ALWAYS_OPEN = 3 } Camera_FlashMode; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for exposure mode. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_ExposureMode { /** - * Camera operation success. + * Lock exposure mode. */ EXPOSURE_MODE_LOCKED = 0, /** - * Parameter missing or parameter type incorrect. + * Auto exposure mode. */ EXPOSURE_MODE_AUTO = 1, /** - * Camera operation was not allowed. + * Continuous automatic exposure. */ EXPOSURE_MODE_CONTINUOUS_AUTO = 2 } Camera_ExposureMode; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for focus mode. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_FocusMode { /** - * Camera operation success. + * Manual mode. */ FOCUS_MODE_MANUAL = 0, /** - * Parameter missing or parameter type incorrect. + * Continuous auto mode. */ FOCUS_MODE_CONTINUOUS_AUTO = 1, /** - * Camera operation was not allowed. + * Auto mode. */ FOCUS_MODE_AUTO = 2, /** - * Camera operation was not allowed. + * Locked mode. */ FOCUS_MODE_LOCKED = 3 } Camera_FocusMode; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for focus state. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_FocusState { /** - * Camera operation success. + * Scan state. */ FOCUS_STATE_SCAN = 0, /** - * Parameter missing or parameter type incorrect. + * Focused state. */ FOCUS_STATE_FOCUSED = 1, /** - * Camera operation was not allowed. + * Unfocused state. */ FOCUS_STATE_UNFOCUSED = 2 } Camera_FocusState; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for video stabilization mode. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_VideoStabilizationMode { /** - * Camera operation success. + * Turn off video stablization. */ STABILIZATION_MODE_OFF = 0, /** - * Parameter missing or parameter type incorrect. + * LOW mode provides basic stabilization effect. */ STABILIZATION_MODE_LOW = 1, /** - * Camera operation was not allowed. + * MIDDLE mode means algorithms can achieve better effects than LOW mode. */ STABILIZATION_MODE_MIDDLE = 2, /** - * Camera operation was not allowed. + * HIGH mode means algorithms can achieve better effects than MIDDLE mode. */ STABILIZATION_MODE_HIGH = 3, /** - * Camera operation was not allowed. + * Camera HDF can select mode automatically. */ STABILIZATION_MODE_AUTO = 4 } Camera_VideoStabilizationMode; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for the image rotation angles. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_ImageRotation { /** - * Camera operation success. + * The capture image rotates 0 degrees. */ IAMGE_ROTATION_0 = 0, /** - * Parameter missing or parameter type incorrect. + * The capture image rotates 90 degrees. */ IAMGE_ROTATION_90 = 90, /** - * Camera operation was not allowed. + * The capture image rotates 180 degrees. */ IAMGE_ROTATION_180 = 180, /** - * Camera operation was not allowed. + * The capture image rotates 270 degrees. */ IAMGE_ROTATION_270 = 270 } Camera_ImageRotation; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for the image quality levels. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_QualityLevel { /** - * Camera operation success. + * High image quality. */ QUALITY_LEVEL_HIGH = 0, /** - * Parameter missing or parameter type incorrect. + * Medium image quality. */ QUALITY_LEVEL_MEDIUM = 1, /** - * Camera operation was not allowed. + * Low image quality. */ QUALITY_LEVEL_LOW = 2 } Camera_QualityLevel; /** - * Enumerates the return values that may be used by the interface. + * @brief Enum for metadata object type. + * + * @since 11 + * @version 1.0 */ typedef enum Camera_MetadataObjectType { /** - * Camera operation success. + * Face detection. */ FACE_DETECTION = 0 } Camera_MetadataObjectType; /** - * Enumerates the return values that may be used by the interface. + * @brief Size parameter. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Size { + /** + * Width. + */ uint32_t width; + + /** + * Height. + */ uint32_t height; } Camera_Size; /** - * Enumerates the return values that may be used by the interface. + * @brief Profile for camera streams. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Profile { + /** + * Camera format. + */ Camera_Format format; + + /** + * Picture size. + */ Camera_Size size; } Camera_Profile; /** - * Enumerates the return values that may be used by the interface. + * @brief Frame rate range. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_FrameRateRange { + /** + * Min frame rate. + */ uint32_t min; + + /** + * Max frame rate. + */ uint32_t max; } Camera_FrameRateRange; /** - * Enumerates the return values that may be used by the interface. + * @brief Video profile. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_VideoProfile { + /** + * Camera format. + */ Camera_Format format; + + /** + * Picture size. + */ Camera_Size size; + + /** + * Frame rate in unit fps (frames per second). + */ Camera_FrameRateRange range; } Camera_VideoProfile; /** - * Enumerates the return values that may be used by the interface. + * @brief Camera output capability. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_OutputCapability { + /** + * Preview profiles list. + */ Camera_Profile** previewProfiles; + + /** + * Size of preview profiles list. + */ uint32_t previewProfilesSize; + + /** + * Photo profiles list. + */ Camera_Profile** photoProfiles; + + /** + * Size of photo profiles list. + */ uint32_t photoProfilesSize; + + /** + * Video profiles list. + */ Camera_VideoProfile** videoProfiles; + + /** + * Size of video profiles list. + */ uint32_t videoProfilesSize; + + /** + * Metadata object types list. + */ Camera_MetadataObjectType** supportedMetadataObjectTypes; + + /** + * Size of metadata object types list. + */ uint32_t metadataProfilesSize; } Camera_OutputCapability; /** - * Enumerates the return values that may be used by the interface. + * @brief Camera device object. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Device { + /** + * Camera id attribute. + */ char* cameraId; + + /** + * Camera position attribute. + */ Camera_Position cameraPosition; + + /** + * Camera type attribute. + */ Camera_Type cameraType; + + /** + * Camera connection type attribute. + */ Camera_Connection connectionType; } Camera_Device; /** - * Enumerates the return values that may be used by the interface. + * @brief Camera status info. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_StatusInfo { + /** + * Camera instance. + */ Camera_Device* camera; + + /** + * Current camera status. + */ Camera_Status status; } Camera_StatusInfo; /** - * Enumerates the return values that may be used by the interface. + * @brief Point parameter. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Point { - double x; - double y; + /** + * X co-ordinate. + */ + int32_t x; + + /** + * Y co-ordinate. + */ + int32_t y; } Camera_Point; /** - * Enumerates the return values that may be used by the interface. + * @brief Photo capture location. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Location { + /** + * Latitude. + */ double latitude; + + /** + * Longitude. + */ double longitude; + + /** + * Altitude. + */ double altitude; } Camera_Location; /** - * Enumerates the return values that may be used by the interface. + * @brief Photo capture options to set. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_PhotoCaptureSetting { + /** + * Photo image quality. + */ Camera_QualityLevel quality; + + /** + * Photo rotation. + */ Camera_ImageRotation rotation; + + /** + * Photo location. + */ Camera_Location* location; + + /** + * Set the mirror photo function switch, default to false. + */ bool mirror; } Camera_PhotoCaptureSetting; /** - * Enumerates the return values that may be used by the interface. + * @brief Frame shutter callback info. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_FrameShutterInfo { + /** + * Capture id. + */ int32_t captureId; + + /** + * Timestamp for frame. + */ uint64_t timestamp; } Camera_FrameShutterInfo; /** - * Enumerates the return values that may be used by the interface. + * @brief Capture end info. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_CaptureEndInfo { + /** + * Capture id. + */ int32_t captureId; + + /** + * Frame count. + */ int64_t frameCount; } Camera_CaptureEndInfo; /** - * Enumerates the return values that may be used by the interface. + * @brief Rectangle definition. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_Rect { + /** + * X coordinator of top left point. + */ int32_t topLeftX; + + /** + * Y coordinator of top left point. + */ int32_t topLeftY; + + /** + * Width of this rectangle. + */ int32_t width; + + /** + * Height of this rectangle. + */ int32_t height; } Camera_Rect; /** - * Enumerates the return values that may be used by the interface. + * @brief Metadata object basis. + * + * @since 11 + * @version 1.0 */ typedef struct Camera_MetadataObject { + /** + * Metadata object type. + */ Camera_MetadataObjectType type; + + /** + * Metadata object timestamp in milliseconds. + */ int64_t timestamp; + + /** + * The axis-aligned bounding box of detected metadata object. + */ Camera_Rect* boundingBox; } Camera_MetadataObject; /** + * @brief Creates a CameraManager instance. + * + * @param cameraManager the output {@link Camera_Manager} cameraManager will be created + * if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ -Camera_ErrorCode OH_Camera_GetCameraMananger(Camera_Manager** cameraManager); +Camera_ErrorCode OH_Camera_GetCameraManager(Camera_Manager** cameraManager); /** + * @brief Delete the CameraManager instance. + * + * @param cameraManager the {@link Camera_Manager} cameraManager instance to be deleted. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ -Camera_ErrorCode OH_Camera_DeleteCameraMananger(Camera_Manager* cameraManager); +Camera_ErrorCode OH_Camera_DeleteCameraManager(Camera_Manager* cameraManager); #ifdef __cplusplus diff --git a/interfaces/kits/native/include/camera/camera.ndk.json b/interfaces/kits/native/include/camera/camera.ndk.json index e93adc79d..6d9ddb995 100644 --- a/interfaces/kits/native/include/camera/camera.ndk.json +++ b/interfaces/kits/native/include/camera/camera.ndk.json @@ -16,7 +16,7 @@ { "name": "OH_CameraManager_CreatePhotoOutput" }, { "name": "OH_CameraManager_CreateVideoOutput" }, { "name": "OH_CameraManager_CreateMetadataOutput" }, - { "name": "OH_Camera_GetCameraMananger" }, + { "name": "OH_Camera_GetCameraManager" }, { "name": "OH_CaptureSession_RegisterCallback" }, { "name": "OH_CaptureSession_UnregisterCallback" }, { "name": "OH_CaptureSession_BeginConfig" }, diff --git a/interfaces/kits/native/include/camera/camera_input.h b/interfaces/kits/native/include/camera/camera_input.h index b8a180179..db511efda 100644 --- a/interfaces/kits/native/include/camera/camera_input.h +++ b/interfaces/kits/native/include/camera/camera_input.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file camera_input.h + * + * @brief Declare the camera input concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H #define NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H @@ -25,44 +36,97 @@ extern "C" { #endif /** + * @brief Camera input object + * + * A pointer can be created using {@link OH_CameraManager_CreateCameraInput} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_Input Camera_Input; +/** + * @brief Camera input error callback to be called in {@link CameraInput_Callbacks}. + * + * @param cameraInput the {@link Camera_Input} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the camera input. + * + * @see CAMERA_CONFLICT_CAMERA + * @see CAMERA_DEVICE_DISABLED + * @see CAMERA_DEVICE_PREEMPTED + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_CameraInput_OnError)(const Camera_Input* cameraInput, Camera_ErrorCode errorCode); +/** + * @brief A listener for camera input error events. + * + * @see OH_CameraInput_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct CameraInput_Callbacks { + /** + * Camera input error event. + */ OH_CameraInput_OnError onError; } CameraInput_Callbacks; /** + * @brief Register camera input change event callback. + * + * @param cameraInput the {@link Camera_Input} instance. + * @param callback the {@link CameraInput_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); /** + * @brief Unregister camera input change event callback. + * + * @param cameraInput the {@link Camera_Input} instance. + * @param callback the {@link CameraInput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); /** + * @brief Open camera. + * + * @param cameraInput the {@link Camera_Input} instance to be opened. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_CONFLICT_CAMERA} if can not use camera cause of conflict. + * {@link #CAMERA_DEVICE_DISABLED} if camera disabled cause of security reason. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput); /** + * @brief Close camera. + * + * @param cameraInput the {@link Camera_Input} instance to be closed. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput); /** + * @brief Release camera input instance. + * + * @param cameraInput the {@link Camera_Input} instance to be released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput); diff --git a/interfaces/kits/native/include/camera/camera_manager.h b/interfaces/kits/native/include/camera/camera_manager.h index 5a386f7ec..e2a741688 100644 --- a/interfaces/kits/native/include/camera/camera_manager.h +++ b/interfaces/kits/native/include/camera/camera_manager.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file camera_manager.h + * + * @brief Declare the camera manager concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H #define NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H @@ -30,105 +41,215 @@ extern "C" { #endif +/** + * @brief Camera manager status callback to be called in {@link CameraManager_Callbacks}. + * + * @param cameraManager the {@link Camera_Manager} which deliver the callback. + * @param status the {@link Camera_StatusInfo} of each camera device. + * @since 11 + */ typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status); +/** + * @brief A listener for camera devices status. + * + * @see OH_CameraManager_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct CameraManager_Callbacks { + /** + * Camera status change event. + */ OH_CameraManager_StatusCallback onCameraStatus; } CameraManager_Callbacks; /** + * @brief Register camera status change event callback. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param callback the {@link CameraManager_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); /** + * @brief Unregister camera status change event callback. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param callback the {@link CameraManager_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); /** + * @brief Gets supported camera descriptions. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param cameras the supported {@link Camera_Device} list will be filled + * if the method call succeeds. + * @param size the size of supported {@link Camera_Device} list will be filled + * if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, Camera_Device** cameras, uint32_t* size); - /** + * @brief Delete supported camera. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param cameras the {@link Camera_Device} list to be deleted. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraManager, Camera_Device* cameras, uint32_t size); - /** + * @brief Gets the supported output capability for the specific camera and specific mode. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param cameras the {@link Camera_Device} to be queryed. + * @param cameraOutputCapability the supported {@link Camera_OutputCapability} will be filled + * if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability); /** + * @brief Delete the supported output capability. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param cameraOutputCapability the {@link Camera_OutputCapability} to be deleted. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_DeleteSupportedCameraOutputCapability(Camera_Manager* cameraManager, Camera_OutputCapability* cameraOutputCapability); /** + * @brief Determine whether camera is muted. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param isCameraMuted whether camera is muted will be filled if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted); /** + * @brief Create a capture session instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param captureSession the {@link Camera_CaptureSession} will be created + * if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, Camera_CaptureSession** captureSession); /** + * @brief Create a camera input= instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param camera the {@link Camera_Device} which use to create {@link Camera_Input}. + * @param cameraInput the {@link Camera_Input} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @permission ohos.permission.CAMERA * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, const Camera_Device* camera, Camera_Input** cameraInput); /** + * @brief Create a camera input instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param position the {@link Camera_Position} which use to create {@link Camera_Input}. + * @param type the {@link Camera_Type} which use to create {@link Camera_Input}. + * @param cameraInput the {@link Camera_Input} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @permission ohos.permission.CAMERA * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, Camera_Position position, Camera_Type type, Camera_Input** cameraInput); /** + * @brief Create a preview output instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param profile the {@link Camera_Profile} to create {@link Camera_PreviewOutput}. + * @param surfaceId the which use to create {@link Camera_PreviewOutput}. + * @param previewOutput the {@link Camera_PreviewOutput} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PreviewOutput** previewOutput); /** + * @brief Create a photo output instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param profile the {@link Camera_Profile} to create {@link Camera_PhotoOutput}. + * @param surfaceId the which use to create {@link Camera_PhotoOutput}. + * @param photoOutput the {@link Camera_PhotoOutput} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, const char* surfaceId, Camera_PhotoOutput** photoOutput); /** + * @brief Create a video output instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param profile the {@link Camera_VideoProfile} to create {@link Camera_VideoOutput}. + * @param surfaceId the which use to create {@link Camera_VideoOutput}. + * @param videoOutput the {@link Camera_VideoOutput} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, const char* surfaceId, Camera_VideoOutput** videoOutput); /** + * @brief Create a metadata output instance. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param profile the {@link Camera_MetadataObjectType} to create {@link Camera_MetadataOutput}. + * @param metadataOutput the {@link Camera_MetadataOutput} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput); diff --git a/interfaces/kits/native/include/camera/metadata_output.h b/interfaces/kits/native/include/camera/metadata_output.h index 0fd67358a..67b009c02 100644 --- a/interfaces/kits/native/include/camera/metadata_output.h +++ b/interfaces/kits/native/include/camera/metadata_output.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file metadata_output.h + * + * @brief Declare the metadata output concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H #define NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H @@ -25,50 +36,112 @@ extern "C" { #endif /** + * @brief Metadata output object + * + * A pointer can be created using {@link Camera_MetadataOutput} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_MetadataOutput Camera_MetadataOutput; +/** + * @brief Metadata output metadata object available callback to be called in {@link MetadataOutput_Callbacks}. + * + * @param metadataOutput the {@link Camera_MetadataOutput} which deliver the callback. + * @param metadataObject the {@link Camera_MetadataObject} will be delivered by the callback. + * @param size the size of the metadataObject. + * @since 11 + */ typedef void (*OH_MetadataOutput_OnMetadataObjectAvailable)(Camera_MetadataOutput* metadataOutput, Camera_MetadataObject* metadataObject, uint32_t size); +/** + * @brief Metadata output error callback to be called in {@link MetadataOutput_Callbacks}. + * + * @param metadataOutput the {@link Camera_MetadataOutput} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the metadata output. + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_MetadataOutput_OnError)(Camera_MetadataOutput* metadataOutput, Camera_ErrorCode errorCode); +/** + * @brief A listener for metadata output. + * + * @see OH_MetadataOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct MetadataOutput_Callbacks { + /** + * Metadata output result data will be called by this callback. + */ OH_MetadataOutput_OnMetadataObjectAvailable onMetadataObjectAvailable; + + /** + * Metadata output error event. + */ OH_MetadataOutput_OnError onError; } MetadataOutput_Callbacks; /** + * @brief Register metadata output change event callback. + * + * @param metadataOutput the {@link Camera_MetadataOutput} instance. + * @param callback the {@link MetadataOutput_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_MetadataOutput_RegisterCallback(Camera_MetadataOutput* metadataOutput, MetadataOutput_Callbacks* callback); /** + * @brief Unregister metadata output change event callback. + * + * @param metadataOutput the {@link Camera_MetadataOutput} instance. + * @param callback the {@link MetadataOutput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_MetadataOutput_UnregisterCallback(Camera_MetadataOutput* metadataOutput, MetadataOutput_Callbacks* callback); /** + * @brief Start metadata output. + * + * @param metadataOutput the {@link Camera_MetadataOutput} instance to be started. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #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 11 - * @version 1.0 */ Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput); /** + * @brief Stop metadata output. + * + * @param metadataOutput the {@link Camera_MetadataOutput} instance to be stoped. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #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 11 - * @version 1.0 */ Camera_ErrorCode OH_MetadataOutput_Stop(Camera_MetadataOutput* metadataOutput); /** + * @brief Release metadata output. + * + * @param metadataOutput the {@link Camera_MetadataOutput} instance to be released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_MetadataOutput_Release(Camera_MetadataOutput* metadataOutput); diff --git a/interfaces/kits/native/include/camera/photo_output.h b/interfaces/kits/native/include/camera/photo_output.h index 1d3e91661..e386e997d 100644 --- a/interfaces/kits/native/include/camera/photo_output.h +++ b/interfaces/kits/native/include/camera/photo_output.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file photo_output.h + * + * @brief Declare the photo output concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H #define NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H @@ -25,60 +36,149 @@ extern "C" { #endif /** + * @brief Photo output object + * + * A pointer can be created using {@link Camera_PhotoOutput} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_PhotoOutput Camera_PhotoOutput; +/** + * @brief Photo output frame start callback to be called in {@link PhotoOutput_Callbacks}. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @since 11 + */ typedef void (*OH_PhotoOutput_OnFrameStart)(Camera_PhotoOutput* photoOutput); +/** + * @brief Photo output frame shutter callback to be called in {@link PhotoOutput_Callbacks}. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @param info the {@link Camera_FrameShutterInfo} which delivered by the callback. + * @since 11 + */ typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, Camera_FrameShutterInfo* info); +/** + * @brief Photo output frame end callback to be called in {@link PhotoOutput_Callbacks}. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @param frameCount the frame count which delivered by the callback. + * @since 11 + */ typedef void (*OH_PhotoOutput_OnFrameEnd)(Camera_PhotoOutput* photoOutput, int32_t frameCount); +/** + * @brief Photo output error callback to be called in {@link PhotoOutput_Callbacks}. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the photo output. + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_PhotoOutput_OnError)(Camera_PhotoOutput* photoOutput, Camera_ErrorCode errorCode); +/** + * @brief A listener for photo output. + * + * @see OH_PhotoOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct PhotoOutput_Callbacks { + /** + * Photo output frame start event. + */ OH_PhotoOutput_OnFrameStart onFrameStart; + + /** + * Photo output frame shutter event. + */ OH_PhotoOutput_OnFrameShutter onFrameShutter; + + /** + * Photo output frame end event. + */ OH_PhotoOutput_OnFrameEnd onFrameEnd; + + /** + * Photo output error event. + */ OH_PhotoOutput_OnError onError; } PhotoOutput_Callbacks; /** + * @brief Register photo output change event callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link PhotoOutput_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); /** + * @brief Unregister photo output change event callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link PhotoOutput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); /** + * @brief Capture photo. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to capture photo. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_RUNNING} if the capture session not running. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput); /** + * @brief Capture photo with capture setting. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to capture photo. + * @param setting the {@link Camera_PhotoCaptureSetting} to used to capture photo. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_RUNNING} if the capture session not running. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput, Camera_PhotoCaptureSetting setting); /** + * @brief Release photo output. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance to released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); /** + * @brief Check whether to support mirror photo. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to check whether mirror supported. + * @param isSupported the result of whether mirror supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); diff --git a/interfaces/kits/native/include/camera/preview_output.h b/interfaces/kits/native/include/camera/preview_output.h index 70424ce55..f9603fa1c 100644 --- a/interfaces/kits/native/include/camera/preview_output.h +++ b/interfaces/kits/native/include/camera/preview_output.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file preview_output.h + * + * @brief Declare the preview output concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H #define NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H @@ -25,17 +36,50 @@ extern "C" { #endif /** + * @brief Preview output object + * + * A pointer can be created using {@link Camera_PreviewOutput} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_PreviewOutput Camera_PreviewOutput; +/** + * @brief Preview output frame start callback to be called in {@link PreviewOutput_Callbacks}. + * + * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. + * @since 11 + */ typedef void (*OH_PreviewOutput_OnFrameStart)(Camera_PreviewOutput* previewOutput); +/** + * @brief Preview output frame end callback to be called in {@link PreviewOutput_Callbacks}. + * + * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. + * @param frameCount the frame count which delivered by the callback. + * @since 11 + */ typedef void (*OH_PreviewOutput_OnFrameEnd)(Camera_PreviewOutput* previewOutput, int32_t frameCount); +/** + * @brief Preview output error callback to be called in {@link PreviewOutput_Callbacks}. + * + * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the preview output. + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_PreviewOutput_OnError)(Camera_PreviewOutput* previewOutput, Camera_ErrorCode errorCode); +/** + * @brief A listener for preview output. + * + * @see OH_PreviewOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct PreviewOutput_Callbacks { OH_PreviewOutput_OnFrameStart onFrameStart; OH_PreviewOutput_OnFrameEnd onFrameEnd; -- Gitee From c6d4388e453c4522b9c4860cb531df6d51ae32fb Mon Sep 17 00:00:00 2001 From: lengye Date: Sun, 5 Nov 2023 18:01:26 +0800 Subject: [PATCH 2/3] add ndk inteface description Signed-off-by: lengye --- .../native/include/camera/capture_session.h | 374 +++++++++++++++--- .../native/include/camera/metadata_output.h | 1 - .../native/include/camera/preview_output.h | 47 ++- .../kits/native/include/camera/video_output.h | 91 ++++- 4 files changed, 456 insertions(+), 57 deletions(-) diff --git a/interfaces/kits/native/include/camera/capture_session.h b/interfaces/kits/native/include/camera/capture_session.h index 42ecba0bd..46ccddbac 100644 --- a/interfaces/kits/native/include/camera/capture_session.h +++ b/interfaces/kits/native/include/camera/capture_session.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file capture_session.h + * + * @brief Declare the capture Session concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H #define NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H @@ -30,274 +41,545 @@ extern "C" { #endif /** + * @brief Capture session object + * + * A pointer can be created using {@link Camera_CaptureSession} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_CaptureSession Camera_CaptureSession; +/** + * @brief Capture session focus state callback to be called in {@link CaptureSession_Callbacks}. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param focusState the {@link Camera_FocusState} which delivered by the callback. + * @since 11 + */ typedef void (*OH_CaptureSession_OnFocusStateChange)(Camera_CaptureSession* session, Camera_FocusState focusState); +/** + * @brief Capture session error callback to be called in {@link CaptureSession_Callbacks}. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the capture session. + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera_ErrorCode errorCode); +/** + * @brief A listener for capture session. + * + * @see OH_CaptureSession_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct CaptureSession_Callbacks { + /** + * Capture session focus state change event. + */ OH_CaptureSession_OnFocusStateChange onFocusStateChange; + + /** + * Capture session error event. + */ OH_CaptureSession_OnError onError; } CaptureSession_Callbacks; /** + * @brief Register capture session event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param callback the {@link CaptureSession_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, CaptureSession_Callbacks* callback); /** + * @brief Unregister capture session event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param callback the {@link CaptureSession_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session, CaptureSession_Callbacks* callback); /** + * @brief Begin capture session config. + * + * @param session the {@link Camera_CaptureSession} instance. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_CONFIG_LOCKED} if session config locked. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session); /** + * @brief Commit capture session config. + * + * @param session the {@link Camera_CaptureSession} instance. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session); /** + * @brief Add a camera input. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param cameraInput the target {@link Camera_Input} to add. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput); /** + * @brief Remove a camera input. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param cameraInput the target {@link Camera_Input} to remove. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput); /** + * @brief Add a preview output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param previewOutput the target {@link Camera_PreviewOutput} to add. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session, Camera_PreviewOutput* previewOutput); /** + * @brief Remove a preview output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param previewOutput the target {@link Camera_PreviewOutput} to remove. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session, Camera_PreviewOutput* previewOutput); /** + * @brief Add a photo output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param photoOutput the target {@link Camera_PhotoOutput} to add. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); /** + * @brief Remove a photo output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param photoOutput the target {@link Camera_PhotoOutput} to remove. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); /** + * @brief Add a video output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param videoOutput the target {@link Camera_VideoOutput} to add. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); /** + * @brief Remove a video output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param videoOutput the target {@link Camera_VideoOutput} to remove. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); /** + * @brief Add a metadata output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param metadataOutput the target {@link Camera_MetadataOutput} to add. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session, Camera_MetadataOutput* metadataOutput); /** + * @brief Remove a metadata output. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param metadataOutput the target {@link Camera_MetadataOutput} to remove. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_OPERATION_NOT_ALLOWED} if operation not allowed. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session, Camera_MetadataOutput* metadataOutput); /** + * @brief Start capture session. + * + * @param session the {@link Camera_CaptureSession} instance to be started. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #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 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session); /** + * @brief Stop capture session. + * + * @param session the {@link Camera_CaptureSession} instance to be stoped. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session); /** + * @brief Release capture session. + * + * @param session the {@link Camera_CaptureSession} instance to be release. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session); /** + * @brief Check if device has flash light. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param hasFlash the result of whether flash supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash); /** + * @brief Check whether a specified flash mode is supported. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param flashMode the {@link Camera_FlashMode} to be checked. + * @param isSupported the result of whether flash mode supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session, Camera_FlashMode flashMode, bool* isSupported); /** + * @brief Get current flash mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param flashMode the current {@link Camera_FlashMode}. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode); /** + * @brief Set flash mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param flashMode the target {@link Camera_FlashMode} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode); /** + * @brief Check whether a specified exposure mode is supported. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureMode the {@link Camera_ExposureMode} to be checked. + * @param isSupported the result of whether exposure mode supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session, Camera_ExposureMode exposureMode, bool* isSupported); /** + * @brief Get current exposure mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureMode the current {@link Camera_ExposureMode}. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode); /** + * @brief Set exposure mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureMode the target {@link Camera_ExposureMode} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode); /** + * @brief Get current metering point. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param point the current {@link Camera_Point} metering point. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point); /** + * @brief Set the center point of the metering area. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param point the target {@link Camera_Point} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point); /** + * @brief Query the exposure compensation range. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param minExposureBias the minimum of exposure compensation. + * @param maxExposureBias the Maximum of exposure compensation. + * @param step the step of exposure compensation between each level. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session, float* minExposureBias, float* maxExposureBias, float* step); /** + * @brief Set exposure compensation. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureBias the target exposure compensation to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ - Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias); -Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias); - -Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point); - /** + * @brief Get current exposure compensation. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureBias the current exposure compensation. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ -Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point); +Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias); /** + * @brief Check whether a specified focus mode is supported. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param focusMode the {@link Camera_FocusMode} to be checked. + * @param isSupported the result of whether focus mode supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session, Camera_FocusMode focusMode, bool* isSupported); /** + * @brief Get current focus mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param exposureBias the current {@link Camera_FocusMode}. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode); /** + * @brief Set focus mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param focusMode the target {@link Camera_FocusMode} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode); /** + * @brief Get current focus point. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param focusPoint the current {@link Camera_Point}. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint); /** + * @brief Set focus point. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param focusPoint the target {@link Camera_Point} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint); /** + * @brief Get all supported zoom ratio range. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param minZoom the minimum of zoom ratio range. + * @param maxZoom the Maximum of zoom ratio range. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom); /** + * @brief Get current zoom ratio. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param zoom the current zoom ratio. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom); /** + * @brief Set zoom ratio. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param zoom the target zoom ratio to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom); /** + * @brief Check whether a specified video stabilization mode is supported. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param mode the {@link Camera_VideoStabilizationMode} to be checked. + * @param isSupported the result of whether video stabilization mode supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session, Camera_VideoStabilizationMode mode, bool* isSupported); /** + * @brief Get current video stabilization mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param mode the current {@link Camera_VideoStabilizationMode}. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session, Camera_VideoStabilizationMode* mode); /** + * @brief Set video stabilization mode. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param mode the target {@link Camera_VideoStabilizationMode} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session, Camera_VideoStabilizationMode mode); diff --git a/interfaces/kits/native/include/camera/metadata_output.h b/interfaces/kits/native/include/camera/metadata_output.h index 67b009c02..26d7f93ea 100644 --- a/interfaces/kits/native/include/camera/metadata_output.h +++ b/interfaces/kits/native/include/camera/metadata_output.h @@ -128,7 +128,6 @@ Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput); * @param metadataOutput the {@link Camera_MetadataOutput} instance to be stoped. * @return {@link #CAMERA_OK} if the method call succeeds. * {@link #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 11 */ diff --git a/interfaces/kits/native/include/camera/preview_output.h b/interfaces/kits/native/include/camera/preview_output.h index f9603fa1c..290b77fae 100644 --- a/interfaces/kits/native/include/camera/preview_output.h +++ b/interfaces/kits/native/include/camera/preview_output.h @@ -81,40 +81,77 @@ typedef void (*OH_PreviewOutput_OnError)(Camera_PreviewOutput* previewOutput, Ca * @version 1.0 */ typedef struct PreviewOutput_Callbacks { + /** + * Preview output frame start event. + */ OH_PreviewOutput_OnFrameStart onFrameStart; + + /** + * Preview output frame end event. + */ OH_PreviewOutput_OnFrameEnd onFrameEnd; + + /** + * Preview output error event. + */ OH_PreviewOutput_OnError onError; } PreviewOutput_Callbacks; /** + * @brief Register preview output change event callback. + * + * @param previewOutput the {@link Camera_PreviewOutput} instance. + * @param callback the {@link PreviewOutput_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PreviewOutput_RegisterCallback(Camera_PreviewOutput* previewOutput, PreviewOutput_Callbacks* callback); /** + * @brief Unregister preview output change event callback. + * + * @param previewOutput the {@link Camera_PreviewOutput} instance. + * @param callback the {@link PreviewOutput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PreviewOutput_UnregisterCallback(Camera_PreviewOutput* previewOutput, PreviewOutput_Callbacks* callback); /** + * @brief Start preview output. + * + * @param previewOutput the {@link Camera_PreviewOutput} instance to be started. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #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 11 - * @version 1.0 */ Camera_ErrorCode OH_PreviewOutput_Start(Camera_PreviewOutput* previewOutput); /** + * @brief Stop preview output. + * + * @param previewOutput the {@link Camera_PreviewOutput} instance to be stoped. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PreviewOutput_Stop(Camera_PreviewOutput* previewOutput); /** + * @brief Release preview output. + * + * @param previewOutput the {@link Camera_PreviewOutput} instance to be released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_PreviewOutput_Release(Camera_PreviewOutput* previewOutput); diff --git a/interfaces/kits/native/include/camera/video_output.h b/interfaces/kits/native/include/camera/video_output.h index e8f59dd70..cb580b4c6 100644 --- a/interfaces/kits/native/include/camera/video_output.h +++ b/interfaces/kits/native/include/camera/video_output.h @@ -13,6 +13,17 @@ * limitations under the License. */ +/** + * @file video_output.h + * + * @brief Declare the video output concepts. + * + * @library libcamera_ndk.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + #ifndef NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H #define NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H @@ -25,50 +36,120 @@ extern "C" { #endif /** + * @brief Video output object + * + * A pointer can be created using {@link Camera_VideoOutput} method. + * * @since 11 * @version 1.0 */ typedef struct Camera_VideoOutput Camera_VideoOutput; +/** + * @brief Video output frame start callback to be called in {@link VideoOutput_Callbacks}. + * + * @param videoOutput the {@link Camera_VideoOutput} which deliver the callback. + * @since 11 + */ typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput); +/** + * @brief Video output frame end callback to be called in {@link VideoOutput_Callbacks}. + * + * @param videoOutput the {@link Camera_VideoOutput} which deliver the callback. + * @param frameCount the frame count which delivered by the callback. + * @since 11 + */ typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount); +/** + * @brief Video output error callback to be called in {@link VideoOutput_Callbacks}. + * + * @param videoOutput the {@link Camera_VideoOutput} which deliver the callback. + * @param errorCode the {@link Camera_ErrorCode} of the video output. + * + * @see CAMERA_SERVICE_FATAL_ERROR + * @since 11 + */ typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode); +/** + * @brief A listener for video output. + * + * @see OH_VideoOutput_RegisterCallback + * @since 11 + * @version 1.0 + */ typedef struct VideoOutput_Callbacks { + /** + * Video output frame start event. + */ OH_VideoOutput_OnFrameStart onFrameStart; + + /** + * Video output frame end event. + */ OH_VideoOutput_OnFrameEnd onFrameEnd; + + /** + * Video output error event. + */ OH_VideoOutput_OnError onError; } VideoOutput_Callbacks; /** + * @brief Register video output change event callback. + * + * @param videoOutput the {@link Camera_VideoOutput} instance. + * @param callback the {@link VideoOutput_Callbacks} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); /** + * @brief Unregister video output change event callback. + * + * @param videoOutput the {@link Camera_VideoOutput} instance. + * @param callback the {@link VideoOutput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); /** + * @brief Start video output. + * + * @param videoOutput the {@link Camera_VideoOutput} instance to be started. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #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 11 - * @version 1.0 */ Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput); /** + * @brief Stop video output. + * + * @param videoOutput the {@link Camera_VideoOutput} instance to be stoped. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput); /** + * @brief Release video output. + * + * @param videoOutput the {@link Camera_VideoOutput} instance to be released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. * @since 11 - * @version 1.0 */ Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput); -- Gitee From fba7003dffbdfc16edba5c3d4562eae6fda7c512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Ccold=5Fyixiu=E2=80=9D?= Date: Sun, 5 Nov 2023 20:17:28 +0800 Subject: [PATCH 3/3] fix code check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: “cold_yixiu” --- .../kits/native/include/camera/camera.h | 30 +++++++++---------- .../kits/native/include/camera/camera_input.h | 2 +- .../native/include/camera/camera_manager.h | 2 +- .../native/include/camera/capture_session.h | 2 +- .../native/include/camera/metadata_output.h | 2 +- .../kits/native/include/camera/photo_output.h | 2 +- .../native/include/camera/preview_output.h | 2 +- .../kits/native/include/camera/video_output.h | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/interfaces/kits/native/include/camera/camera.h b/interfaces/kits/native/include/camera/camera.h index 09f825357..f4036c0dc 100644 --- a/interfaces/kits/native/include/camera/camera.h +++ b/interfaces/kits/native/include/camera/camera.h @@ -15,7 +15,7 @@ /** * @file camera.h - * + * * @brief Declare the camera base concepts. * * @library libcamera_ndk.so @@ -438,7 +438,7 @@ typedef enum Camera_MetadataObjectType { /** * @brief Size parameter. - * + * * @since 11 * @version 1.0 */ @@ -456,7 +456,7 @@ typedef struct Camera_Size { /** * @brief Profile for camera streams. - * + * * @since 11 * @version 1.0 */ @@ -474,7 +474,7 @@ typedef struct Camera_Profile { /** * @brief Frame rate range. - * + * * @since 11 * @version 1.0 */ @@ -492,7 +492,7 @@ typedef struct Camera_FrameRateRange { /** * @brief Video profile. - * + * * @since 11 * @version 1.0 */ @@ -515,7 +515,7 @@ typedef struct Camera_VideoProfile { /** * @brief Camera output capability. - * + * * @since 11 * @version 1.0 */ @@ -563,7 +563,7 @@ typedef struct Camera_OutputCapability { /** * @brief Camera device object. - * + * * @since 11 * @version 1.0 */ @@ -591,7 +591,7 @@ typedef struct Camera_Device { /** * @brief Camera status info. - * + * * @since 11 * @version 1.0 */ @@ -609,7 +609,7 @@ typedef struct Camera_StatusInfo { /** * @brief Point parameter. - * + * * @since 11 * @version 1.0 */ @@ -627,7 +627,7 @@ typedef struct Camera_Point { /** * @brief Photo capture location. - * + * * @since 11 * @version 1.0 */ @@ -650,7 +650,7 @@ typedef struct Camera_Location { /** * @brief Photo capture options to set. - * + * * @since 11 * @version 1.0 */ @@ -678,7 +678,7 @@ typedef struct Camera_PhotoCaptureSetting { /** * @brief Frame shutter callback info. - * + * * @since 11 * @version 1.0 */ @@ -696,7 +696,7 @@ typedef struct Camera_FrameShutterInfo { /** * @brief Capture end info. - * + * * @since 11 * @version 1.0 */ @@ -714,7 +714,7 @@ typedef struct Camera_CaptureEndInfo { /** * @brief Rectangle definition. - * + * * @since 11 * @version 1.0 */ @@ -742,7 +742,7 @@ typedef struct Camera_Rect { /** * @brief Metadata object basis. - * + * * @since 11 * @version 1.0 */ diff --git a/interfaces/kits/native/include/camera/camera_input.h b/interfaces/kits/native/include/camera/camera_input.h index db511efda..5d623debd 100644 --- a/interfaces/kits/native/include/camera/camera_input.h +++ b/interfaces/kits/native/include/camera/camera_input.h @@ -15,7 +15,7 @@ /** * @file camera_input.h - * + * * @brief Declare the camera input concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/camera_manager.h b/interfaces/kits/native/include/camera/camera_manager.h index e2a741688..a1f6cf0c8 100644 --- a/interfaces/kits/native/include/camera/camera_manager.h +++ b/interfaces/kits/native/include/camera/camera_manager.h @@ -15,7 +15,7 @@ /** * @file camera_manager.h - * + * * @brief Declare the camera manager concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/capture_session.h b/interfaces/kits/native/include/camera/capture_session.h index 46ccddbac..fe341e045 100644 --- a/interfaces/kits/native/include/camera/capture_session.h +++ b/interfaces/kits/native/include/camera/capture_session.h @@ -15,7 +15,7 @@ /** * @file capture_session.h - * + * * @brief Declare the capture Session concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/metadata_output.h b/interfaces/kits/native/include/camera/metadata_output.h index 26d7f93ea..5139ee0d5 100644 --- a/interfaces/kits/native/include/camera/metadata_output.h +++ b/interfaces/kits/native/include/camera/metadata_output.h @@ -15,7 +15,7 @@ /** * @file metadata_output.h - * + * * @brief Declare the metadata output concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/photo_output.h b/interfaces/kits/native/include/camera/photo_output.h index e386e997d..b2037b99e 100644 --- a/interfaces/kits/native/include/camera/photo_output.h +++ b/interfaces/kits/native/include/camera/photo_output.h @@ -15,7 +15,7 @@ /** * @file photo_output.h - * + * * @brief Declare the photo output concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/preview_output.h b/interfaces/kits/native/include/camera/preview_output.h index 290b77fae..96838c3c2 100644 --- a/interfaces/kits/native/include/camera/preview_output.h +++ b/interfaces/kits/native/include/camera/preview_output.h @@ -15,7 +15,7 @@ /** * @file preview_output.h - * + * * @brief Declare the preview output concepts. * * @library libcamera_ndk.so diff --git a/interfaces/kits/native/include/camera/video_output.h b/interfaces/kits/native/include/camera/video_output.h index cb580b4c6..6c9529741 100644 --- a/interfaces/kits/native/include/camera/video_output.h +++ b/interfaces/kits/native/include/camera/video_output.h @@ -15,7 +15,7 @@ /** * @file video_output.h - * + * * @brief Declare the video output concepts. * * @library libcamera_ndk.so -- Gitee