diff --git a/multimedia/camera_framework/BUILD.gn b/multimedia/camera_framework/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..15bad5192e03b8daedd11a4097829540b32027e5 --- /dev/null +++ b/multimedia/camera_framework/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (C) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("camera_ndk_header") { + dest_dir = "$ndk_headers_out_dir/ohcamera" + sources = [ + "./camera.h", + "./camera_input.h", + "./camera_manager.h", + "./capture_session.h", + "./metadata_output.h", + "./photo_output.h", + "./preview_output.h", + "./video_output.h", + ] +} + +ohos_ndk_library("libohcamera") { + output_name = "ohcamera" + output_extension = "so" + ndk_description_file = "./camera.ndk.json" + system_capability = "SystemCapability.Multimedia.Camera.Core" + system_capability_headers = [ + "ohcamera/camera.h", + "ohcamera/camera_manager.h", + "ohcamera/camera_input.h", + "ohcamera/capture_session.h", + "ohcamera/metadata_output.h", + "ohcamera/photo_output.h", + "ohcamera/preview_output.h", + "ohcamera/video_output.h", + ] +} diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h new file mode 100644 index 0000000000000000000000000000000000000000..5e32272de8224dc06daee1d5598c4e975ee05f3c --- /dev/null +++ b/multimedia/camera_framework/camera.h @@ -0,0 +1,807 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera.h + * + * @brief Declare the camera base concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief camera manager object. + * + * A pointer can be created using {@link OH_Camera_GetCameraManager} method. + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Manager Camera_Manager; + +/** + * @brief Enum for camera error code. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ErrorCode { + /** + * Camera result is ok. + */ + CAMERA_OK = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_INVALID_ARGUMENT = 7400101, + + /** + * Operation not allowed. + */ + CAMERA_OPERATION_NOT_ALLOWED = 7400102, + + /** + * Session not config. + */ + CAMERA_SESSION_NOT_CONFIG = 7400103, + + /** + * Session not running. + */ + CAMERA_SESSION_NOT_RUNNING = 7400104, + + /** + * Session config locked. + */ + CAMERA_SESSION_CONFIG_LOCKED = 7400105, + + /** + * Device setting locked. + */ + CAMERA_DEVICE_SETTING_LOCKED = 7400106, + + /** + * Can not use camera cause of conflict. + */ + CAMERA_CONFLICT_CAMERA = 7400107, + + /** + * Camera disabled cause of security reason. + */ + CAMERA_DEVICE_DISABLED = 7400108, + + /** + * Can not use camera cause of preempted. + */ + CAMERA_DEVICE_PREEMPTED = 7400109, + + /** + * Camera service fatal error. + */ + CAMERA_SERVICE_FATAL_ERROR = 7400201 +} Camera_ErrorCode; + +/** + * @brief Enum for camera status. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Status { + /** + * Appear status. + */ + CAMERA_STATUS_APPEAR = 0, + + /** + * Disappear status. + */ + CAMERA_STATUS_DISAPPEAR = 1, + + /** + * Available status. + */ + CAMERA_STATUS_AVAILABLE = 2, + + /** + * Unavailable status. + */ + CAMERA_STATUS_UNAVAILABLE = 3 +} Camera_Status; + +/** + * @brief Enum for camera position. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Position { + /** + * Unspecified position. + */ + CAMERA_POSITION_UNSPECIFIED = 0, + + /** + * Back position. + */ + CAMERA_POSITION_BACK = 1, + + /** + * Front position. + */ + CAMERA_POSITION_FRONT = 2 +} Camera_Position; + +/** + * @brief Enum for camera type. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Type { + /** + * Default camera type. + */ + CAMERA_TYPE_DEFAULT = 0, + + /** + * Wide camera. + */ + CAMERA_TYPE_WIDE_ANGLE = 1, + + /** + * Ultra wide camera. + */ + CAMERA_TYPE_ULTRA_WIDE = 2, + + /** + * Telephoto camera. + */ + CAMERA_TYPE_TELEPHOTO = 3, + + /** + * True depth camera. + */ + CAMERA_TYPE_TRUE_DEPTH = 4 +} Camera_Type; + +/** + * @brief Enum for camera connection type. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Connection { + /** + * Built-in camera. + */ + CAMERA_CONNECTION_BUILT_IN = 0, + + /** + * Camera connected using USB. + */ + CAMERA_CONNECTION_USB_PLUGIN = 1, + + /** + * Remote camera. + */ + CAMERA_CONNECTION_REMOTE = 2 +} Camera_Connection; + +/** + * @brief Enum for camera format type. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_Format { + /** + * RGBA 8888 Format. + */ + CAMERA_FORMAT_RGBA_8888 = 3, + + /** + * YUV 420 Format. + */ + CAMERA_FORMAT_YUV_420_SP = 1003, + + /** + * JPEG Format. + */ + CAMERA_FORMAT_JPEG = 2000 +} Camera_Format; + +/** + * @brief Enum for flash mode. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FlashMode { + /** + * Close mode. + */ + FLASH_MODE_CLOSE = 0, + + /** + * Open mode. + */ + FLASH_MODE_OPEN = 1, + + /** + * Auto mode. + */ + FLASH_MODE_AUTO = 2, + + /** + * Always open mode. + */ + FLASH_MODE_ALWAYS_OPEN = 3 +} Camera_FlashMode; + +/** + * @brief Enum for exposure mode. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ExposureMode { + /** + * Lock exposure mode. + */ + EXPOSURE_MODE_LOCKED = 0, + + /** + * Auto exposure mode. + */ + EXPOSURE_MODE_AUTO = 1, + + /** + * Continuous automatic exposure. + */ + EXPOSURE_MODE_CONTINUOUS_AUTO = 2 +} Camera_ExposureMode; + +/** + * @brief Enum for focus mode. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FocusMode { + /** + * Manual mode. + */ + FOCUS_MODE_MANUAL = 0, + + /** + * Continuous auto mode. + */ + FOCUS_MODE_CONTINUOUS_AUTO = 1, + + /** + * Auto mode. + */ + FOCUS_MODE_AUTO = 2, + + /** + * Locked mode. + */ + FOCUS_MODE_LOCKED = 3 +} Camera_FocusMode; + +/** + * @brief Enum for focus state. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_FocusState { + /** + * Scan state. + */ + FOCUS_STATE_SCAN = 0, + + /** + * Focused state. + */ + FOCUS_STATE_FOCUSED = 1, + + /** + * Unfocused state. + */ + FOCUS_STATE_UNFOCUSED = 2 +} Camera_FocusState; + +/** + * @brief Enum for video stabilization mode. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_VideoStabilizationMode { + /** + * Turn off video stablization. + */ + STABILIZATION_MODE_OFF = 0, + + /** + * LOW mode provides basic stabilization effect. + */ + STABILIZATION_MODE_LOW = 1, + + /** + * MIDDLE mode means algorithms can achieve better effects than LOW mode. + */ + STABILIZATION_MODE_MIDDLE = 2, + + /** + * HIGH mode means algorithms can achieve better effects than MIDDLE mode. + */ + STABILIZATION_MODE_HIGH = 3, + + /** + * Camera HDF can select mode automatically. + */ + STABILIZATION_MODE_AUTO = 4 +} Camera_VideoStabilizationMode; + +/** + * @brief Enum for the image rotation angles. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_ImageRotation { + /** + * The capture image rotates 0 degrees. + */ + IAMGE_ROTATION_0 = 0, + + /** + * The capture image rotates 90 degrees. + */ + IAMGE_ROTATION_90 = 90, + + /** + * The capture image rotates 180 degrees. + */ + IAMGE_ROTATION_180 = 180, + + /** + * The capture image rotates 270 degrees. + */ + IAMGE_ROTATION_270 = 270 +} Camera_ImageRotation; + +/** + * @brief Enum for the image quality levels. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_QualityLevel { + /** + * High image quality. + */ + QUALITY_LEVEL_HIGH = 0, + + /** + * Medium image quality. + */ + QUALITY_LEVEL_MEDIUM = 1, + + /** + * Low image quality. + */ + QUALITY_LEVEL_LOW = 2 +} Camera_QualityLevel; + +/** + * @brief Enum for metadata object type. + * + * @since 11 + * @version 1.0 + */ +typedef enum Camera_MetadataObjectType { + /** + * Face detection. + */ + FACE_DETECTION = 0 +} Camera_MetadataObjectType; + +/** + * @brief Size parameter. + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Size { + /** + * Width. + */ + uint32_t width; + + /** + * Height. + */ + uint32_t height; +} Camera_Size; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @brief Point parameter. + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Point { + /** + * X co-ordinate. + */ + double x; + + /** + * Y co-ordinate. + */ + double y; +} Camera_Point; + +/** + * @brief Photo capture location. + * + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Location { + /** + * Latitude. + */ + double latitude; + + /** + * Longitude. + */ + double longitude; + + /** + * Altitude. + */ + double altitude; +} Camera_Location; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @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; + +/** + * @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 + */ +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 + */ +Camera_ErrorCode OH_Camera_DeleteCameraManager(Camera_Manager* cameraManager); + + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..0e19285a3c7d2d77b8f7429d6cc5bc12da6c35bb --- /dev/null +++ b/multimedia/camera_framework/camera.ndk.json @@ -0,0 +1,318 @@ +[ + { + "first_introduced": "11", + "name": "OH_CameraInput_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CameraInput_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CameraInput_Open" + }, + { + "first_introduced": "11", + "name": "OH_CameraInput_Close" + }, + { + "first_introduced": "11", + "name": "OH_CameraInput_Release" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_GetSupportedCameras" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_GetSupportedCameraOutputCapability" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_IsCameraMuted" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreateCaptureSession" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreateCameraInput" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreateCameraInput_WithPositionAndType" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreatePreviewOutput" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreatePhotoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreateVideoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CameraManager_CreateMetadataOutput" + }, + { + "first_introduced": "11", + "name": "OH_Camera_GetCameraManager" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_BeginConfig" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_CommitConfig" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_AddInput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RemoveInput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_AddPreviewOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RemovePreviewOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_AddPhotoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RemovePhotoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_AddVideoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RemoveVideoOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_AddMetadataOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_RemoveMetadataOutput" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_Start" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_Stop" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_Release" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_HasFlash" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_IsFlashModeSupported" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetFlashMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetFlashMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_IsExposureModeSupported" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetExposureMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetExposureMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetMeteringPoint" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetMeteringPoint" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetExposureBiasRange" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetExposureBias" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetExposureBias" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_IsFocusModeSupported" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetFocusMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetFocusMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetFocusPoint" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetFocusPoint" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetZoomRatioRange" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetZoomRatio" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetZoomRatio" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_IsVideoStabilizationModeSupported" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_GetVideoStabilizationMode" + }, + { + "first_introduced": "11", + "name": "OH_CaptureSession_SetVideoStabilizationMode" + }, + { + "first_introduced": "11", + "name": "OH_MetadataOutput_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_MetadataOutput_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_MetadataOutput_Start" + }, + { + "first_introduced": "11", + "name": "OH_MetadataOutput_Stop" + }, + { + "first_introduced": "11", + "name": "OH_MetadataOutput_Release" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_Capture" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_Capture_WithCaptureSetting" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_Release" + }, + { + "first_introduced": "11", + "name": "OH_PhotoOutput_IsMirrorSupported" + }, + { + "first_introduced": "11", + "name": "OH_PreviewOutput_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_PreviewOutput_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_PreviewOutput_Start" + }, + { + "first_introduced": "11", + "name": "OH_PreviewOutput_Stop" + }, + { + "first_introduced": "11", + "name": "OH_PreviewOutput_Release" + }, + { + "first_introduced": "11", + "name": "OH_VideoOutput_RegisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_VideoOutput_UnregisterCallback" + }, + { + "first_introduced": "11", + "name": "OH_VideoOutput_Start" + }, + { + "first_introduced": "11", + "name": "OH_VideoOutput_Stop" + }, + { + "first_introduced": "11", + "name": "OH_VideoOutput_Release" + } +] diff --git a/multimedia/camera_framework/camera_input.h b/multimedia/camera_framework/camera_input.h new file mode 100644 index 0000000000000000000000000000000000000000..248de5e94bf0fc352915c7e0a21c00d69a919d78 --- /dev/null +++ b/multimedia/camera_framework/camera_input.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera_input.h + * + * @brief Declare the camera input concepts. + * + * @library libohcamera.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 + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/camera_manager.h b/multimedia/camera_framework/camera_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..dbed87a0f21d3399eab5ac30a1d19e338d9f286c --- /dev/null +++ b/multimedia/camera_framework/camera_manager.h @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file camera_manager.h + * + * @brief Declare the camera manager concepts. + * + * @library libohcamera.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 + +#include +#include +#include "camera.h" +#include "camera_input.h" +#include "capture_session.h" +#include "preview_output.h" +#include "video_output.h" +#include "photo_output.h" +#include "metadata_output.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, + const Camera_MetadataObjectType* profile, Camera_MetadataOutput** metadataOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_MANAGER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h new file mode 100644 index 0000000000000000000000000000000000000000..b054a5d3549007fa8683ae196fde0e6df022a2f5 --- /dev/null +++ b/multimedia/camera_framework/capture_session.h @@ -0,0 +1,604 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file capture_session.h + * + * @brief Declare the capture Session concepts. + * + * @library libohcamera.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 + +#include +#include +#include "camera.h" +#include "camera_input.h" +#include "preview_output.h" +#include "photo_output.h" +#include "video_output.h" +#include "metadata_output.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias); + +/** + * @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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_SESSION_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/metadata_output.h b/multimedia/camera_framework/metadata_output.h new file mode 100644 index 0000000000000000000000000000000000000000..1abf5a5eabfa47e9883a7ca53f7e914c7a4ba3af --- /dev/null +++ b/multimedia/camera_framework/metadata_output.h @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file metadata_output.h + * + * @brief Declare the metadata output concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 11 + */ +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 + */ +Camera_ErrorCode OH_MetadataOutput_Release(Camera_MetadataOutput* metadataOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/photo_output.h b/multimedia/camera_framework/photo_output.h new file mode 100644 index 0000000000000000000000000000000000000000..3c32b972a652975053cac55ec7694387b947980b --- /dev/null +++ b/multimedia/camera_framework/photo_output.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file photo_output.h + * + * @brief Declare the photo output concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/preview_output.h b/multimedia/camera_framework/preview_output.h new file mode 100644 index 0000000000000000000000000000000000000000..96b267f9c3ecc529963d1c32a4927411e92f7b6e --- /dev/null +++ b/multimedia/camera_framework/preview_output.h @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file preview_output.h + * + * @brief Declare the preview output concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +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 { + /** + * 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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_PreviewOutput_Release(Camera_PreviewOutput* previewOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/video_output.h b/multimedia/camera_framework/video_output.h new file mode 100644 index 0000000000000000000000000000000000000000..8b50c44bc9a88f7af03eccdb1d160b3ff2510798 --- /dev/null +++ b/multimedia/camera_framework/video_output.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 11 + * @version 1.0 + */ + +/** + * @file video_output.h + * + * @brief Declare the video output concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H +/** @} */ \ No newline at end of file