diff --git a/bundle.json b/bundle.json index 9ba33f7921ece2d6805af83a94a607be0ca74563..ee8fdd26651ec9d51697290c2b2569bcf4327961 100644 --- a/bundle.json +++ b/bundle.json @@ -58,6 +58,7 @@ ], "fwk_group": [ "//foundation/multimedia/camera_framework/frameworks/native/camera:camera_framework", + "//foundation/multimedia/camera_framework/frameworks/native/ndk:camera_ndk", "//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_napi", "//foundation/multimedia/camera_framework/interfaces/kits/js/camera_napi:camera_js" ], diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/.gitignore b/frameworks/native/camera/test/ndktest/camera_ndk_demo/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..dc4e6353bf3caf74c5953d0bec81c72a3635bf33 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/.gitignore @@ -0,0 +1,9 @@ +/node_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/app.json5 b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..335d12e3a1a26d3184e357abcc1dea70b959d5e2 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/app.json5 @@ -0,0 +1,11 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/element/string.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1080233f01384411ec684b58955cb8808746fdd3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + } + ] +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/media/app_icon.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/AppScope/resources/base/media/app_icon.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/build-profile.json5 b/frameworks/native/camera/test/ndktest/camera_ndk_demo/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..141a727843e293ed815c9d70c3efbecfca51b70b --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/build-profile.json5 @@ -0,0 +1,40 @@ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "material": { + "certpath": "C:\\Users\\ts\\.ohos\\config\\openharmony\\auto_ohos_default_NDK_camera_demo_com.example.myapplication.cer", + "storePassword": "0000001B581389A60EA131D3FCFBA79694FB5F1B74B7E7D10EF8424463EBA73B085815DBC32D926DC5F578", + "keyAlias": "debugKey", + "keyPassword": "0000001BBCDD432B3403D8CE7DDA05A292BB2C41737C50BAD0F4D1DD866378C0A59CCACB6A7526BAC0787C", + "profile": "C:\\Users\\ts\\.ohos\\config\\openharmony\\auto_ohos_default_NDK_camera_demo_com.example.myapplication.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\ts\\.ohos\\config\\openharmony\\auto_ohos_default_NDK_camera_demo_com.example.myapplication.p12" + } + } + ], + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/.gitignore b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..5a6ba80fa3d9498a23ae8ae7d9518f8743fa8a96 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/.gitignore @@ -0,0 +1,4 @@ +/node_modules +/.preview +/build +/.cxx \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/build-profile.json5 b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6c56e6c293de27a887242d4c601976bc53641eeb --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/build-profile.json5 @@ -0,0 +1,20 @@ +{ + "apiType": 'stageMode', + "buildOption": { + "externalNativeOptions": { + "path": "./src/main/cpp/CMakeLists.txt", + "arguments": "-v", + "abiFilters": ["armeabi-v7a"], + "cppFlags": "", + } + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/hvigorfile.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package-lock.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..98eb86cafb823e1e5294981baf3190992fa4e1d6 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package-lock.json @@ -0,0 +1,12 @@ +{ + "name": "entry", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/libentry.so": { + "version": "file:src/main/cpp/types/libentry", + "dev": true + } + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7b1ea4bfb388ad9e5779aaada7c5f6080f538618 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/package.json @@ -0,0 +1,16 @@ +{ + "license": "ISC", + "devDependencies": { + "@types/libentry.so": "file:./src/main/cpp/types/libentry" + }, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": {} +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/CMakeLists.txt b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f749583b0bc1612bede51cfc31b2ca8dfb845813 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,11 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(MyApplication3) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) + +add_library(entry SHARED main.cpp camera_manager.cpp) +target_link_libraries(entry PUBLIC libcamera_ndk.so libace_napi.z.so libnative_buffer.so libhilog_ndk.z.so librawfile.z.so) \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..852241e054e36ac20627869110346c7c85c952bd --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.cpp @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2022-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. + */ + +#include "camera_manager.h" + +NDKCamera* NDKCamera::ndkCamera_ = nullptr; +std::mutex NDKCamera::mtx_; + +NDKCamera::NDKCamera(char* str) + : previewSurfaceId_(str), cameras_(nullptr), + cameraOutputCapability_(nullptr), cameraInput_(nullptr), + captureSession_(nullptr), size_(0), + isCameraMuted_(nullptr), profile_(nullptr), + photoSurfaceId_(nullptr), + previewOutput_(nullptr), photoOutput_(nullptr), + metaDataObjectType_(nullptr), metadataOutput_(nullptr), + ret_(CAMERA_OK) +{ + valid_ = false; + Camera_ErrorCode ret = OH_Camera_GetCameraMananger(&cameraManager_); + if (cameraManager_ == nullptr || ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "Get CameraManager failed."); + } + + ret = OH_CameraManager_CreateCaptureSession(cameraManager_, &captureSession_); + if (captureSession_ == nullptr || ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "Create captureSession failed."); + } + GetSupportedCameras(); + GetSupportedOutputCapability(); + CreatePreviewOutput(); + CreateCameraInput(); + CameraInputOpen(); + SessionFlowFn(); + valid_ = true; +} + +NDKCamera::~NDKCamera() +{ + valid_ = false; + + Camera_ErrorCode ret = OH_CaptureSession_Release(captureSession_); + if (ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "Release failed."); + } + + if (cameraManager_) { + cameraManager_ = nullptr; + } + + PreviewOutputStop(); + PreviewOutputRelease(); + PhotoOutputRelease(); +} + +Camera_ErrorCode NDKCamera::HasFlashFn(uint32_t mode) +{ + Camera_FlashMode flashMode = static_cast(mode); + // 检测是否有闪关灯 + bool hasFlash = false; + Camera_ErrorCode ret = OH_CaptureSession_HasFlash(captureSession_, &hasFlash); + if (captureSession_ == nullptr || ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_HasFlash failed."); + } + if (hasFlash) { + OH_LOG_ERROR(LOG_APP, "hasFlash success-----"); + } else { + OH_LOG_ERROR(LOG_APP, "hasFlash fail-----"); + } + + // 检测闪光灯模式是否支持 + bool isSupported = false; + ret = OH_CaptureSession_IsFlashModeSupported(captureSession_, flashMode, &isSupported); + if (ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_IsFlashModeSupported failed."); + } + if (isSupported) { + OH_LOG_ERROR(LOG_APP, "isFlashModeSupported success-----"); + } else { + OH_LOG_ERROR(LOG_APP, "isFlashModeSupported fail-----"); + } + + // 设置闪光灯模式 + ret = OH_CaptureSession_SetFlashMode(captureSession_, flashMode); + if (ret == CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_SetFlashMode success."); + } else { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_SetFlashMode failed. %d ", ret); + } + + // 获取当前设备的闪光灯模式 + ret = OH_CaptureSession_GetFlashMode(captureSession_, &flashMode); + if (ret == CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetFlashMode success. flashMode:%d ", flashMode); + } else { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetFlashMode failed. %d ", ret); + } + return ret; +} + +Camera_ErrorCode NDKCamera::setZoomRatioFn(uint32_t zoomRatio) +{ + float zoom = float(zoomRatio); + // 获取支持的变焦范围 + float minZoom; + float maxZoom; + Camera_ErrorCode ret = OH_CaptureSession_GetZoomRatioRange(captureSession_, &minZoom, &maxZoom); + if (captureSession_ == nullptr || ret != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetZoomRatioRange failed."); + } else { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetZoomRatioRange success. minZoom: %f, maxZoom: %f", + minZoom, maxZoom); + } + + // 设置变焦 + ret = OH_CaptureSession_SetZoomRatio(captureSession_, zoom); + if (ret == CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_SetZoomRatio success."); + } else { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_SetZoomRatio failed. %d ", ret); + } + + // 获取当前设备的变焦值 + ret = OH_CaptureSession_GetZoomRatio(captureSession_, &zoom); + if (ret == CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetZoomRatio success. zoom: %f ", zoom); + } else { + OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_GetZoomRatio failed. %d ", ret); + } + return ret; +} + +Camera_ErrorCode NDKCamera::SessionFlowFn() +{ + OH_LOG_ERROR(LOG_APP, "Start SessionFlowFn IN."); + // 开始配置会话 + OH_LOG_ERROR(LOG_APP, "session beginConfig."); + Camera_ErrorCode ret = OH_CaptureSession_BeginConfig(captureSession_); + + // 把CameraInput加入到会话 + OH_LOG_ERROR(LOG_APP, "session addInput."); + ret = OH_CaptureSession_AddInput(captureSession_, cameraInput_); + + // 把previewOutput加入到会话 + OH_LOG_ERROR(LOG_APP, "session add Preview Output."); + ret = OH_CaptureSession_AddPreviewOutput(captureSession_, previewOutput_); + + // 把photoOutput加入到会话 + OH_LOG_ERROR(LOG_APP, "session add Photo Output."); + + // 提交配置信息 + OH_LOG_ERROR(LOG_APP, "session commitConfig"); + ret = OH_CaptureSession_CommitConfig(captureSession_); + + // 开始会话工作 + OH_LOG_ERROR(LOG_APP, "session start"); + ret = OH_CaptureSession_Start(captureSession_); + OH_LOG_ERROR(LOG_APP, "session success"); + return ret; +} + +Camera_ErrorCode NDKCamera::CreateCameraInput(void) +{ + ret_ = OH_CameraManager_CreateCameraInput(cameraManager_, cameras_, &cameraInput_); + if (cameraInput_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CreateCameraInput failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CameraInputOpen(void) +{ + ret_ = OH_CameraInput_Open(cameraInput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CameraInput_Open failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CameraInputClose(void) +{ + ret_ = OH_CameraInput_Close(ndkCamera_->cameraInput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CameraInput_Close failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CameraInputRelease(void) +{ + ret_ = OH_CameraInput_Release(ndkCamera_->cameraInput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CameraInput_Release failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::GetSupportedCameras(void) +{ + ret_ = OH_CameraManager_GetSupportedCameras(cameraManager_, &cameras_, &size_); + if (cameras_ == nullptr || &size_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "Get supported cameras failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::GetSupportedOutputCapability(void) +{ + ret_ = OH_CameraManager_GetSupportedCameraOutputCapability(cameraManager_, cameras_, &cameraOutputCapability_); + if (cameraOutputCapability_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "GetSupportedCameraOutputCapability failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CreatePreviewOutput(void) +{ + profile_ = cameraOutputCapability_->previewProfiles[0]; + if (profile_ == nullptr) { + OH_LOG_ERROR(LOG_APP, "Get previewProfiles failed."); + return CAMERA_INVALID_ARGUMENT; + } + ret_ = OH_CameraManager_CreatePreviewOutput(cameraManager_, profile_, previewSurfaceId_, &previewOutput_); + if (previewSurfaceId_ == nullptr || previewOutput_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CreatePreviewOutput failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CreatePhotoOutput(void) +{ + profile_ = cameraOutputCapability_->photoProfiles[0]; + if (profile_ == nullptr) { + OH_LOG_ERROR(LOG_APP, "Get photoProfiles failed."); + return CAMERA_INVALID_ARGUMENT; + } + ret_ = OH_CameraManager_CreatePhotoOutput(cameraManager_, profile_, photoSurfaceId_, &photoOutput_); + if (photoSurfaceId_ == nullptr || photoOutput_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CreatePhotoOutput failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::CreateMetadataOutput(void) +{ + metaDataObjectType_ = cameraOutputCapability_->supportedMetadataObjectTypes[2]; // 2:camera metedata types + if (metaDataObjectType_ == nullptr) { + OH_LOG_ERROR(LOG_APP, "Get metaDataObjectType failed."); + return CAMERA_INVALID_ARGUMENT; + } + ret_ = OH_CameraManager_CreateMetadataOutput(cameraManager_, metaDataObjectType_, &metadataOutput_); + if (metadataOutput_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "CreateMetadataOutput failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::IsCameraMuted(void) +{ + ret_ = OH_CameraManager_IsCameraMuted(cameraManager_, isCameraMuted_); + if (isCameraMuted_ == nullptr || ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "IsCameraMuted failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::PreviewOutputStop(void) +{ + ret_ = OH_PreviewOutput_Stop(previewOutput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "PreviewOutputStop failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::PreviewOutputRelease(void) +{ + ret_ = OH_PreviewOutput_Release(previewOutput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "PreviewOutputRelease failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} + +Camera_ErrorCode NDKCamera::PhotoOutputRelease(void) +{ + ret_ = OH_PhotoOutput_Release(photoOutput_); + if (ret_ != CAMERA_OK) { + OH_LOG_ERROR(LOG_APP, "PhotoOutputRelease failed."); + return CAMERA_INVALID_ARGUMENT; + } + return ret_; +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.h b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..46a757c7ed1ddf4b38ea4dbdb00a92a1b054423f --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/camera_manager.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2022-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. + */ + +#ifndef CAMERA_NDK_CAMERA_H +#define CAMERA_NDK_CAMERA_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "iostream" +#include "mutex" + +#include "hilog/log.h" +#include "multimedia/camera_framework/camera.h" +#include "multimedia/camera_framework/camera_input.h" +#include "multimedia/camera_framework/capture_session.h" +#include "multimedia/camera_framework/photo_output.h" +#include "multimedia/camera_framework/preview_output.h" +#include "napi/native_api.h" +#include "multimedia/camera_framework/camera_manager.h" + +class NDKCamera { +public: + ~NDKCamera(); + static NDKCamera* GetInstance(char *str) + { + if (ndkCamera_ == nullptr) { + std::lock_guard lock(mtx_); + if (ndkCamera_ == nullptr) { + ndkCamera_ = new NDKCamera(str); + } + } + return ndkCamera_; + } + + static void Destroy() + { + if (ndkCamera_ != nullptr) { + delete ndkCamera_; + ndkCamera_ = nullptr; + } + } + + void EnumerateCamera(void); + Camera_ErrorCode CreateCameraInput(void); + Camera_ErrorCode CameraInputOpen(void); + Camera_ErrorCode CameraInputClose(void); + Camera_ErrorCode CameraInputRelease(void); + Camera_ErrorCode GetSupportedCameras(void); + Camera_ErrorCode GetSupportedOutputCapability(void); + Camera_ErrorCode CreatePreviewOutput(void); + Camera_ErrorCode CreatePhotoOutput(void); + Camera_ErrorCode CreateMetadataOutput(void); + Camera_ErrorCode IsCameraMuted(void); + Camera_ErrorCode PreviewOutputStop(void); + Camera_ErrorCode PreviewOutputRelease(void); + Camera_ErrorCode PhotoOutputRelease(void); + Camera_ErrorCode HasFlashFn(uint32_t mode); + Camera_ErrorCode setZoomRatioFn(uint32_t zoomRatio); + Camera_ErrorCode SessionFlowFn(); + +private: + explicit NDKCamera(char *str); + NDKCamera(const NDKCamera&) = delete; + NDKCamera& operator = (const NDKCamera&) = delete; + + Camera_Manager* cameraManager_; + Camera_CaptureSession* captureSession_; + Camera_Device* cameras_; + uint32_t size_; + Camera_OutputCapability* cameraOutputCapability_; + const Camera_Profile* profile_; + Camera_PreviewOutput* previewOutput_; + Camera_PhotoOutput* photoOutput_; + const Camera_MetadataObjectType* metaDataObjectType_; + Camera_MetadataOutput* metadataOutput_; + Camera_Input* cameraInput_; + bool* isCameraMuted_; + Camera_Position position_; + Camera_Type type_; + char* previewSurfaceId_; + char* photoSurfaceId_; + Camera_ErrorCode ret_; + + // callback + CameraManager_Callbacks* callback_; + + static NDKCamera* ndkCamera_; + static std::mutex mtx_; + volatile bool valid_; +}; + +#endif // CAMERA_NDK_CAMERA_H \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/main.cpp b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff3a5da1d5fd0f9b955971bfa4b0130895110152 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/main.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2022-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. + */ + +#include +#include +#include "napi/native_api.h" +#include "camera_manager.h" +#include "hilog/log.h" + +static napi_value SetZoomRatio(napi_env env, napi_callback_info info) +{ + size_t requireArgc = 2; + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_value resutl; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + + napi_valuetype valuetype0; + napi_typeof(env, args[0], &valuetype0); + + int32_t zoomRatio; + napi_get_value_int32(env, args[0], &zoomRatio); + + OH_LOG_ERROR(LOG_APP, "zoomRatio : %d", zoomRatio); + + NDKCamera *camera_ = NDKCamera::GetInstance(); + camera_ ->setZoomRatioFn(zoomRatio); + + return resutl; +} + +static napi_value InitCamera(napi_env env, napi_callback_info info) +{ + OH_LOG_ERROR(LOG_APP, "InitCamera Start"); + size_t requireArgc = 2; + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_value resutl; + size_t typeLen = 0; + char* surfaceId = nullptr; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + + napi_get_value_string_utf8(env, args[0], nullptr, 0, &typeLen); + surfaceId = new char[typeLen + 1]; + napi_get_value_string_utf8(env, args[0], surfaceId, typeLen + 1, &typeLen); + + int32_t cameraDeviceIndex; + napi_get_value_int32(env, args[1], &cameraDeviceIndex); + + NDKCamera* ndkCamera = NDKCamera::GetInstance(surfaceId); + OH_LOG_ERROR(LOG_APP, "InitCamera End"); + + return resutl; +} + +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + { "initCamera", nullptr, InitCamera, nullptr, nullptr, nullptr, napi_default, nullptr }, + { "setZoomRatio", nullptr, SetZoomRatio, nullptr, nullptr, nullptr, napi_default, nullptr } + }; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module demoModule = { + .nm_version =1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "entry", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterEntryModule(void) +{ + napi_module_register(&demoModule); +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/index.d.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..312c91f911a764eb3b4a0ede5d7deb5d00ee7a3d --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/index.d.ts @@ -0,0 +1,3 @@ +export const add: (a: number, b: number) => number; +export const initCamera:(surfaceId: string) => number; +export const setZoomRatio: (a: number) => number; \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/package.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cf40ccb0e5667b3cce888d5c36c825b51226576c --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/cpp/types/libentry/package.json @@ -0,0 +1,4 @@ +{ + "name": "libentry.so", + "types": "./index.d.ts" +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/mainDialog.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/mainDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..7af1a352ae62e3a1fbe5fe57e0f8bc7985525c90 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/mainDialog.ets @@ -0,0 +1,104 @@ + +/* + * Copyright (c) 2022-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. + */ + +@CustomDialog +export struct mainDialog { + controller: CustomDialogController + + async aboutToAppear() { + console.info(`CameraZyk aboutToAppear entry`) + } + + build() { + Column() { + Column() { + Text('允许“相机”使用无线数据?') + .fontSize(16) + .fontFamily('HarmonyHeiTi') + .fontColor('#182431') + .width('100%') + .fontWeight(500) + .textAlign(TextAlign.Start) + Text('关闭无线数据时,部分功能可能无法使用。') + .fontSize(10) + .opacity(0.6) + .textAlign(TextAlign.Start) + .width('100%') + .fontFamily('HarmonyHeiTi') + .fontColor('#182431') + .fontWeight(400) + .margin({ top: 2 }) + } + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Auto }) { + Button() { + Text('无线局域网与蜂窝网络') + .fontColor($r('app.color.theme_color')) + .fontSize(14) + .width('100%') + .fontWeight(500) + .height('30%') + .textAlign(TextAlign.Center) + } + .backgroundColor('#FFF') + .onClick(() => { + this.controller.close() + }) + + Button() { + Text('仅限无限局域网') + .fontColor($r('app.color.theme_color')) + .fontSize(14) + .fontWeight(500) + .width('100%') + .height('30%') + .textAlign(TextAlign.Center) + } + .backgroundColor('#FFF') + .onClick(() => { + this.controller.close() + }) + + Button() { + Text('不允许') + .fontColor($r('app.color.theme_color')) + .fontSize(14) + .fontWeight(500) + .width('100%') + .height('30%') + .textAlign(TextAlign.Center) + } + .backgroundColor('#FFF') + .onClick(() => { + this.controller.close() + }) + } + .margin({ top: 10 }) + .height('80%') + .backgroundColor('#FFF') + } + .width('750px') + .height('700px') + .padding({ + top: '3%', + left: '2%', + right: '2%', + bottom: '2%' + }) + .borderRadius(24) + .backgroundColor('#FFF') + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/settingDialog.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/settingDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce7ead43e6e619692398c80d5d9bebf09525dbe6 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/Dialog/settingDialog.ets @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2022-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 { settingPublicLayout } from '../common/settingPublicLayout' + +import { settingRightLayout } from '../common/settingRightLayout' + +// import CameraService from '../model/CameraService' + +@CustomDialog +export struct settingDialog { + private controller: CustomDialogController + @Prop surfaceId: string + @Prop cameraDeviceIndex: number + @Link referenceLineBol: boolean + // 点击的某一个设置的索引 + @State leftSliderIndex: number = 1 + + // 镜像持久化,再次进入,确定开关是否开启 + getMirrorBol(bol) { + globalThis.settingDataObj.mirrorBol = bol + } + // 地理位置持久化,再次进入,确定开关是否开启 + getLocationBol(bol) { + globalThis.settingDataObj.locationBol = bol + } + // 参考线持久化,再次进入,确定开关是否开启 + getReferenceLineBol(bol) { + globalThis.settingDataObj.referenceLineBol = bol + this.referenceLineBol = bol + } + + onPageShow() { + console.info('zyk globalThis onPageShow:' + JSON.stringify(globalThis.settingDataObj)) + } + + onPageHide() { + console.info('zyk globalThis onPageHide:' + JSON.stringify(globalThis.settingDataObj)) + } + + build() { + Column() { + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + Column() { + Row() { + Text('设置') + .fontSize(26) + .fontWeight(FontWeight.Bold) + .textAlign(TextAlign.Start) + .width('96%') + .onClick(() => { + this.controller.close() + }) + }.margin({ top: '100px', bottom: '20px' }) + + settingPublicLayout({ + icon: $r('app.media.ic_camera_set__Mirror'), + isModeBol: true, + borderBol: false, + iconModeBol: true, + modeMessage: '自拍镜像', + backNum: 1, + leftSliderIndex: $leftSliderIndex, + setModeBol: globalThis.settingDataObj.mirrorBol, + getModeBol: this.getMirrorBol.bind(this) + }) + Column() { + settingPublicLayout({ + icon: $r('app.media.ic_camera_set__Antishake'), + isModeBol: true, + borderBol: true, + borderBole: true, + backNum: 2, + leftSliderIndex: $leftSliderIndex, + modeMessage: '视频防抖' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 3, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_exposure'), + modeMessage: '曝光模式' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 4, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_AF'), + modeMessage: '对焦模式' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 5, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_Quality'), + modeMessage: '拍摄质量' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 6, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_Location'), + isModeBol: true, + borderBol: true, + borderBole: false, + iconModeBol: true, + modeMessage: '拍摄时显示地理位置', + setModeBol: globalThis.settingDataObj.locationBol, + getModeBol: this.getLocationBol.bind(this) + }) + + } + .backgroundColor(Color.White) + .borderRadius(16) + .margin({ top: 15 }) + + Column() { + settingPublicLayout({ + backNum: 7, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_Format'), + modeMessage: '照片格式', + isModeBol: true, + borderBol: true, + borderBole: true, + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 8, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_class'), + modeMessage: '照片方向配置' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 9, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_pic_Resolution'), + modeMessage: '照片分辨率' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 10, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_video_Resolution'), + modeMessage: '视频分辨率' + }) + Divider().width(420).margin({ left: 20 }) + settingPublicLayout({ + backNum: 11, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_video_Rate'), + modeMessage: '录像帧率', + isModeBol: true, + borderBol: true, + borderBole: false, + }) + } + .backgroundColor(Color.White) + .borderRadius(16) + .margin({ top: 15 }) + + settingPublicLayout({ + backNum: 12, + leftSliderIndex: $leftSliderIndex, + icon: $r('app.media.ic_camera_set_line'), + modeMessage: '参考线', + isModeBol: true, + borderBol: false, + iconModeBol: true, + setModeBol: globalThis.settingDataObj.referenceLineBol, + getModeBol: this.getReferenceLineBol.bind(this) + }) + .margin({ top: 15 }) + } + .width('38%') + + // 设置右侧选择列表 + Column() { + settingRightLayout({ settingMessageNum: this.leftSliderIndex }) + } + .width('58%') + } + .height('100%') + .width('96%') + + } + // 页面显示 + .onAppear(() => { + }) + // 页面消失 + .onDisAppear(async () => { + + console.info('zyk globalThis onPageHide:' + JSON.stringify(globalThis.settingDataObj)) + // await CameraService.releaseCamera() + // await CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex) + }) + .width('100%') + .height('100%') + .backgroundColor('#F1F3F5') + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/MainAbility/MainAbility.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..861b120506e7fee86124af06c3d96a5bcb50fbca --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,73 @@ +import hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility' +import Window from '@ohos.window' + +import deviceInfo from '@ohos.deviceInfo' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + globalThis.abilityContext = this.context + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + windowStage.getMainWindow().then((win) => { + win.setLayoutFullScreen(true).then(() => { + win.setSystemBarEnable(['navigation']).then(() => { + }) + }) + win.setSystemBarProperties({ + navigationBarColor: '#00000000', + navigationBarContentColor: '#B3B3B3' + }).then(() => { + }) + }) + this.onLoadContent(windowStage, 'pages/tableIndex') +// if (deviceInfo.deviceType === 'default') { +// this.onLoadContent(windowStage, 'pages/phoneIndex') +// } else { +// this.onLoadContent(windowStage, 'pages/tableIndex') +// } + } + + onLoadContent(windowStage, page) { + windowStage.loadContent(page, (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingItem.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e32ad02f67c9ef76881a87321b80c04becc2dd6 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingItem.ets @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2022-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 CameraService from '../model/CameraService' + +@Component +export struct settingItem { + private itemData: string // 所选模式的名称 + @Prop settingMessageNum: number // 传进来的点击设置 + private index: number // 所选模式的索引值 + @Link @Watch('onChangeFn') isIndex: number // 默认图标选在第几个 + @State isBol: boolean = false // 隐藏显示图标 + // 对应点击模式设置下所选的设置参数 + selectMode() { + switch (this.settingMessageNum) { + case 2: + globalThis.settingDataObj.videoStabilizationMode = this.index + // CameraService.isVideoStabilizationModeSupportedFn(globalThis.settingDataObj.videoStabilizationMode) + break + case 3: + globalThis.settingDataObj.exposureMode = this.index + // CameraService.isExposureModeSupportedFn(globalThis.settingDataObj.exposureMode) + break + case 4: + globalThis.settingDataObj.focusMode = this.index + // CameraService.isFocusMode(globalThis.settingDataObj.focusMode) + break + case 5: + globalThis.settingDataObj.photoQuality = this.index + break + case 7: + globalThis.settingDataObj.photoFormat = this.index + break + case 8: + globalThis.settingDataObj.photoOrientation = this.index + break + case 9: + // 照片分辨率 + globalThis.settingDataObj.photoResolution = this.index + let ind = this.itemData.indexOf('*') + globalThis.photoResolutionWidth = Number(this.itemData.substring(0, ind)) + globalThis.photoResolutionHeight = Number(this.itemData.substring(ind + 1)) + break + case 10: + // 视频分辨率 + globalThis.settingDataObj.videoResolution = this.index + let index = this.itemData.indexOf('*') + globalThis.videoResolutionWidth = Number(this.itemData.substring(0, index)) + globalThis.videoResolutionHeight = Number(this.itemData.substring(index + 1)) + break + case 11: + globalThis.settingDataObj.videoFrame = this.index + globalThis.videoFrame = this.itemData + break + } + } + + onChangeFn() { + if (this.index === this.isIndex) { + this.isBol = true + } else { + this.isBol = false + } + } + + aboutToAppear() { + this.onChangeFn() + } + + build() { + Column() { + Row() { + Text(this.itemData) + .fontColor('#182431') + .fontSize(16) + .fontWeight(600) + .textAlign(TextAlign.Start) + .width('90%') + if (this.isBol) { + Image($r('app.media.ic_camera_set_Checked')).width(24).height(24) + } else { + Image('').width(24).height(24).backgroundColor(Color.White) + } + } + .justifyContent(FlexAlign.SpaceBetween) + .height(65) + .onClick(() => { + this.isIndex = this.index + this.selectMode() + }) + + Divider().width(680).margin({ left: 10 }) + } + + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingPublicLayout.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingPublicLayout.ets new file mode 100644 index 0000000000000000000000000000000000000000..36f316e56b3d04b72e37e743fc902092f2358062 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingPublicLayout.ets @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2022-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. + */ + +@Component +export struct settingPublicLayout { + private icon: Resource + private modeMessage: string + private getModeBol: (mirrorBol: boolean) => void + private setModeBol: boolean + private isModeBol: boolean = false + private borderBol: boolean = false + private borderBole: boolean = false + private iconModeBol: boolean = false + private backNum: number = 1 + @State backClBol: boolean = false + @Link @Watch('leftSliderChange') leftSliderIndex: number + + leftSliderChange() { + if (this.backNum == this.leftSliderIndex) { + this.backClBol = true + } else { + this.backClBol = false + } + } + + aboutToAppear() { + this.leftSliderChange() + } + + isBorderFn() { + // 两种形式,1、无圆角,2、全圆角,3、下左下右圆角,4、上左上右圆角 + // 默认不传 无圆角 + // isModeBol = true borderBol= false 全圆角 + // isModeBol = true borderBol= true borderBole = false 下左下右圆角 + // isModeBol = true borderBol= true borderBole = true 上左上右圆角 + if (this.isModeBol) { + if (this.borderBol) { + if (this.borderBole) { + return { topLeft: 16, topRight: 16 } + } else { + return { bottomLeft: 16, bottomRight: 16 } + } + } else { + return { topLeft: 16, topRight: 16, bottomLeft: 16, bottomRight: 16 } + } + } else { + return {} + } + } + + build() { + Row() { + Row() { + Row() { + Image(this.icon).width(20).height(20).margin({ left: '15px' }) + Text(this.modeMessage).margin({ left: '20px' }) + } + + if (this.iconModeBol) { + Toggle({ type: ToggleType.Switch, isOn: this.setModeBol }) + .selectedColor($r('app.color.theme_color')) + .switchPointColor('#FFFFFF') + .onChange((isOn: boolean) => { + this.getModeBol(isOn) + console.info('zyk Component status:' + isOn) + }) + } else { + Image($r('app.media.ic_camera_set_arrow')).width(20).height(20).margin({ right: 10 }) + } + } + .onClick(() => { + this.leftSliderIndex = this.backNum + console.info('zyk leftSliderIndex status:' + this.leftSliderIndex) + console.info('zyk backNum status:' + this.backNum) + }) + .justifyContent(FlexAlign.SpaceBetween) + .width('100%') + .borderRadius(15) + .height('90px') + .backgroundColor(this.backClBol ? 'rgba(255,0,52,0.10)' : '') + } + .padding(2) + .width('100%') + .height('100px') + .borderRadius(this.isBorderFn()) + .backgroundColor(Color.White) + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingRightLayout.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingRightLayout.ets new file mode 100644 index 0000000000000000000000000000000000000000..071437ef89d39f42dcc6812b1d0cc059104377e6 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/common/settingRightLayout.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2022-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 { settingItem } from './settingItem' + +@Component +export struct settingRightLayout { + @Prop @Watch('onSettingMessageFn') settingMessageNum: number // 传进来的点击设置 + private title: Array = ['', '自拍镜像', '视频防抖', '曝光模式', '对焦模式', '拍摄质量', '拍摄时显示地理位置', '照片格式', '照片方向配置', '照片分辨率', '视频分辨率', '录像帧率', '参考线',] + private settingItemDataList: Array> = [ + [], [], + ['关闭视频防抖', '基础防抖算法', '一般防抖算法', '最好防抖算法', '自动进行选择'], + ['锁定曝光模式', '自动曝光模式', '连续自动曝光'], + ['手动对焦', '连续自动对焦', '自动变焦', '对焦锁定'], + ['高', '中', '差'], + [], + ['PNG', 'JPG', 'BMP', 'WEBP', 'JPEG'], + ['0', '90', '180', '270'], + ['1920*1080', '1280*720', '640*480'], + ['1920*1080', '1280*720', '640*480'], + ['15', '30'], + ] + @State isIndex: number = 0 + private settingItemNumberArray = [2,3,4,5,7,8,9,10,11] + + onSettingMessageFn() { + switch (this.settingMessageNum) { + case 2: + this.isIndex = globalThis.settingDataObj.videoStabilizationMode + break + case 3: + this.isIndex = globalThis.settingDataObj.exposureMode + break + case 4: + this.isIndex = globalThis.settingDataObj.focusMode + break + case 5: + this.isIndex = globalThis.settingDataObj.photoQuality + break + case 7: + this.isIndex = globalThis.settingDataObj.photoFormat + break + case 8: + this.isIndex = globalThis.settingDataObj.photoOrientation + break + case 9: + this.isIndex = globalThis.settingDataObj.photoResolution + break + case 10: + this.isIndex = globalThis.settingDataObj.videoResolution + break + case 11: + this.isIndex = globalThis.settingDataObj.videoFrame + break + } + } + + getModeIconObj() { + if (this.settingMessageNum == 1) { + return { icon: $r('app.media.pic_camera_mirror'), message: '自拍镜像功能只能在前置摄像头打开时可使用。' } + } else if (this.settingMessageNum == 6) { + return { icon: $r('app.media.pic_camera_mirror'), message: '显示地理位置,用于记录照片或视频拍摄地理位置信息。' } + } else if (this.settingMessageNum == 12) { + return { icon: $r('app.media.pic_camera_line'), message: '打开相机参考线,可以帮你创造出构图更出色的画面。' } + } else { + return { icon: null, message: null } + } + } + + build() { + Column() { + Row() { + Text(this.title[this.settingMessageNum]) + .fontSize(24) + .fontWeight(700) + .fontColor('#182431') + .width('96%') + .textAlign(TextAlign.Start) + }.margin({ top: 20 }) + + if (this.settingMessageNum == 1 || this.settingMessageNum == 6 || this.settingMessageNum == 12) { + Column() { + Image(this.getModeIconObj().icon).width(450).height(350).objectFit(ImageFit.ScaleDown) + Text(this.getModeIconObj().message).fontColor('#182431').fontSize(18).fontWeight(400) + }.margin({ top: 90 }) + } else { + Column() { + ForEach(this.settingItemDataList[this.settingMessageNum], (item, index) => { + settingItem({ + itemData: item, + index: index, + isIndex: $isIndex, + settingMessageNum: this.settingMessageNum + }) + }) + } + .margin({ top: 20 }) + .borderRadius(24) + .width(720) + .backgroundColor(Color.White) + } + } + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/entryability/EntryAbility.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b67f3fc3ffba90620296145108951d077775bce3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,37 @@ +import UIAbility from '@ohos.app.ability.UIAbility'; +import prompt from '@system.prompt' +import window from '@ohos.window'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import { Permissions } from '@ohos.abilityAccessCtrl'; +import hilog from '@ohos.hilog'; + +const TAG: string = "EntryAbility"; + +export default class EntryAbility extends UIAbility { + + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + // @ts-ignore + globalThis.abilityContext = this.context + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + windowStage.loadContent("pages/tableIndex", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/model/Logger.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/model/Logger.ts new file mode 100644 index 0000000000000000000000000000000000000000..220d9e008ae9efffd06f9f95e86ccf876e0e08e5 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/model/Logger.ts @@ -0,0 +1,31 @@ + +import hiLog from '@ohos.hilog' + +class Logger { + private domain: number + private prefix: string + private format: string = "%{public}s, %{public}s" + + constructor(prefix: string) { + this.prefix = prefix + this.domain = 0xFF00 + } + + debug(...args: any[]) { + hiLog.debug(this.domain, this.prefix, this.format, args) + } + + info(...args: any[]) { + hiLog.info(this.domain, this.prefix, this.format, args) + } + + warn(...args: any[]) { + hiLog.warn(this.domain, this.prefix, this.format, args) + } + + error(...args: any[]) { + hiLog.error(this.domain, this.prefix, this.format, args) + } +} + +export default new Logger('[CameraZyk]') \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/pages/tableIndex.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/pages/tableIndex.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cf1e77464b2d3ae493939b237008fd577982c25 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/pages/tableIndex.ets @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2022-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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import cameraDemo from 'libentry.so' +import Logger from '../model/Logger' +import { mainDialog } from '../Dialog/mainDialog' +import { dividerPage } from '../views/dividerPage' +import { settingDialog } from '../Dialog/settingDialog' +import { CountdownPage } from '../views/CountdownPage' +import { FlashingLightPage } from '../views/FlashingLightPage' +import { SlidePage } from '../views/SlidePage' +import { modeSwitchPage } from '../views/modeSwitchPage' + + +// import CameraService from '../model/CameraService' +// import { CountdownPage } from '../views/CountdownPage' +// import { focusPage } from '../views/focusPage' +// import { focusAreaPage } from '../views/focusAreaPage' +// import { setting } from '../model/Setting' + + +const TAG: string = 'xmj indexPage' + +globalThis.settingDataObj = { + mirrorBol: false, // 镜像使能 -> 关闭 + videoStabilizationMode: 0, // 视频防抖 -> 关闭 + exposureMode: 1, // 曝光模式 -> 自动 + focusMode: 2, // 对焦模式 -> 自动 + photoQuality: 1, // 拍照质量 -> 中 + locationBol: false, // 显示地理位置 -> 关闭 + photoFormat: 1, // 照片格式 -> JPG + photoOrientation: 0, // 照片方向 -> 0 + photoResolution: 0, // 照片分辨率 -> 1920 * 1080 + videoResolution: 0, // 照片分辨率 -> 1920 * 1080 + videoFrame: 0, // 录像帧率 -> 15 + referenceLineBol: false // 分割线 -> 关闭 +} + +@Entry +@Component +struct Index { + // XComponentCon控制器 + private mXComponentController: XComponentController = new XComponentController() + // surfaceID值 + @State surfaceId: string = '' + // 入口确定网络弹框 + private mainDialogController: CustomDialogController = new CustomDialogController({ + builder: mainDialog(), + autoCancel: false, + customStyle: true + }) + + // 选择模式 + @State modelBagCol: string = 'photo' + // 曝光区域 + @State focusPointBol: boolean = false + // 曝光区域手指点击坐标 + @State focusPointVal: Array = [0, 0] + // 刻度、焦距值 和 对焦框不能共存的显示 + @State exposureBol: boolean = true + // 曝光值 + @State exposureNum: number = 0 + // 倒计时拍照 录像 + @State countdownNum: number = 0 + // 相机摄像头 + @State cameraDeviceIndex: number = 0 + // 设置弹框 + private settingDialogController: CustomDialogController = new CustomDialogController({ + builder: settingDialog({ + referenceLineBol: $referenceLineBol, + surfaceId: this.surfaceId, + cameraDeviceIndex: this.cameraDeviceIndex + }), + autoCancel: false, + customStyle: true + }) + // 参考线 + @State referenceLineBol: boolean = false + @State onShow: boolean = false + atManager = abilityAccessCtrl.createAtManager(); + // 入口初始化函数 + async aboutToAppear() { + await this.requestPermissionsFn(); + } + + async aboutToDisAppear() { + // await CameraService.releaseCamera(); + } + // 获取权限 + async requestPermissionsFn() { + Logger.info(TAG, `requestPermissionsFn entry`) + try { + this.atManager.requestPermissionsFromUser(globalThis.abilityContext, [ + 'ohos.permission.CAMERA', + 'ohos.permission.MICROPHONE', + 'ohos.permission.READ_MEDIA', + 'ohos.permission.WRITE_MEDIA' + ]).then(() => { + Logger.info(TAG, `request Permissions success!`) + this.onShow = true + }) + .catch((error) => { + Logger.info(TAG, `requestPermissionsFromUser call Failed! error: ${error.code}`) + }) + } catch (err) { + Logger.info(TAG, `requestPermissionsFromUser call Failed! error: ${err.code}`) + } + // 默认打开选择网络弹框 + //this.mainDialogController.open() + } + + async onPageShow() { + Logger.info(TAG, `onPageShow App`) + if (this.surfaceId && this.onShow) { + Logger.error(TAG, `zss initCamera`) + cameraDemo.initCamera(this.surfaceId) + Logger.error(TAG, `zss initCamera 111`) + // await CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex) + } + } + + onPageHide() { + Logger.info(TAG, `onPageHide App`) + // CameraService.releaseCamera() + } + + build() { + Stack() { + if (this.onShow) { + // 画面 + XComponent({ + id: 'componentId', + type: 'surface', + controller: this.mXComponentController + }) + .onLoad(async () => { + Logger.info(TAG, 'onLoad is called'); + this.surfaceId = this.mXComponentController.getXComponentSurfaceId() + Logger.info(TAG, `onLoad surfaceId: ${this.surfaceId}`) + Logger.error(TAG, `zss initCamera 222`) + cameraDemo.initCamera(this.surfaceId) + Logger.error(TAG, `zss initCamera 333`) + // await CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex) + }) + .backgroundColor(Color.Blue) + .width('100%') + .height('100%') + + // 参考线 + dividerPage({ referenceLineBol: this.referenceLineBol }) + // 设置图标 + Button() { + Image($r('app.media.icon_camera_setting')) + .width('120px').height('120px') + } + .width('120px') + .height('120px') + .backgroundColor('rgba(255,255,255,0.20)') + .borderRadius('40px') + .position({ x: '80%', y: '3%' }) + .onClick(() => { + // 打开设置弹框 + this.settingDialogController.open() + }) + // // 曝光框和对焦框 + // focusPage({ + // focusPointBol: $focusPointBol, + // focusPointVal: $focusPointVal, + // exposureBol: $exposureBol, + // exposureNum: $exposureNum + // }) + // // 曝光对焦手指点击区域 + // focusAreaPage({ + // focusPointBol: $focusPointBol, + // focusPointVal: $focusPointVal, + // exposureBol: $exposureBol, + // exposureNum: $exposureNum + // }) + // 倒计时 + CountdownPage({ countdownNum: $countdownNum }) + // 闪光灯 + FlashingLightPage() + // slide + SlidePage() + // 反转摄像头_多机位_拍照_摄像 + modeSwitchPage({ + surfaceId: this.surfaceId, + cameraDeviceIndex: $cameraDeviceIndex, + countdownNum: $countdownNum + }) + } + } + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/CountdownPage.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/CountdownPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e4a968628df0e6182e8085b4cd0036d7e3329ab --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/CountdownPage.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022-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. + */ + +// 倒计时页面 +@Component +export struct CountdownPage { + @Link countdownNum: number // 倒计时的值 + private countdownListData: Array = ['2', '5', '10'] // 循环渲染 + @State countdownBol: boolean = true + + build() { + Row() { + if (this.countdownBol && !this.countdownNum) { + Row() { + Button() { + Image($r('app.media.icon_camera_setting_timer')) + .width('60px').height('60px') + } + .width('80px') + .height('80px') + .backgroundColor('rgba(255,255,255,0.20)') + .borderRadius('40px') + .onClick(() => { + this.countdownBol = false + }) + } + } + if (this.countdownNum && this.countdownBol) { + Row() { + Image($r('app.media.icon_camera_setting_timer_on')).width('60px').height('60px').margin({ left: 5 }) + Text(this.countdownNum + '').fontSize(21).fontWeight(500).margin({ left: 5 }).fontColor(Color.White) + } + .backgroundColor('rgba(255,255,255,0.20)') + .borderRadius('40px') + .width('140px') + .height('80px') + .onClick(() => { + this.countdownBol = false + }) + } + if (!this.countdownBol) { + Row() { + Image($r('app.media.icon_camera_setting_timer_on_balk')).width('60px').height('60px').margin({ left: 5 }) + ForEach(this.countdownListData, (item) => { + Text(item).fontSize(21).fontWeight(500).margin({ + left: 10 + }) + .fontColor(this.countdownNum == item ? $r('app.color.theme_color') : '#182431').onClick(() => { + this.countdownNum = item + this.countdownBol = true + }) + }, item => item) + Text('OFF').fontSize(21).fontWeight(500).margin({ + left: 10 + }) + .fontColor(this.countdownNum == 0 ? $r('app.color.theme_color') : '#182431').onClick(() => { + this.countdownNum = 0 + this.countdownBol = true + }) + } + .backgroundColor('#FFFFFF') + .borderRadius('40px') + .width('360px') + .height('80px') + .zIndex(999) + } + } + .position({ x: 30, y: 352 }) + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/FlashingLightPage.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/FlashingLightPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..179ccd807507bd968e192695feb8e1033a35427e --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/FlashingLightPage.ets @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2022-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 CameraService from '../model/CameraService' + +@Component +export struct FlashingLightPage { + // 页面判断 + @State flashingBol: boolean = true + // 闪光灯模式 + @State flashingNum: number = 0 + // 返回选中图片 + getImageDefault() { + if (this.flashingNum == 0) { + return $r('app.media.ic_camera_public_flash_off') + } + if (this.flashingNum == 1) { + return $r('app.media.ic_camera_public_flash_on') + } + if (this.flashingNum == 2) { + return $r('app.media.ic_camera_public_flash_auto') + } + if (this.flashingNum == 3) { + return $r('app.media.flash_always_on') + } + } + + build() { + Row() { + if (this.flashingBol) { + Row() { + Button() { + Image(this.getImageDefault()) + .width('60px').height('60px').fillColor('#FFFFFF') + } + .width('80px') + .height('80px') + .backgroundColor('rgba(255,255,255,0.20)') + .borderRadius('40px') + .onClick(() => { + this.flashingBol = false + }) + } + } else { + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Image($r('app.media.ic_camera_public_flash_auto')) + .width('60px') + .height('60px') + .fillColor(this.flashingNum == 2 ? $r('app.color.theme_color') : '') + .onClick(() => { + this.flashingNum = 2 + this.flashingBol = true + // CameraService.hasFlashFn(this.flashingNum) + }) + Image($r('app.media.ic_camera_public_flash_off')) + .width('60px') + .height('60px') + .fillColor(this.flashingNum == 0 ? $r('app.color.theme_color') : '') + .onClick(() => { + this.flashingNum = 0 + this.flashingBol = true + // CameraService.hasFlashFn(this.flashingNum) + }) + Image($r('app.media.ic_camera_public_flash_on')) + .width('60px') + .height('60px') + .fillColor(this.flashingNum == 1 ? $r('app.color.theme_color') : '') + .onClick(() => { + this.flashingNum = 1 + this.flashingBol = true + // CameraService.hasFlashFn(this.flashingNum) + }) + Image($r('app.media.flash_always_on')) + .width('50px') + .height('50px') + .fillColor(this.flashingNum == 3 ? $r('app.color.theme_color') : '') + .onClick(() => { + this.flashingNum = 3 + this.flashingBol = true + // CameraService.hasFlashFn(this.flashingNum) + }) + } + .backgroundColor('#FFFFFF') + .borderRadius('40px') + .width('300px') + .height('80px') + .zIndex(999) + } + + } + .position({ x: 30, y: 408 }) + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/SlidePage.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/SlidePage.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4002aad2ca787d7f796f96aeb250e9ff7f21359 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/SlidePage.ets @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2022-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. + */ + +// 变焦组件 +// 对于组件的变化——只能1到6整数 , 后续需要对此进行修改 +// import CameraService from '../model/CameraService' + +@Component +export struct SlidePage { + // slide滑块 + @State outSetValueOne: number = 1 + // slide滑块移动值 + @State sliderTextPos: string = '-10' + + slideChange(value) { + // CameraService.setZoomRatioFn(value) + switch (value) { + case 1: + this.sliderTextPos = '-10' + break + case 2: + this.sliderTextPos = '70' + break + case 3: + this.sliderTextPos = '145' + break + case 4: + this.sliderTextPos = '220' + break + case 5: + this.sliderTextPos = '300' + break + case 6: + this.sliderTextPos = '380' + break + default: + // this.sliderTextPos += 1 + } + } + + build() { + + Column() { + Row() { + Text('1x').fontColor(Color.White) + Text('6x').fontColor(Color.White) + }.justifyContent(FlexAlign.SpaceBetween).width('95%') + + // Row() { + Text(this.outSetValueOne + 'x') + .fontColor('#182431') + .width('100px') + .height('50px') + .borderRadius(25) + .backgroundColor(Color.White) + .fontSize(14) + .textAlign(TextAlign.Center) + .position({ x: this.sliderTextPos, y: '-5' }) + .zIndex(9) + // } + // .backgroundColor(Color.Red).width('100%').height(20) + // .position({ x: 0, y: '5' }) + + Row() { + Slider({ + value: this.outSetValueOne, + min: 1, + max: 6, + step: 1, + style: SliderStyle.OutSet + }).showSteps(false) + .trackColor('rgba(255,255,255,0.6)') + .selectedColor($r('app.color.theme_color')) + .onChange((value: number) => { + let val = Number(value.toFixed(2)) + this.slideChange(val) + this.outSetValueOne = val + console.info('zyk value:' + val + 'this.sliderTextPos:' + this.sliderTextPos) + }) + }.width('100%') + + } + .height('60') + .width('32.5%') + .position({ x: '35%', y: '3%' }) + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/dividerPage.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/dividerPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4a3aab8e753f7941a4660678dd645a6e4cb43c3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/dividerPage.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022-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. + */ + +@Component +export struct dividerPage { + @Prop referenceLineBol: boolean + + build() { + if (this.referenceLineBol) { + Stack() { + Column() { + Divider().color(Color.White) + Divider().color(Color.White) + }.justifyContent(FlexAlign.SpaceEvenly).height('100%') + + Row() { + Divider().vertical(true).color(Color.White) + Divider().vertical(true).color(Color.White) + }.justifyContent(FlexAlign.SpaceEvenly).width('100%') + } + } + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/modeSwitchPage.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/modeSwitchPage.ets new file mode 100644 index 0000000000000000000000000000000000000000..de845a236cad0276ea244256662d6470791ebefd --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/ets/views/modeSwitchPage.ets @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2022-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 { isRecodeStopDialog } from '../Dialog/isRecodeStopDialog' +// +// import { MultiCameraDialog } from '../Dialog/MultiCameraDialog' +// import { PortraitCameraDialog } from '../Dialog/PortraitCameraDialog' +// import DateTimeUtil from '../model/DateTimeUtil' +import Logger from '../model/Logger' +// import CameraService from '../model/CameraService' + +import mediaLibrary from '@ohos.multimedia.mediaLibrary'; + +import image from '@ohos.multimedia.image'; + +@Component +export struct modeSwitchPage { + private tag: string = 'zyk modeSwitchPage:' + // 相机摄像头 + @Link cameraDeviceIndex: number + // surfaceID值 + @Prop surfaceId: string + // 倒计时值 + @Link countdownNum: number + // 倒计时定时器 + @State countTimerInt: number = -1 + @State countTimerOut: number = -1 + // 拍照缩略图 + @State imgThumbnail: string = undefined + // 人像缩略图 + @State portraitThumbnail: string = undefined + // 录制时间 + @State videoRecodeTime: number = 0 + // 录制时间定时器 + @State timer: number = undefined + // 时间管理器 + // @State dateTimeUtil: DateTimeUtil = new DateTimeUtil() + // 选择模式 + @State modelBagCol: string = 'photo' + // 选择相机或者拍照 + // @State @Watch('onChangeIsModeBol') isModeBol: boolean = true + // 录像开始暂停 + // @State @Watch('onChangeRecord') isRecording: boolean = true + // 视频缩略图 + @State videoThumbnail: image.PixelMap = undefined + // 确定是否停止录制的弹框 + // private isRecodeStopDialogController: CustomDialogController = new CustomDialogController({ + // builder: isRecodeStopDialog({ + // isModeBol: $isModeBol, + // videoRecodeTime: $videoRecodeTime, + // isRecording: $isRecording, + // timer: this.timer + // }), + // autoCancel: false, + // customStyle: true + // }) + // // 多机位弹框 + // private MultiCameraDialogController: CustomDialogController = new CustomDialogController({ + // builder: MultiCameraDialog({}), + // autoCancel: false, + // customStyle: true + // }) + // // 人像弹窗 + // private PortraitCameraDialogController: CustomDialogController = new CustomDialogController({ + // builder: PortraitCameraDialog({}), + // autoCancel: false, + // customStyle: true + // }) + // // 暂停后点击停止 需要将暂停回复默认 + // onChangeIsModeBol() { + // this.isRecording = true + // } + // // 恢复视频录制 + // resumeVideo() { + // CameraService.resumeVideo().then(() => { + // this.timer = setInterval(() => { + // this.videoRecodeTime += 1000 + // }, 1000) + // }) + // } + // // 录制 暂停/开始 + // onChangeRecord() { + // + // Logger.info(this.tag, ` isRecording: ${this.isRecording}`) + // if (this.isRecording) { + // // 开始 + // this.resumeVideo() + // } else { + // // 暂停 + // if (this.timer) { + // clearInterval(this.timer) + // } + // CameraService.pauseVideo() + // } + // } + // // 倒计时拍照和录像 + // countTakeVideoFn() { + // if (this.countdownNum) { + // // 清除定时器 + // if (this.countTimerOut) { + // clearTimeout(this.countTimerOut) + // } + // if (this.countTimerInt) { + // clearInterval(this.countTimerInt) + // } + // // 开启定时器 + // this.countTimerOut = setTimeout(() => { + // // 判断是录像还是拍照模式 + // this.isVideoPhotoFn() + // }, this.countdownNum * 1000) + // // 开启计时器 + // this.countTimerInt = setInterval(() => { + // this.countdownNum-- + // if (this.countdownNum === 0) { + // clearInterval(this.countTimerInt) + // } + // }, 1000) + // } else { + // this.isVideoPhotoFn() + // } + // } + // // 判断录像或者照片模式 + // isVideoPhotoFn() { + // if (this.modelBagCol == 'photo') { + // CameraService.takePicture() + // } else if (this.modelBagCol == 'portrait') { + // CameraService.takePicture() + // } else if (this.modelBagCol == 'video') { + // this.isModeBol = false + // if (this.timer) { + // clearInterval(this.timer) + // } + // // 开始录制 + // CameraService.startVideo().then(() => { + // // 计时器 + // this.timer = setInterval(() => { + // this.videoRecodeTime += 1000 + // }, 1000) + // }) + // } + // } + + aboutToAppear() { + // CameraService.setTakePictureCallback(this.handleTakePicture.bind(this)) + } + + handleTakePicture = (thumbnail: string) => { + this.imgThumbnail = thumbnail + Logger.info(this.tag, `takePicture end , thumbnail: ${this.imgThumbnail}`) + } + + build() { + if (true) { + + Column() { + Text('拍照') + .backgroundColor(this.modelBagCol === 'photo' ? $r('app.color.theme_color') : '') + .size({ width: 64, height: 28 }) + .borderRadius(14) + .fontSize(14) + .fontColor(Color.White) + .onClick(() => { + this.modelBagCol = 'photo' + }) + }.position({ x: '20%', y: '75%' }) + + Column() { + Text('录像') + .fontSize(14) + .fontColor(Color.White) + .borderRadius(14) + .size({ width: 64, height: 28 }) + .backgroundColor(this.modelBagCol === 'video' ? $r('app.color.theme_color') : '') + .onClick(() => { + this.modelBagCol = 'video' + }) + }.position({ x: '40%', y: '75%' }) + + // Column() { + // Text('多机位') + // .size({ width: 64, height: 28 }) + // .fontSize(14) + // .fontColor(Color.White) + // .backgroundColor(this.modelBagCol === 'multi' ? $r('app.color.theme_color') : '') + // .onClick(() => { + // this.modelBagCol = 'multi' + // this.MultiCameraDialogController.open() + // }) + // .borderRadius(14) + // }.position({ x: '60%', y: '75%' }) + // + // Column() { + // Text('人像') + // .size({ width: 64, height: 28 }) + // .fontSize(14) + // .fontColor(Color.White) + // .backgroundColor(this.modelBagCol === 'portrait' ? $r('app.color.theme_color') : '') + // .onClick(() => { + // this.modelBagCol = 'portrait' + // this.PortraitCameraDialogController.open() + // }) + // .borderRadius(14) + // }.position({ x: '80%', y: '75%' }) + + // 图库 + Column() { + Row() { + if (this.modelBagCol === 'photo') { + Image(this.imgThumbnail || $r('app.media.pic_avatar_radio02')) + .aspectRatio(1) + .objectFit(ImageFit.Fill) + .border({ width: 2, color: 0xFFFFFF, radius: 40 }) + .width('200px') + .height('200px') + } else if (this.modelBagCol === 'portrait') { + Image(this.portraitThumbnail || $r('app.media.pic_avatar_radio02')) + .aspectRatio(1) + .objectFit(ImageFit.Fill) + .border({ width: 2, color: 0xFFFFFF, radius: 40 }) + .width('200px') + .height('200px') + } else { + Image(this.videoThumbnail || $r('app.media.pic_avatar_radio02')) + .aspectRatio(1) + .objectFit(ImageFit.Fill) + .border({ width: 2, color: 0xFFFFFF, radius: 40 }) + .width('200px') + .height('200px') + } + }.onClick(() => { + globalThis.abilityContext.startAbility({ + bundleName: 'com.ohos.photos', + abilityName: 'com.ohos.photos.MainAbility' + }) + }) + }.position({ x: '10%', y: '82%' }) + + // 拍照录像按键 + Column() { + Row() { + Button() { + Text() + .width('120px') + .height('120px') + .borderRadius('40px') + .backgroundColor(this.modelBagCol == 'video' ? $r('app.color.theme_color') : Color.White) + } + .border({ width: 3, color: 0xFFFFFF, radius: 70 }) + .width('200px') + .height('200px') + .backgroundColor('rgba(255,255,255,0.20)') + .onClick(() => { + // 倒计时拍照录像—默认拍照录像 + // this.countTakeVideoFn() + }) + } + //.margin({ top: 32 }) + }.position({ x: '40%', y: '82%' }) + + // 前后置摄像头切换 + Column() { + Row() { + Button() { + Image($r('app.media.switch_camera')) + .width('120px').height('120px') + } + .width('200px') + .height('200px') + .backgroundColor('rgba(255,255,255,0.20)') + .borderRadius('40px') + .onClick(async () => { + // 切换摄像头 + this.cameraDeviceIndex ? this.cameraDeviceIndex = 0 : this.cameraDeviceIndex = 1 + // 清除配置 + // await CameraService.releaseSession() + // 开始预览 + // await CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex) + }) + } + }.position({ x: '70%', y: '82%' }) + } else { + // Column() { + // Row() { + // Text().size({ width: 12, height: 12 }).backgroundColor($r('app.color.theme_color')).borderRadius(6) + // Text(this.dateTimeUtil.getVideoTime(this.videoRecodeTime)) + // .fontSize(30) + // .fontColor(Color.White) + // .margin({ left: 8 }) + // }.offset({ x: -580, y: -180 }) + // }.position({ x: 120, y: 450 }) + // + // Column() { + // // 录像抓拍键 + // Button() { + // Text().width('120px').height('120px').borderRadius('35px').backgroundColor(Color.White) + // } + // .border({ width: 2, color: 0xFFFFFF, radius: 45 }) + // .width('200px') + // .height('200px') + // .backgroundColor('rgba(255,255,255,0.20)') + // .onClick(() => { + // CameraService.takePicture() + // }) + // }.position({ x: '10%', y: '82%' }) + // + // Column() { + // Row() { + // Column() { + // // 录像停止键 + // Button() { + // Image($r('app.media.ic_camera_video_close')).size({ width: 25, height: 25 }) + // } + // .width('120px') + // .height('120px') + // .backgroundColor($r('app.color.theme_color')) + // .onClick(() => { + // if (this.timer) { + // clearInterval(this.timer) + // } + // // 弹框无法响应 + // // CameraService.pauseVideo() + // // 停止录制 + // CameraService.stopVideo().then(async (fileAsset) => { + // this.videoRecodeTime = 0 + // this.isModeBol = true + // try { + // // 获取录制缩略图 + // this.videoThumbnail = await fileAsset.getThumbnail() + // } catch (err) { + // Logger.info(this.tag, 'videoThumbnail err----------:' + JSON.stringify(err.message)) + // } + // }) + // // 打开停止弹框 + // // this.isRecodeStopDialogController.open() + // }) + // } + // .width('180px') + // .height('180px') + // .borderRadius('60px') + // .backgroundColor($r('app.color.theme_color')) + // .justifyContent(FlexAlign.SpaceAround) + // } + // .justifyContent(FlexAlign.Center) + // .border({ width: 3, color: 0xFFFFFF, radius: 70 }) + // .width('200px') + // .height('200px') + // .backgroundColor('rgba(255,255,255,0.20)') + // }.position({ x: '40%', y: '82%' }) + // + // Column() { + // Row() { + // Column() { + // // 录像暂停-播放键 + // Button() { + // Image(this.isRecording ? $r('app.media.ic_camera_video_on') : $r('app.media.ic_camera_video_off')) + // .size({ + // width: 25, + // height: 25 + // }) + // } + // .width('120px') + // .height('120px') + // .backgroundColor($r('app.color.theme_color')) + // .onClick(() => { + // this.isRecording = !this.isRecording + // }) + // } + // .width('180px') + // .height('180px') + // .borderRadius('60px') + // .backgroundColor($r('app.color.theme_color')) + // .justifyContent(FlexAlign.SpaceAround) + // } + // .justifyContent(FlexAlign.Center) + // .border({ width: 3, color: 0xFFFFFF, radius: 70 }) + // .width('200px') + // .height('200px') + // .backgroundColor('rgba(255,255,255,0.20)') + // }.position({ x: '70%', y: '82%' }) + } + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/module.json5 b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..cf59596ff79e2f626bd74ab6ec5ed240c4e49ec0 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/module.json5 @@ -0,0 +1,57 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "metadata": [ + { + "name": "ArkTSPartialUpdate", + "value": "true" + } + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntrance": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.CAMERA" + }, + { + "name": "ohos.permission.MICROPHONE" + }, + { + "name": "ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_MEDIA" + } + ] + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/color.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..8b3539b68d002801b5ed92b83a2d20fa712a29b9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "white", + "value": "#FFFFFF" + }, + { + "name": "theme_color", + "value": "#FF0034" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/string.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8ea648ad75d0043fe875ee21b47569ce83eaf353 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ndk_camera_demo" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/flash_always_on.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/flash_always_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..3f9f710f0d7fd21153ede07520121a328aa9bbd3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/flash_always_on.svg @@ -0,0 +1,18 @@ + + + + ic/camera/public/flash_always_on + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ProgressBar_circle.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ProgressBar_circle.svg new file mode 100644 index 0000000000000000000000000000000000000000..770aba0b9fd99ad5fd710504daa59381aaaab640 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ProgressBar_circle.svg @@ -0,0 +1,8 @@ + + + ic_camera_ProgressBar_circle + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_Radio_open.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_Radio_open.svg new file mode 100644 index 0000000000000000000000000000000000000000..84d633d9a91fb54795a6314e81f021f02dc1cf43 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_Radio_open.svg @@ -0,0 +1,24 @@ + + + ic_camera_Radio_open + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ic_camera_Radio_close.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ic_camera_Radio_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..b345380c7ed2143636828dc0768a6c2d0e70cae9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_ic_camera_Radio_close.svg @@ -0,0 +1,8 @@ + + + ic_camera_ic_camera_Radio_close + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_pad.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_pad.svg new file mode 100644 index 0000000000000000000000000000000000000000..16f06746e38339eab8cff4b22a87a186ea1c4681 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_pad.svg @@ -0,0 +1,13 @@ + + + ic_camera_pad + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_phone.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..c2cc3251e233cbd25bb4c37ea98a2e0c46616cda --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_phone.svg @@ -0,0 +1,13 @@ + + + ic_camera_phone + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto.svg new file mode 100644 index 0000000000000000000000000000000000000000..5e4b45fcd70d9ff6851ddaa2b20563182176057e --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto.svg @@ -0,0 +1,13 @@ + + + ic_camera_public_flash_auto + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto_white.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto_white.svg new file mode 100644 index 0000000000000000000000000000000000000000..5e4b45fcd70d9ff6851ddaa2b20563182176057e --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_auto_white.svg @@ -0,0 +1,13 @@ + + + ic_camera_public_flash_auto + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_off.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..deaae7f92646fc34753fd9c3666ab7d924e68e7a --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_off.svg @@ -0,0 +1,13 @@ + + + ic_camera_public_flash_off + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_on.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..ebd9922b5ea9ec16c902c07ba48c07839a1913f9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_public_flash_on.svg @@ -0,0 +1,13 @@ + + + ic_camera_public_flash_on + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_AF.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_AF.svg new file mode 100644 index 0000000000000000000000000000000000000000..97618096eb370f76a39a9b1d3cf09f0d3a0f688b --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_AF.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_focus + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Checked.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Checked.svg new file mode 100644 index 0000000000000000000000000000000000000000..3b62d7543215096ef0d7cf5b57bd0ff7255ae301 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Checked.svg @@ -0,0 +1,13 @@ + + + ic_camera_set_Checked + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Format.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Format.svg new file mode 100644 index 0000000000000000000000000000000000000000..44fbba6dc229262a17cf80ea33d2a2909255115e --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Format.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_Format + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Location.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Location.svg new file mode 100644 index 0000000000000000000000000000000000000000..7ea27aa4f8e2101df6d1afea60954ed60c18b89a --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Location.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_Location + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Quality.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Quality.svg new file mode 100644 index 0000000000000000000000000000000000000000..0c7de7e2074d025fa76ea38f7a2c9dceaf585879 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_Quality.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_Quality + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Antishake.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Antishake.svg new file mode 100644 index 0000000000000000000000000000000000000000..e2a48846dab24511323341d8c92334ee3e1169b9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Antishake.svg @@ -0,0 +1,7 @@ + + + ic_camera_set__Antishake + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Mirror.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Mirror.svg new file mode 100644 index 0000000000000000000000000000000000000000..2737fc9c28730b11f23807b4bd6ff984a82f28c8 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set__Mirror.svg @@ -0,0 +1,9 @@ + + + ic_camera_set__Mirror + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_arrow.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_arrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..97025a536ba73799ac3fba4710ff6f38f98a8586 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_arrow.svg @@ -0,0 +1,13 @@ + + + ic_camera_set_arrow + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_class.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_class.svg new file mode 100644 index 0000000000000000000000000000000000000000..c926c738af12619b9d23e7475ca290dd4f6f2900 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_class.svg @@ -0,0 +1,8 @@ + + + ic_camera_set_class + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_exposure.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_exposure.svg new file mode 100644 index 0000000000000000000000000000000000000000..0ffbb1531fd3c148ff7f8147f0754d63cf0fef13 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_exposure.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_exposure + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_focus.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_focus.svg new file mode 100644 index 0000000000000000000000000000000000000000..eb597d91d1a247cbe433ac96fee8b195179c6c04 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_focus.svg @@ -0,0 +1,9 @@ + + + ic_camera_set_focus + + + AF + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_line.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_line.svg new file mode 100644 index 0000000000000000000000000000000000000000..b5fa81891c209f76622304c1cbe8546ec5b7ffdd --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_line.svg @@ -0,0 +1,13 @@ + + + ic_camera_set_line + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_pic_Resolution.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_pic_Resolution.svg new file mode 100644 index 0000000000000000000000000000000000000000..618458951af82555e0ebe1de7052716efb72cf05 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_pic_Resolution.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_pic_Resolution + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Rate.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Rate.svg new file mode 100644 index 0000000000000000000000000000000000000000..d0c1af0c398f74b3b9ec011dbbbe2c5da369634c --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Rate.svg @@ -0,0 +1,13 @@ + + + ic_camera_set_video_Rate + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Resolution.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Resolution.svg new file mode 100644 index 0000000000000000000000000000000000000000..53d39983bf8e9e82d85dfcdd1c94ed3fede04d56 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_set_video_Resolution.svg @@ -0,0 +1,7 @@ + + + ic_camera_set_video_Resolution + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..0e4631448c6d77c116487e56da83ce44263961c9 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off.svg @@ -0,0 +1,9 @@ + + + ic_camera_switch_off + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off2.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off2.svg new file mode 100644 index 0000000000000000000000000000000000000000..0b4e58935df66e250a89c9dd787c08480b02a756 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_switch_off2.svg @@ -0,0 +1,14 @@ + + + ic_camera_switch_off 2 + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_close.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_close.svg new file mode 100644 index 0000000000000000000000000000000000000000..476634fbbfb2959b0343cbb8e55db9c1c4211cdb --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_close.svg @@ -0,0 +1,7 @@ + + + ic_camera_video_close + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_off.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_off.svg new file mode 100644 index 0000000000000000000000000000000000000000..854f409f19546cfaa313609ef3979f22fb0dddf7 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_off.svg @@ -0,0 +1,13 @@ + + + ic_camera_video_off + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_on.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..6da84352329a4c864760c5e6bb3a82f5260ff6bd --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_camera_video_on.svg @@ -0,0 +1,7 @@ + + + ic_camera_video_on + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness.svg new file mode 100644 index 0000000000000000000000000000000000000000..b74c726facde9fcc364fa4750161d05bd8034e53 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness.svg @@ -0,0 +1,7 @@ + + + ic_public_brightness + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness_filled.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness_filled.svg new file mode 100644 index 0000000000000000000000000000000000000000..7c219cee8c2cb2e84e05bbf381c805b157f76dd2 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/ic_public_brightness_filled.svg @@ -0,0 +1,7 @@ + + + ic_public_brightness_filled + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting.svg new file mode 100644 index 0000000000000000000000000000000000000000..60c32abaa0be5b6064ea96910f1aa0f8117a3cf0 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting.svg @@ -0,0 +1,13 @@ + + + icon_camera_setting + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer.svg new file mode 100644 index 0000000000000000000000000000000000000000..853e04954758f26560ceb3ca1d246206dfdca3c3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer.svg @@ -0,0 +1,13 @@ + + + icon_camera_setting_timer + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on.svg new file mode 100644 index 0000000000000000000000000000000000000000..5f8413271ee689148263d8db7dc05a54e1bc4a20 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on.svg @@ -0,0 +1,13 @@ + + + icon_camera_setting_timer_on + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on_balk.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on_balk.svg new file mode 100644 index 0000000000000000000000000000000000000000..875ecca5f058f9800a092b9d4f31be06fc662593 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/icon_camera_setting_timer_on_balk.svg @@ -0,0 +1,13 @@ + + + icon_camera_setting_timer_on + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio01.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio01.png new file mode 100644 index 0000000000000000000000000000000000000000..ce06ac8d459c38abc90be16a3ba7366f0ab0f179 Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio01.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio02.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio02.png new file mode 100644 index 0000000000000000000000000000000000000000..706e376770f4dec127614af1c866aa3fc00c8557 Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_radio02.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_regular.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_regular.png new file mode 100644 index 0000000000000000000000000000000000000000..27209339d1e0ce6e815ab1a63e077efb2b9fdb2c Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_avatar_regular.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_line.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_line.png new file mode 100644 index 0000000000000000000000000000000000000000..ce54c74f2e1afb230b7344a562dc3a4e1aa47d89 Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_line.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_mirror.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_mirror.png new file mode 100644 index 0000000000000000000000000000000000000000..be57cb99c63f9f236ee93d9239fed7d46eafb885 Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_camera_mirror.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_left.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_left.png new file mode 100644 index 0000000000000000000000000000000000000000..e411072ccc63e4349a8767b6b7ee3eb6229e3def Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_left.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_right.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_right.png new file mode 100644 index 0000000000000000000000000000000000000000..3e0fbf06a98bb71c7d38ce5d9cae10e47d71ce78 Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/pic_popup_right.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/switch_camera.svg b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/switch_camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..43dab70a87aab51158e47ad6b57fdcee6cf71556 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/media/switch_camera.svg @@ -0,0 +1,7 @@ + + + switch_camera + + + + \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/profile/main_pages.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..52cda518b4d615cb5dc2596a2ac74c9b99161fdc --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/tableIndex" + ] +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/en_US/element/string.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8ea648ad75d0043fe875ee21b47569ce83eaf353 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ndk_camera_demo" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/zh_CN/element/string.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ba9144a165fe1bbd15ec3987c4581638f7e9e1c3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "ndk_camera_demo" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/Ability.test.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b666beb3bf0327a4cdf2559c44632c5132a5a02a --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022-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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/List.test.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..947d0607351718d355d9895d1a5c0a7af52fd48b --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022-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 abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/TestAbility.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..19cbb689db87beba8a9c74fd0c6a03cfa23420cd --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022-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 UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; + +export default class TestAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/tableIndex', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/pages/Index.ets b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..163289fea0a846885d94c9f0c62758e33059b9f7 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022-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 hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..92a16d84e8870da219c51d9f1342c79203c1f42d --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,49 @@ +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/module.json5 b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..57f25088e07547b8a52eab590c5deeca0b8e8730 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/module.json5 @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/color.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/string.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/media/icon.png b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/profile/test_pages.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..b7e7343cacb32ce982a45e76daad86e435e054fe --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "testability/pages/Index" + ] +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/hvigorfile.ts b/frameworks/native/camera/test/ndktest/camera_ndk_demo/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/package-lock.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..00cb7ffd9d3c4143c5eebd887dc3e4006edd4787 --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/package-lock.json @@ -0,0 +1,1081 @@ +{ + "name": "myapplication", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@ohos/hos-sdkmanager-common": { + "version": "2.1.6", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hos-sdkmanager-common/-/@ohos/hos-sdkmanager-common-2.1.6.tgz", + "integrity": "sha512-DAT3YbqBE5/6lEOPTQA4pyNt5Wv790AlXcE5iIAofb47uXKmXf3EYL7UBoBRI0U8gJ9qnD/wNuW0vwMrlK8rDw==", + "requires": { + "@ohos/sdkmanager-common": "2.3.4" + } + }, + "@ohos/hvigor": { + "version": "1.4.0", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor/-/@ohos/hvigor-1.4.0.tgz", + "integrity": "sha512-UNWl/KYWaRLmcyXN3tJh0XpmGswjVhSZ08BCukpTrjOSgU335L3PHI6yZJ6PuXxkAxMKgt46IOi4wVdFo8NAPA==", + "requires": { + "@ohos/hvigor-base": "1.4.0", + "fs-extra": "10.0.1", + "interpret": "1.4.0", + "liftoff": "4.0.0", + "mute-stdout": "1.0.0", + "pretty-hrtime": "1.0.0", + "typescript": "4.7.4", + "v8flags": "3.2.0", + "yargs": "17.5.1" + } + }, + "@ohos/hvigor-base": { + "version": "1.4.0", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-base/-/@ohos/hvigor-base-1.4.0.tgz", + "integrity": "sha512-67VK4Of6HgWMDdfa4eMb0MDcDAasctDpK6Akvttwe9U+aV5HSsRJuFS1f3cNGs5+shKyApvj8+AV7VqjzqHsVA==", + "requires": { + "fs-extra": "10.0.1", + "iconv-lite": "0.6.3", + "json5": "2.2.3", + "lodash": "4.17.21", + "log4js": "6.4.1", + "once": "1.4.0", + "pretty-hrtime": "1.0.0" + } + }, + "@ohos/hvigor-ohos-plugin": { + "version": "1.4.1", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-ohos-plugin/-/@ohos/hvigor-ohos-plugin-1.4.1.tgz", + "integrity": "sha512-mmqLGiJGWtUKKeYu2kMPsh6SlTHT8WagszPV6CqQpcpvQRTOP6j1x+a9sLtGYybp4IycWwFW3hA98OIlhrZlgA==", + "requires": { + "@ohos/hos-sdkmanager-common": "2.1.6", + "@ohos/sdkmanager-common": "2.3.4", + "adm-zip": "0.5.9", + "ajv": "8.10.0", + "deasync": "0.1.28", + "execa": "5.1.1", + "fast-xml-parser": "4.0.3", + "fs-extra": "10.0.1", + "glob": "7.2.0", + "iconv-lite": "0.6.3", + "json5": "2.2.3", + "lodash": "4.17.21", + "pretty-hrtime": "1.0.3", + "resolve-package-path": "4.0.3" + }, + "dependencies": { + "pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==" + } + } + }, + "@ohos/hypium": { + "version": "1.0.5", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hypium/-/@ohos/hypium-1.0.5.tgz", + "integrity": "sha512-Rnn5yEb+UzSr/ZApKR8pm53CrM5Rl13J7fvyM1kqPhuRt4pNDTfTlYjPQkj/xiSbtRBIqwwVMa2Ni8SSOroncA==" + }, + "@ohos/sdkmanager-common": { + "version": "2.3.4", + "resolved": "https://repo.harmonyos.com/npm/@ohos/sdkmanager-common/-/@ohos/sdkmanager-common-2.3.4.tgz", + "integrity": "sha512-3WATGJS2lO1EV7F7KzfHCdYwJzr5n+vdrRD65ahHHXptjko1UneBwvY1WEpxSJShQQc4lwKyBK7+6UOsc+NA/w==", + "requires": { + "axios": "0.24.0", + "jszip": "^3.7.0" + } + }, + "adm-zip": { + "version": "0.5.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/adm-zip/-/adm-zip-0.5.9.tgz", + "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==" + }, + "ajv": { + "version": "8.10.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.10.0.tgz", + "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "array-each": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==" + }, + "array-slice": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" + }, + "axios": { + "version": "0.24.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "requires": { + "follow-redirects": "^1.14.4" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "date-format": { + "version": "4.0.14", + "resolved": "https://repo.huaweicloud.com/repository/npm/date-format/-/date-format-4.0.14.tgz", + "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==" + }, + "deasync": { + "version": "0.1.28", + "resolved": "https://repo.huaweicloud.com/repository/npm/deasync/-/deasync-0.1.28.tgz", + "integrity": "sha512-QqLF6inIDwiATrfROIyQtwOQxjZuek13WRYZ7donU5wJPLoP67MnYxA6QtqdvdBy2mMqv5m3UefBVdJjvevOYg==", + "requires": { + "bindings": "^1.5.0", + "node-addon-api": "^1.7.1" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "execa": { + "version": "5.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-xml-parser": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-xml-parser/-/fast-xml-parser-4.0.3.tgz", + "integrity": "sha512-xhQbg3a/EYNHwK0cxIG1nZmVkHX/0tWihamn5pU4Mhd9KEVE2ga8ZJiqEUgB2sApElvAATOdMTLjgqIpvYDUkQ==", + "requires": { + "strnum": "^1.0.5" + } + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "findup-sync": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/findup-sync/-/findup-sync-5.0.0.tgz", + "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.3", + "micromatch": "^4.0.4", + "resolve-dir": "^1.0.1" + } + }, + "fined": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fined/-/fined-2.0.0.tgz", + "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", + "requires": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^5.0.0", + "object.defaults": "^1.1.0", + "object.pick": "^1.3.0", + "parse-filepath": "^1.0.2" + } + }, + "flagged-respawn": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/flagged-respawn/-/flagged-respawn-2.0.0.tgz", + "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==" + }, + "flatted": { + "version": "3.2.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/flatted/-/flatted-3.2.9.tgz", + "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==" + }, + "follow-redirects": { + "version": "1.15.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==" + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==" + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", + "requires": { + "for-in": "^1.0.1" + } + }, + "fs-extra": { + "version": "10.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.0.1.tgz", + "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "global-modules": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "has": { + "version": "1.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/has/-/has-1.0.4.tgz", + "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==" + }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + }, + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, + "immediate": { + "version": "3.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-core-module": { + "version": "2.13.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==" + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "json5": { + "version": "2.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "jszip": { + "version": "3.10.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "lie": { + "version": "3.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, + "liftoff": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/liftoff/-/liftoff-4.0.0.tgz", + "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==", + "requires": { + "extend": "^3.0.2", + "findup-sync": "^5.0.0", + "fined": "^2.0.0", + "flagged-respawn": "^2.0.0", + "is-plain-object": "^5.0.0", + "object.map": "^1.0.1", + "rechoir": "^0.8.0", + "resolve": "^1.20.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "log4js": { + "version": "6.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.4.1.tgz", + "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==", + "requires": { + "date-format": "^4.0.3", + "debug": "^4.3.3", + "flatted": "^3.2.4", + "rfdc": "^1.3.0", + "streamroller": "^3.0.2" + } + }, + "make-iterator": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "requires": { + "kind-of": "^6.0.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha512-MaSQenn0f9oxIjtCufclpV00MuYTiHaXPbdcfPIM+quMqoa8cXywjHHx4LhhIAZlXqPWMdcUpYviajfmHtHRJw==" + }, + "node-addon-api": { + "version": "1.7.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha512-3+mAJu2PLfnSVGHwIWubpOFLscJANBKuB/6A4CxBstc4aqwQY0FWcsppuy4jU5GSB95yES5JHSI+33AWuS4k6w==", + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "pako": { + "version": "1.0.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pretty-hrtime": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz", + "integrity": "sha512-CU2l5CYUAptUYq/671ajexQfXuxJFwwg0n243Kdkx8bTjeenedsWgu8TGHPm03vLfNtk3aTXgySKPp3Usykudw==" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==" + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rechoir": { + "version": "0.8.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "requires": { + "resolve": "^1.20.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, + "resolve": { + "version": "1.22.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-package-path": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-package-path/-/resolve-package-path-4.0.3.tgz", + "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", + "requires": { + "path-root": "^0.1.1" + } + }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "streamroller": { + "version": "3.1.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.1.5.tgz", + "integrity": "sha512-KFxaM7XT+irxvdqSP1LGLgNWbYN7ay5owZ3r/8t77p+EtSUAfUgtl7be3xtqtOmGUl9K9YPO2ca8133RlTjvKw==", + "requires": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "strnum": { + "version": "1.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "typescript": { + "version": "4.7.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==" + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "v8flags": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yargs": { + "version": "17.5.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs/-/yargs-17.5.1.tgz", + "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.0.0" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" + } + } +} diff --git a/frameworks/native/camera/test/ndktest/camera_ndk_demo/package.json b/frameworks/native/camera/test/ndktest/camera_ndk_demo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..fb16214acba9ca17888c4180fa14de49a42ac9ad --- /dev/null +++ b/frameworks/native/camera/test/ndktest/camera_ndk_demo/package.json @@ -0,0 +1,18 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "ndk_camera", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": { + "@ohos/hypium": "1.0.5", + "@ohos/hvigor-ohos-plugin": "1.4.1", + "@ohos/hvigor": "1.4.0" + } +} diff --git a/frameworks/native/ndk/BUILD.gn b/frameworks/native/ndk/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..db1dc00471e1c5c0254121b8ea9b129031d25d2c --- /dev/null +++ b/frameworks/native/ndk/BUILD.gn @@ -0,0 +1,84 @@ +# 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("./../../../multimedia_camera_framework.gni") + +config("camera_ndk_config") { + include_dirs = [ + "${multimedia_camera_framework_path}/interfaces/inner_api/native/camera/include", + "${multimedia_camera_framework_path}/interfaces/kits/native/include/camera", + ] + + cflags = [ + "-Wall", + "-Werror", + ] +} + +ohos_shared_library("camera_ndk") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + + include_dirs = [ + "${driver_disply_path}/interfaces/include", + "${graphic_2d_path}/frameworks/surface/include", + "${multimedia_camera_framework_path}/interfaces", + "${multimedia_camera_framework_path}/interfaces/kits/native/include/camera", + "${multimedia_camera_framework_path}/services/camera_service/include", + ] + + configs = [ ":camera_ndk_config" ] + + sources = [ + "./camera_input.cpp", + "./camera_manager.cpp", + "./capture_session.cpp", + "./metadata_output.cpp", + "./photo_output.cpp", + "./preview_output.cpp", + "./video_output.cpp", + "impl/camera_input_impl.cpp", + "impl/camera_manager_impl.cpp", + "impl/camera_util.cpp", + "impl/capture_session_impl.cpp", + "impl/metadata_output_impl.cpp", + "impl/photo_output_impl.cpp", + "impl/preview_output_impl.cpp", + "impl/video_output_impl.cpp", + ] + + deps = [ "${multimedia_camera_framework_path}/frameworks/native/camera:camera_framework" ] + + cflags = [ "-Werror" ] + + external_deps = [ + "c_utils:utils", + "graphic_2d:surface", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "image_framework:image", + "image_framework:image_native", + "ipc:ipc_core", + ] + + innerapi_tags = [ "ndk" ] + + output_extension = "so" + subsystem_name = "multimedia" + part_name = "camera_framework" +} diff --git a/frameworks/native/ndk/camera_input.cpp b/frameworks/native/ndk/camera_input.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66320f94154ec09a058b7a91f8c9914dd7cb06f7 --- /dev/null +++ b/frameworks/native/ndk/camera_input.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/camera_input.h" +#include "impl/camera_input_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + cameraInput->RegisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + cameraInput->UnregisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + return cameraInput->Open(); +} + +Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + return cameraInput->Close(); +} + +Camera_ErrorCode OH_CameraInput_Release(Camera_Input* cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + Camera_ErrorCode retCode = cameraInput->Release(); + delete cameraInput; + return retCode; +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/camera_manager.cpp b/frameworks/native/ndk/camera_manager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7a8b4bd4fde344d63c38d188ad09931b18a260c7 --- /dev/null +++ b/frameworks/native/ndk/camera_manager.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/camera_manager.h" +#include "impl/camera_manager_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Camera_ErrorCode OH_Camera_GetCameraMananger(Camera_Manager** cameraManager) +{ + *cameraManager = new Camera_Manager(); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onCameraStatus!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onCameraStatus is null!"); + + cameraManager->RegisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onCameraStatus!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onCameraStatus is null!"); + cameraManager->UnregisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, + Camera_Device** cameras, uint32_t* size) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(cameras != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameras is null!"); + CHECK_AND_RETURN_RET_LOG(size!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! size is null!"); + + return cameraManager->GetSupportedCameras(cameras, size); +} + +Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(cameraOutputCapability != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraOutputCapability is null!"); + + return cameraManager->GetSupportedCameraOutputCapability(camera, cameraOutputCapability); +} + +Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted) +{ + MEDIA_DEBUG_LOG("OH_CameraManager_IsCameraMuted is called"); + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + + return cameraManager->IsCameraMuted(isCameraMuted); +} + +Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, + Camera_CaptureSession** captureSession) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(captureSession != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! captureSession is null!"); + + return cameraManager->CreateCaptureSession(captureSession); +} + +Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_Input** cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(camera != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraDevice is null!"); + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + return cameraManager->CreateCameraInput(camera, cameraInput); +} + +Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, + Camera_Position position, Camera_Type type, Camera_Input** cameraInput) +{ + MEDIA_DEBUG_LOG("OH_CameraManager_CreateCameraInput_WithPositionAndType is called"); + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + return cameraManager->CreateCameraInputWithPositionAndType(position, type, cameraInput); +} + +Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PreviewOutput** previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(profile != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! profile is null!"); + CHECK_AND_RETURN_RET_LOG(surfaceId != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! surfaceId is null!"); + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return cameraManager->CreatePreviewOutput(profile, surfaceId, previewOutput); +} + +Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PhotoOutput** photoOutput) +{ + MEDIA_DEBUG_LOG("OH_CameraManager_CreatePhotoOutput is called"); + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(profile != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! profile is null!"); + CHECK_AND_RETURN_RET_LOG(surfaceId != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! surfaceId is null!"); + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return cameraManager->CreatePhotoOutput(profile, surfaceId, photoOutput); +} + +Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, + const char* surfaceId, Camera_VideoOutput** videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(profile != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! profile is null!"); + CHECK_AND_RETURN_RET_LOG(surfaceId != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! surfaceId is null!"); + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return cameraManager->CreateVideoOutput(profile, surfaceId, videoOutput); +} + +Camera_ErrorCode OH_CameraManager_CreateMetadataOutput(Camera_Manager* cameraManager, + const Camera_MetadataObjectType* type, Camera_MetadataOutput** metadataOutput) +{ + CHECK_AND_RETURN_RET_LOG(cameraManager != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraManager is null!"); + CHECK_AND_RETURN_RET_LOG(type != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! type is null!"); + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return cameraManager->CreateMetadataOutput(type, metadataOutput); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/capture_session.cpp b/frameworks/native/ndk/capture_session.cpp new file mode 100644 index 0000000000000000000000000000000000000000..09bd97855062f77dbfd77d8952d4095bc1016acc --- /dev/null +++ b/frameworks/native/ndk/capture_session.cpp @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/capture_session.h" +#include "impl/capture_session_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, CaptureSession_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFocusStateChange is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + session->RegisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session, + CaptureSession_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFocusStateChange!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFocusStateChange is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + session->UnregisterCallback(callback); + return CAMERA_OK; +} + +Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->BeginConfig(); +} + +Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->CommitConfig(); +} + +Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + return session->AddInput(cameraInput); +} + +Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(cameraInput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! cameraInput is null!"); + + return session->RemoveInput(cameraInput); +} + +Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return session->AddPreviewOutput(previewOutput); +} + +Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return session->RemovePreviewOutput(previewOutput); +} + +Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_AddPhotoOutput is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return session->AddPhotoOutput(photoOutput); +} + +Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_RemovePhotoOutput is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return session->RemovePhotoOutput(photoOutput); +} + +Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_AddMetadataOutput is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return session->AddMetaDataOutput(metadataOutput); +} + +Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_RemoveMetadataOutput is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return session->RemoveMetaDataOutput(metadataOutput); +} + +Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_IsVideoStabilizationModeSupported is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! isSupported is null!"); + + return session->IsVideoStabilizationModeSupported(mode, isSupported); +} + +Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode* mode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetVideoStabilizationMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(mode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! mode is null!"); + + return session->GetVideoStabilizationMode(mode); +} + +Camera_ErrorCode OH_CaptureSession_SetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetVideoStabilizationMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->SetVideoStabilizationMode(mode); +} + +Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatioRange is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(minZoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! minZoom is null!"); + CHECK_AND_RETURN_RET_LOG(maxZoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! maxZoom is null!"); + + return session->GetZoomRatioRange(minZoom, maxZoom); +} + +Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetZoomRatio is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(zoom != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! zoom is null!"); + + return session->GetZoomRatio(zoom); +} + +Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetZoomRatio is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->SetZoomRatio(zoom); +} + +Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session, + Camera_FocusMode focusMode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_IsFocusModeSupported is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! isSupported is null!"); + + return session->IsFocusModeSupported(focusMode, isSupported); +} + +Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(focusMode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! focusMode is null!"); + + return session->GetFocusMode(focusMode); +} + +Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->SetFocusMode(focusMode); +} + +Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetFocusPoint is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->SetFocusPoint(focusPoint); +} + +Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetFocusPoint is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(focusPoint != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! focusPoint is null!"); + + return session->GetFocusPoint(focusPoint); +} + +Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return session->AddVideoOutput(videoOutput); +} + +Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return session->RemoveVideoOutput(videoOutput); +} + +Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->Start(); +} + +Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->Stop(); +} + +Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->Release(); +} + +Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(hasFlash != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! hasFlash is null!"); + + return session->HasFlash(hasFlash); +} + +Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session, + Camera_FlashMode flashMode, bool* isSupported) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! isSupported is null!"); + + return session->IsFlashModeSupported(flashMode, isSupported); +} + +Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(flashMode != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! flashMode is null!"); + + return session->GetFlashMode(flashMode); +} + +Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode) +{ + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + + return session->SetFlashMode(flashMode); +} + +Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session, + Camera_ExposureMode exposureMode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_IsExposureModeSupported is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! isSupported is null!"); + return session->IsExposureModeSupported(exposureMode, isSupported); +} + +Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(exposureMode != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! exposureMode is null!"); + return session->GetExposureMode(exposureMode); +} + +Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureMode is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + return session->SetExposureMode(exposureMode); +} + +Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetMeteringPoint is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(point != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! point is null!"); + return session->GetMeteringPoint(point); +} + +Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetMeteringPoint is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + return session->SetMeteringPoint(point); +} + +Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session, + float* minExposureBias, float* maxExposureBias, float* step) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBiasRange is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(minExposureBias != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! minExposureBias is null!"); + CHECK_AND_RETURN_RET_LOG(maxExposureBias != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! maxExposureBias is null!"); + CHECK_AND_RETURN_RET_LOG(step != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! step is null!"); + return session->GetExposureBiasRange(minExposureBias, maxExposureBias, step); +} + +Camera_ErrorCode OH_CaptureSession_SetExposureBias(Camera_CaptureSession* session, float exposureBias) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_SetExposureBias is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + return session->SetExposureBias(exposureBias); +} +Camera_ErrorCode OH_CaptureSession_GetExposureBias(Camera_CaptureSession* session, float* exposureBias) +{ + MEDIA_DEBUG_LOG("OH_CaptureSession_GetExposureBias is called"); + CHECK_AND_RETURN_RET_LOG(session != nullptr, CAMERA_INVALID_ARGUMENT, "invaild argument! session is null!"); + CHECK_AND_RETURN_RET_LOG(exposureBias != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! exposureBias is null!"); + return session->GetExposureBias(exposureBias); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_input_impl.cpp b/frameworks/native/ndk/impl/camera_input_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79bedd2519245c9874fa52c3fef0a5a741ce1d4a --- /dev/null +++ b/frameworks/native/ndk/impl/camera_input_impl.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "camera_input_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerCameraInputCallback : public ErrorCallback { +public: + InnerCameraInputCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback) + : cameraInput_(cameraInput), callback_(*callback) {} + ~InnerCameraInputCallback() = default; + void OnError(const int32_t errorType, const int32_t errorMsg) const override + { + MEDIA_DEBUG_LOG("OnError is called!, errorType: %{public}d", errorType); + if (cameraInput_ != nullptr && callback_.onError != nullptr) { + callback_.onError(cameraInput_, FrameworkToNdkCameraError(errorType)); + } + } + +private: + Camera_Input* cameraInput_; + CameraInput_Callbacks callback_; +}; + +Camera_Input::Camera_Input(sptr &innerCameraInput) : innerCameraInput_(innerCameraInput) +{ + MEDIA_DEBUG_LOG("Camera_Input Constructor is called"); +} + +Camera_Input::~Camera_Input() +{ + MEDIA_DEBUG_LOG("~Camera_Input is called"); + if (innerCameraInput_) { + innerCameraInput_ = nullptr; + } +} + +Camera_ErrorCode Camera_Input::RegisterCallback(CameraInput_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + innerCameraInput_->SetErrorCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Input::UnregisterCallback(CameraInput_Callbacks* callback) +{ + innerCameraInput_->SetErrorCallback(nullptr); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Input::Open() +{ + int32_t ret = innerCameraInput_->Open(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_Input::Close() +{ + int32_t ret = innerCameraInput_->Close(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_Input::Release() +{ + int32_t ret = innerCameraInput_->Release(); + return FrameworkToNdkCameraError(ret); +} + +sptr Camera_Input::GetInnerCameraInput() +{ + return innerCameraInput_; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_input_impl.h b/frameworks/native/ndk/impl/camera_input_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..91d8777f6f0eb93dd2152a8157f8796b79eb1495 --- /dev/null +++ b/frameworks/native/ndk/impl/camera_input_impl.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_CAMERA_INPUT_IMPL_H +#define OHOS_CAMERA_INPUT_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/camera_input.h" +#include "input/camera_input.h" + +struct Camera_Input { +public: + explicit Camera_Input(OHOS::sptr &innerCameraInput); + ~Camera_Input(); + + Camera_ErrorCode RegisterCallback(CameraInput_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(CameraInput_Callbacks* callback); + + Camera_ErrorCode Open(); + + Camera_ErrorCode Close(); + + Camera_ErrorCode Release(); + + OHOS::sptr GetInnerCameraInput(); + +private: + OHOS::sptr innerCameraInput_; +}; +#endif // OHOS_CAMERA_INPUT_IMPL_H \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_manager_impl.cpp b/frameworks/native/ndk/impl/camera_manager_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aaf923df184dfd67585742fc14e55351cff32b51 --- /dev/null +++ b/frameworks/native/ndk/impl/camera_manager_impl.cpp @@ -0,0 +1,358 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "camera_manager_impl.h" +#include "camera_log.h" +#include "camera_util.h" +#include "surface_utils.h" +#include "image_receiver.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerCameraManagerCallback : public CameraManagerCallback { +public: + InnerCameraManagerCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback) + : cameraManager_(cameraManager), callback_(*callback) {} + ~InnerCameraManagerCallback() = default; + + void OnCameraStatusChanged(const CameraStatusInfo &cameraStatusInfo) const override + { + MEDIA_DEBUG_LOG("OnFrameStarted is called!"); + Camera_StatusInfo statusInfo; + statusInfo.camera->cameraId = cameraStatusInfo.cameraDevice->GetID().data(); + statusInfo.camera->cameraPosition = static_cast(cameraStatusInfo.cameraDevice->GetPosition()); + statusInfo.camera->cameraType = static_cast(cameraStatusInfo.cameraDevice->GetCameraType()); + statusInfo.camera->connectionType = + static_cast(cameraStatusInfo.cameraDevice->GetConnectionType()); + statusInfo.status = static_cast(cameraStatusInfo.cameraStatus); + if (cameraManager_ != nullptr && callback_.onCameraStatus != nullptr) { + callback_.onCameraStatus(cameraManager_, &statusInfo); + } + } + + void OnFlashlightStatusChanged(const std::string &cameraID, const FlashStatus flashStatus) const override + { + MEDIA_DEBUG_LOG("OnFrameStarted is called!"); + (void)cameraID; + (void)flashStatus; + } + +private: + Camera_Manager* cameraManager_; + CameraManager_Callbacks callback_; +}; + +Camera_Manager::Camera_Manager() +{ + MEDIA_DEBUG_LOG("Camera_Manager Constructor is called"); + cameraManager_ = CameraManager::GetInstance(); +} + +Camera_Manager::~Camera_Manager() +{ + MEDIA_DEBUG_LOG("~Camera_Manager is called"); + if (cameraManager_) { + cameraManager_ = nullptr; + } +} + +Camera_ErrorCode Camera_Manager::RegisterCallback(CameraManager_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + cameraManager_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::UnregisterCallback(CameraManager_Callbacks* callback) +{ + cameraManager_->SetCallback(nullptr); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::GetSupportedCameras(Camera_Device** cameras, uint32_t* size) +{ + std::vector> cameraObjList = CameraManager::GetInstance()->GetSupportedCameras(); + int cameraSize = cameraObjList.size(); + if (cameraSize <= 0) { + MEDIA_ERR_LOG("camera size <= 0"); + return CAMERA_INVALID_ARGUMENT; + } + Camera_Device *outCameras = new Camera_Device[cameraSize]; + for (int i = 0; i < cameraSize; i++) { + const char* src = cameraObjList[i]->GetID().c_str(); + size_t dstSize = strlen(src) + 1; + char* dst = new char[dstSize]; + if (!dst) { + MEDIA_ERR_LOG("Allocate memory for cameraId failed!"); + return CAMERA_SERVICE_FATAL_ERROR; + } + strlcpy(dst, src, dstSize); + outCameras[i].cameraId = dst; + outCameras[i].cameraPosition = static_cast(cameraObjList[i]->GetPosition()); + outCameras[i].cameraType = static_cast(cameraObjList[i]->GetCameraType()); + outCameras[i].connectionType = static_cast(cameraObjList[i]->GetConnectionType()); + } + *cameras = outCameras; + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::GetSupportedCameraOutputCapability(const Camera_Device* camera, + Camera_OutputCapability** cameraOutputCapability) +{ + Camera_OutputCapability* outCapability = new Camera_OutputCapability; + + sptr cameraDevice = nullptr; + std::vector> cameraObjList = CameraManager::GetInstance()->GetSupportedCameras(); + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability cameraInfo is null, the cameraObjList size is %{public}zu", + cameraObjList.size()); + for (size_t i = 0; i < cameraObjList.size(); i++) { + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability for"); + sptr innerCameraDevice = cameraObjList[i]; + if (innerCameraDevice == nullptr) { + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability innerCameraDevice == null"); + continue; + } + if (innerCameraDevice->GetPosition() == static_cast(camera->cameraPosition) && + innerCameraDevice->GetCameraType() == static_cast(camera->cameraType)) { + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability position:%{public}d, type:%{public}d ", + innerCameraDevice->GetPosition(), innerCameraDevice->GetCameraType()); + cameraDevice = innerCameraDevice; + + break; + } + } + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability test"); + sptr innerCameraOutputCapability = + CameraManager::GetInstance()->GetSupportedOutputCapability(cameraDevice); + if (innerCameraOutputCapability == nullptr) { + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability innerCameraOutputCapability == null"); + } + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability innerCameraOutputCapability !- null"); + std::vector previewProfiles = innerCameraOutputCapability->GetPreviewProfiles(); + std::vector photoProfiles = innerCameraOutputCapability->GetPhotoProfiles(); + std::vector videoProfiles = innerCameraOutputCapability->GetVideoProfiles(); + int previewOutputNum = previewProfiles.size(); + int photoOutputNum = previewProfiles.size(); + int videoOutputNum = videoProfiles.size(); + if (previewOutputNum <= 0 || photoOutputNum <= 0 || videoOutputNum <= 0) { + MEDIA_ERR_LOG("alloc size <= 0"); + return CAMERA_INVALID_ARGUMENT; + } + Camera_Profile *outPreviewProfiles = new Camera_Profile[previewOutputNum]; + Camera_Profile *outPhotoProfiles = new Camera_Profile[photoOutputNum]; + Camera_VideoProfile *outVideoProfiles = new Camera_VideoProfile[videoOutputNum]; + for (int i = 0; i < previewOutputNum; i++) { + outPreviewProfiles[i].format = static_cast(previewProfiles[i].GetCameraFormat()); + outPreviewProfiles[i].size.width = previewProfiles[i].GetSize().width; + outPreviewProfiles[i].size.height = previewProfiles[i].GetSize().height; + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability previewOutputNum enter"); + } + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability previewOutputNum exit"); + + outCapability->previewProfiles = &outPreviewProfiles; + + for (int i = 0; i < photoOutputNum; i++) { + outPhotoProfiles[i].format = static_cast(photoProfiles[i].GetCameraFormat()); + outPhotoProfiles[i].size.width = photoProfiles[i].GetSize().width; + outPhotoProfiles[i].size.height = photoProfiles[i].GetSize().height; + } + outCapability->photoProfiles = &outPhotoProfiles; + + for (int i = 0; i < videoOutputNum; i++) { + outVideoProfiles[i].format = static_cast(videoProfiles[i].GetCameraFormat()); + outVideoProfiles[i].size.width = videoProfiles[i].GetSize().width; + outVideoProfiles[i].size.height = videoProfiles[i].GetSize().height; + outVideoProfiles[i].range.min = videoProfiles[i].framerates_[0]; + outVideoProfiles[i].range.max = videoProfiles[i].framerates_[1]; + } + outCapability->videoProfiles = &outVideoProfiles; + + *cameraOutputCapability = outCapability; + MEDIA_ERR_LOG("GetSupportedCameraOutputCapability previewOutputNum return"); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::IsCameraMuted(bool* isCameraMuted) +{ + MEDIA_ERR_LOG("Camera_Manager IsCameraMuted is called"); + *isCameraMuted = CameraManager::GetInstance()->IsCameraMuted(); + MEDIA_ERR_LOG("IsCameraMuted is %{public}d", *isCameraMuted); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreateCaptureSession(Camera_CaptureSession** captureSession) +{ + sptr innerCaptureSession = nullptr; + int retCode = CameraManager::GetInstance()->CreateCaptureSession(&innerCaptureSession); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_CaptureSession* outSession = new Camera_CaptureSession(innerCaptureSession); + *captureSession = outSession; + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreateCameraInput(const Camera_Device* camera, Camera_Input** cameraInput) +{ + sptr cameraDevice = nullptr; + std::vector> cameraObjList = CameraManager::GetInstance()->GetSupportedCameras(); + MEDIA_DEBUG_LOG("cameraInfo is null, the cameraObjList size is %{public}zu", + cameraObjList.size()); + for (size_t i = 0; i < cameraObjList.size(); i++) { + sptr innerCameraDevice = cameraObjList[i]; + if (innerCameraDevice == nullptr) { + continue; + } + if (innerCameraDevice->GetPosition() == static_cast(camera->cameraPosition) && + innerCameraDevice->GetCameraType() == static_cast(camera->cameraType)) { + cameraDevice = innerCameraDevice; + break; + } + } + + sptr innerCameraInput = nullptr; + int retCode = CameraManager::GetInstance()->CreateCameraInput(cameraDevice, &innerCameraInput); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_Input* outInput = new Camera_Input(innerCameraInput); + *cameraInput = outInput; + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreateCameraInputWithPositionAndType(Camera_Position position, Camera_Type type, + Camera_Input** cameraInput) +{ + MEDIA_ERR_LOG("Camera_Manager CreateCameraInputWithPositionAndType is called"); + sptr innerCameraInput = nullptr; + CameraPosition innerPosition = static_cast(position); + CameraType innerType = static_cast(type); + + innerCameraInput = CameraManager::GetInstance()->CreateCameraInput(innerPosition, innerType); + if (innerCameraInput == nullptr) { + MEDIA_ERR_LOG("failed to CreateCameraInputWithPositionAndType"); + } + + Camera_Input* outInput = new Camera_Input(innerCameraInput); + *cameraInput = outInput; + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreatePreviewOutput(const Camera_Profile* profile, + const char* surfaceId, Camera_PreviewOutput** previewOutput) +{ + sptr innerPreviewOutput = nullptr; + Size size; + size.width = profile->size.width; + size.height = profile->size.height; + Profile innerProfile(static_cast(profile->format), size); + + uint64_t iSurfaceId; + std::istringstream iss(surfaceId); + iss >> iSurfaceId; + sptr surface = SurfaceUtils::GetInstance()->GetSurface(iSurfaceId); + if (!surface) { + surface = Media::ImageReceiver::getSurfaceById(surfaceId); + } + if (surface == nullptr) { + MEDIA_ERR_LOG("failed to get previewOutput surface"); + } + + surface->SetUserData(CameraManager::surfaceFormat, std::to_string(innerProfile.GetCameraFormat())); + int retCode = CameraManager::GetInstance()->CreatePreviewOutput(innerProfile, surface, &innerPreviewOutput); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_PreviewOutput* out = new Camera_PreviewOutput(innerPreviewOutput); + *previewOutput = out; + MEDIA_ERR_LOG("Camera_Manager::CreatePreviewOutput"); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreatePhotoOutput(const Camera_Profile* profile, + const char* surfaceId, Camera_PhotoOutput** photoOutput) +{ + MEDIA_ERR_LOG("Camera_Manager CreatePhotoOutput is called"); + sptr innerPhotoOutput = nullptr; + Size size; + size.width = profile->size.width; + size.height = profile->size.height; + Profile innerProfile(static_cast(profile->format), size); + + sptr surface = Media::ImageReceiver::getSurfaceById(surfaceId); + if (surface == nullptr) { + MEDIA_ERR_LOG("failed to get photoOutput surface"); + } + + surface->SetUserData(CameraManager::surfaceFormat, std::to_string(innerProfile.GetCameraFormat())); + sptr surfaceProducer = surface->GetProducer(); + int retCode = CameraManager::GetInstance()->CreatePhotoOutput(innerProfile, surfaceProducer, &innerPhotoOutput); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_PhotoOutput* out = new Camera_PhotoOutput(innerPhotoOutput); + *photoOutput = out; + return CAMERA_OK; +} + +Camera_ErrorCode Camera_Manager::CreateVideoOutput(const Camera_VideoProfile* profile, + const char* surfaceId, Camera_VideoOutput** videoOutput) +{ + sptr innerVideoOutput = nullptr; + Size size; + size.width = profile->size.width; + size.height = profile->size.height; + std::vector framerates = {profile->range.min, profile->range.max}; + VideoProfile innerProfile(static_cast(profile->format), size, framerates); + + uint64_t iSurfaceId; + std::istringstream iss(surfaceId); + iss >> iSurfaceId; + sptr surface = SurfaceUtils::GetInstance()->GetSurface(iSurfaceId); + if (!surface) { + surface = Media::ImageReceiver::getSurfaceById(surfaceId); + } + if (surface == nullptr) { + MEDIA_ERR_LOG("failed to get videoOutput surface"); + } + + surface->SetUserData(CameraManager::surfaceFormat, std::to_string(innerProfile.GetCameraFormat())); + int retCode = CameraManager::GetInstance()->CreateVideoOutput(innerProfile, surface, &innerVideoOutput); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_VideoOutput* out = new Camera_VideoOutput(innerVideoOutput); + *videoOutput = out; + return CAMERA_OK; +} + + +Camera_ErrorCode Camera_Manager::CreateMetadataOutput(const Camera_MetadataObjectType* type, + Camera_MetadataOutput** metadataOutput) +{ + MEDIA_ERR_LOG("Camera_Manager CreateMetadataOutput is called"); + sptr innerMetadataOutput = nullptr; + + int retCode = CameraManager::GetInstance()->CreateMetadataOutput(&innerMetadataOutput); + if (retCode != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + Camera_MetadataOutput* out = new Camera_MetadataOutput(innerMetadataOutput); + *metadataOutput = out; + return CAMERA_OK; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_manager_impl.h b/frameworks/native/ndk/impl/camera_manager_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..773d66790334f205c97d778753291ce604a05f05 --- /dev/null +++ b/frameworks/native/ndk/impl/camera_manager_impl.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_CAMERA_MANAGER_IMPL_H +#define OHOS_CAMERA_MANAGER_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/camera_manager.h" +#include "input/camera_manager.h" +#include "capture_session_impl.h" +#include "camera_input_impl.h" +#include "preview_output_impl.h" +#include "video_output_impl.h" +#include "photo_output_impl.h" +#include "metadata_output_impl.h" + +struct Camera_Manager { +public: + Camera_Manager(); + ~Camera_Manager(); + + Camera_ErrorCode RegisterCallback(CameraManager_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(CameraManager_Callbacks* callback); + + Camera_ErrorCode GetSupportedCameras(Camera_Device** cameras, uint32_t* size); + + Camera_ErrorCode GetSupportedCameraOutputCapability(const Camera_Device* camera, + Camera_OutputCapability** cameraOutputCapability); + + Camera_ErrorCode IsCameraMuted(bool* isCameraMuted); + + Camera_ErrorCode CreateCaptureSession(Camera_CaptureSession** captureSession); + + Camera_ErrorCode CreateCameraInput(const Camera_Device* camera, Camera_Input** cameraInput); + + Camera_ErrorCode CreateCameraInputWithPositionAndType(Camera_Position position, Camera_Type type, + Camera_Input** cameraInput); + + Camera_ErrorCode CreatePreviewOutput(const Camera_Profile* profile, const char* surfaceId, + Camera_PreviewOutput** previewOutput); + + Camera_ErrorCode CreatePhotoOutput(const Camera_Profile* profile, const char* surfaceId, + Camera_PhotoOutput** photoOutput); + + Camera_ErrorCode CreateVideoOutput(const Camera_VideoProfile* profile, const char* surfaceId, + Camera_VideoOutput** videoOutput); + + Camera_ErrorCode CreateMetadataOutput(const Camera_MetadataObjectType* type, + Camera_MetadataOutput** metadataOutput); + +private: + OHOS::sptr cameraManager_; +}; +#endif // OHOS_CAMERA_CAPTURE_INPUT_H \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_util.cpp b/frameworks/native/ndk/impl/camera_util.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9f5005bf20389804179ebe958d57872b75ae6b81 --- /dev/null +++ b/frameworks/native/ndk/impl/camera_util.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021-2022 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. + */ + +#include "kits/native/include/camera/camera.h" +#include "camera_log.h" +#include "camera_error_code.h" +#include "camera_util.h" + +namespace OHOS { +namespace CameraStandard { +Camera_ErrorCode FrameworkToNdkCameraError(int32_t ret) +{ + Camera_ErrorCode err = CAMERA_OK; + switch (ret) { + case CameraErrorCode::SUCCESS: + err = CAMERA_OK; + break; + case CameraErrorCode::NO_SYSTEM_APP_PERMISSION: + err = CAMERA_OPERATION_NOT_ALLOWED; + break; + case CameraErrorCode::INVALID_ARGUMENT: + err = CAMERA_INVALID_ARGUMENT; + break; + case CameraErrorCode::OPERATION_NOT_ALLOWED: + err = CAMERA_OPERATION_NOT_ALLOWED; + break; + case CameraErrorCode::SESSION_NOT_CONFIG: + err = CAMERA_SESSION_NOT_CONFIG; + break; + case CameraErrorCode::SESSION_NOT_RUNNING: + err = CAMERA_SESSION_NOT_RUNNING; + break; + case CameraErrorCode::SESSION_CONFIG_LOCKED: + err = CAMERA_SESSION_CONFIG_LOCKED; + break; + case CameraErrorCode::DEVICE_SETTING_LOCKED: + err = CAMERA_DEVICE_SETTING_LOCKED; + break; + case CameraErrorCode::CONFLICT_CAMERA: + err = CAMERA_CONFLICT_CAMERA; + break; + case CameraErrorCode::DEVICE_DISABLED: + err = CAMERA_DEVICE_DISABLED; + break; + case CameraErrorCode::DEVICE_PREEMPTED: + err = CAMERA_DEVICE_PREEMPTED; + break; + case CameraErrorCode::SERVICE_FATL_ERROR: + err = CAMERA_SERVICE_FATAL_ERROR; + break; + default: + MEDIA_ERR_LOG("ServiceToCameraError() error code from service: %{public}d", ret); + break; + } + return err; +} +} // namespace CameraStandard +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/ndk/impl/camera_util.h b/frameworks/native/ndk/impl/camera_util.h new file mode 100644 index 0000000000000000000000000000000000000000..59b8d833ce40c3f752d6273812e362beb504d471 --- /dev/null +++ b/frameworks/native/ndk/impl/camera_util.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2021-2022 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. + */ + +#ifndef OHOS_CAMERA_CAMERA_UTIL_H +#define OHOS_CAMERA_CAMERA_UTIL_H + +#include +#include "display_type.h" +#include "kits/native/include/camera/camera.h" + +namespace OHOS { +namespace CameraStandard { +Camera_ErrorCode FrameworkToNdkCameraError(int32_t ret); +} // namespace CameraStandard +} // namespace OHOS +#endif // OHOS_CAMERA_CAMERA_UTIL_H \ No newline at end of file diff --git a/frameworks/native/ndk/impl/capture_session_impl.cpp b/frameworks/native/ndk/impl/capture_session_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b27a0bdfddb9fb5390425045e0fa68cf640d031a --- /dev/null +++ b/frameworks/native/ndk/impl/capture_session_impl.cpp @@ -0,0 +1,428 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "capture_session_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerCaptureSessionCallback : public SessionCallback, public FocusCallback { +public: + InnerCaptureSessionCallback(Camera_CaptureSession* captureSession, CaptureSession_Callbacks* callback) + : captureSession_(captureSession), callback_(*callback) {} + ~InnerCaptureSessionCallback() = default; + + void OnFocusState(FocusState state) override + { + MEDIA_DEBUG_LOG("OnFrameStarted is called!"); + if (captureSession_ != nullptr && callback_.onFocusStateChange != nullptr) { + callback_.onFocusStateChange(captureSession_, static_cast(state)); + } + } + + void OnError(const int32_t errorCode) override + { + MEDIA_DEBUG_LOG("OnError is called!, errorCode: %{public}d", errorCode); + if (captureSession_ != nullptr && callback_.onError != nullptr) { + callback_.onError(captureSession_, FrameworkToNdkCameraError(errorCode)); + } + } + +private: + Camera_CaptureSession* captureSession_; + CaptureSession_Callbacks callback_; +}; + +Camera_CaptureSession::Camera_CaptureSession(sptr &innerCaptureSession) + : innerCaptureSession_(innerCaptureSession) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession Constructor is called"); +} + +Camera_CaptureSession::~Camera_CaptureSession() +{ + MEDIA_DEBUG_LOG("~Camera_CaptureSession is called"); + if (innerCaptureSession_) { + innerCaptureSession_ = nullptr; + } +} + +Camera_ErrorCode Camera_CaptureSession::RegisterCallback(CaptureSession_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + innerCaptureSession_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::UnregisterCallback(CaptureSession_Callbacks* callback) +{ + innerCaptureSession_->SetCallback(nullptr); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::BeginConfig() +{ + int32_t ret = innerCaptureSession_->BeginConfig(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::CommitConfig() +{ + int32_t ret = innerCaptureSession_->CommitConfig(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::AddInput(Camera_Input* cameraInput) +{ + sptr innerCameraInput = cameraInput->GetInnerCameraInput(); + int32_t ret = innerCaptureSession_->AddInput(innerCameraInput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::RemoveInput(Camera_Input* cameraInput) +{ + sptr innerCameraInput = cameraInput->GetInnerCameraInput(); + int32_t ret = innerCaptureSession_->RemoveInput(innerCameraInput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::AddPreviewOutput(Camera_PreviewOutput* previewOutput) +{ + sptr innerPreviewOutput = previewOutput->GetInnerPreviewOutput(); + int32_t ret = innerCaptureSession_->AddOutput(innerPreviewOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::RemovePreviewOutput(Camera_PreviewOutput* previewOutput) +{ + sptr innerPreviewOutput = previewOutput->GetInnerPreviewOutput(); + int32_t ret = innerCaptureSession_->RemoveOutput(innerPreviewOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::AddPhotoOutput(Camera_PhotoOutput* photoOutput) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::AddPhotoOutput is called"); + sptr innerPhotoOutput = photoOutput->GetInnerPhotoOutput(); + int32_t ret = innerCaptureSession_->AddOutput(innerPhotoOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::RemovePhotoOutput(Camera_PhotoOutput* photoOutput) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::RemovePhotoOutput is called"); + sptr innerPhotoOutput = photoOutput->GetInnerPhotoOutput(); + int32_t ret = innerCaptureSession_->RemoveOutput(innerPhotoOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::AddMetaDataOutput(Camera_MetadataOutput* metadataOutput) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::AddMetaDataOutput is called"); + sptr innerMetaDataOutput = metadataOutput->GetInnerMetadataOutput(); + int32_t ret = innerCaptureSession_->AddOutput(innerMetaDataOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::RemoveMetaDataOutput(Camera_MetadataOutput* metadataOutput) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::RemoveMetaDataOutput is called"); + sptr innerMetaDataOutput = metadataOutput->GetInnerMetadataOutput(); + int32_t ret = innerCaptureSession_->AddOutput(innerMetaDataOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::IsVideoStabilizationModeSupported(Camera_VideoStabilizationMode mode, + bool* isSupported) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::IsVideoStabilizationModeSupported is called"); + VideoStabilizationMode innerVideoStabilizationMode = static_cast(mode); + int32_t ret = innerCaptureSession_->IsVideoStabilizationModeSupported(innerVideoStabilizationMode, *isSupported); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetVideoStabilizationMode(Camera_VideoStabilizationMode* mode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetVideoStabilizationMode is called"); + VideoStabilizationMode innerVideoStabilizationMode = static_cast(*mode); + int32_t ret = innerCaptureSession_->GetActiveVideoStabilizationMode(innerVideoStabilizationMode); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetVideoStabilizationMode(Camera_VideoStabilizationMode mode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetVideoStabilizationMode is called"); + VideoStabilizationMode innerVideoStabilizationMode = static_cast(mode); + int32_t ret = innerCaptureSession_->IsVideoStabilizationModeSupported(innerVideoStabilizationMode); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetZoomRatioRange(float* minZoom, float* maxZoom) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetZoomRatioRange is called"); + std::vector vecZoomRatioList = innerCaptureSession_->GetZoomRatioRange(); + *minZoom = vecZoomRatioList[0]; + *maxZoom = vecZoomRatioList[1]; + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::GetZoomRatio(float* zoom) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetZoomRatio is called"); + *zoom = innerCaptureSession_->GetZoomRatio(); + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::SetZoomRatio(float zoom) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetZoomRatio is called"); + int32_t ret = innerCaptureSession_->SetZoomRatio(zoom); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::IsFocusModeSupported(Camera_FocusMode focusMode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::IsFocusModeSupported is called"); + FocusMode innerFocusMode = static_cast(focusMode); + int32_t ret = innerCaptureSession_->IsFocusModeSupported(innerFocusMode, *isSupported); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetFocusMode(Camera_FocusMode* focusMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetFocusMode is called"); + FocusMode innerFocusMode = static_cast(*focusMode); + int32_t ret = innerCaptureSession_->GetFocusMode(innerFocusMode); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetFocusMode(Camera_FocusMode focusMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetFocusMode is called"); + FocusMode innerFocusMode = static_cast(focusMode); + int32_t ret = innerCaptureSession_->SetFocusMode(innerFocusMode); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetFocusPoint(Camera_Point focusPoint) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetFocusPoint is called"); + Point innerFocusPoint; + innerFocusPoint.x = focusPoint.x; + innerFocusPoint.y = focusPoint.y; + int32_t ret = innerCaptureSession_->SetFocusPoint(innerFocusPoint); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetFocusPoint(Camera_Point* focusPoint) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetFocusPoint is called"); + Point innerFocusPoint; + innerFocusPoint.x = focusPoint->x; + innerFocusPoint.y = focusPoint->y; + int32_t ret = innerCaptureSession_->GetFocusPoint(innerFocusPoint); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::HasFlash(bool* hasFlash) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::HasFlash is called"); + + *hasFlash = innerCaptureSession_->HasFlash(); + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::IsFlashModeSupported(Camera_FlashMode flashMode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::IsFlashModeSupported is called"); + FlashMode innerFlashMode = static_cast(flashMode); + + *isSupported = innerCaptureSession_->IsFlashModeSupported(innerFlashMode); + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::GetFlashMode(Camera_FlashMode* flashMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetFlashMode is called"); + *flashMode = static_cast(innerCaptureSession_->GetFlashMode()); + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_CaptureSession::SetFlashMode(Camera_FlashMode flashMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetFlashMode is called"); + FlashMode innerFlashMode = static_cast(flashMode); + int32_t ret = innerCaptureSession_->SetFlashMode(innerFlashMode); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::IsExposureModeSupported(Camera_ExposureMode exposureMode, bool* isSupported) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::IsExposureModeSupported is called"); + ExposureMode innerExposureMode = static_cast(exposureMode); + int32_t ret = innerCaptureSession_->IsExposureModeSupported(innerExposureMode, *isSupported); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetExposureMode(Camera_ExposureMode* exposureMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetExposureMode is called"); + ExposureMode innerExposureMode = static_cast(*exposureMode); + int32_t ret = innerCaptureSession_->GetExposureMode(innerExposureMode); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetExposureMode(Camera_ExposureMode exposureMode) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetExposureMode is called"); + ExposureMode innerExposureMode = static_cast(exposureMode); + int32_t ret = innerCaptureSession_->SetExposureMode(innerExposureMode); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetMeteringPoint(Camera_Point* point) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetMeteringPoint is called"); + Point innerExposurePoint; + innerExposurePoint.x = point->x; + innerExposurePoint.y = point->y; + int32_t ret = innerCaptureSession_->GetMeteringPoint(innerExposurePoint); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetMeteringPoint(Camera_Point point) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetMeteringPoint is called"); + Point innerExposurePoint; + innerExposurePoint.x = point.x; + innerExposurePoint.y = point.y; + int32_t ret = innerCaptureSession_->SetMeteringPoint(innerExposurePoint); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetExposureBiasRange(float* minExposureBias, + float* maxExposureBias, float* step) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetExposureBiasRange is called"); + std::vector vecExposureBiasList; + int32_t ret = innerCaptureSession_->GetExposureBiasRange(vecExposureBiasList); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + + size_t len = vecExposureBiasList.size(); + for (size_t i = 0; i < len; i++) { + *minExposureBias = vecExposureBiasList[0]; + *maxExposureBias = vecExposureBiasList[0]; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::SetExposureBias(float exposureBias) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::SetExposureBias is called"); + int32_t ret = innerCaptureSession_->SetExposureBias(exposureBias); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::GetExposureBias(float* exposureBias) +{ + MEDIA_DEBUG_LOG("Camera_CaptureSession::GetExposureBias is called"); + int32_t ret = innerCaptureSession_->GetExposureValue(*exposureBias); + if (ret != CameraErrorCode::SUCCESS) { + return CAMERA_SERVICE_FATAL_ERROR; + } + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::AddVideoOutput(Camera_VideoOutput* videoOutput) +{ + sptr innerVideoOutput = videoOutput->GetInnerVideoOutput(); + int32_t ret = innerCaptureSession_->AddOutput(innerVideoOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::RemoveVideoOutput(Camera_VideoOutput* videoOutput) +{ + sptr innerVideoOutput = videoOutput->GetInnerVideoOutput(); + int32_t ret = innerCaptureSession_->RemoveOutput(innerVideoOutput); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::Start() +{ + int32_t ret = innerCaptureSession_->Start(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::Stop() +{ + int32_t ret = innerCaptureSession_->Stop(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_CaptureSession::Release() +{ + int32_t ret = innerCaptureSession_->Release(); + return FrameworkToNdkCameraError(ret); +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/capture_session_impl.h b/frameworks/native/ndk/impl/capture_session_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..8b8e5db059557b10dc2b64a20a7976b91ba2b0bd --- /dev/null +++ b/frameworks/native/ndk/impl/capture_session_impl.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_CAPTURE_SESSION_IMPL_H +#define OHOS_CAPTURE_SESSION_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/capture_session.h" +#include "session/capture_session.h" +#include "camera_input_impl.h" +#include "preview_output_impl.h" +#include "video_output_impl.h" +#include "photo_output_impl.h" +#include "metadata_output_impl.h" + +struct Camera_CaptureSession { +public: + explicit Camera_CaptureSession(OHOS::sptr &innerCaptureSession); + ~Camera_CaptureSession(); + + Camera_ErrorCode RegisterCallback(CaptureSession_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(CaptureSession_Callbacks* callback); + + Camera_ErrorCode BeginConfig(); + + Camera_ErrorCode CommitConfig(); + + Camera_ErrorCode AddInput(Camera_Input* cameraInput); + + Camera_ErrorCode RemoveInput(Camera_Input* cameraInput); + + Camera_ErrorCode AddPreviewOutput(Camera_PreviewOutput* previewOutput); + + Camera_ErrorCode RemovePreviewOutput(Camera_PreviewOutput* previewOutput); + + Camera_ErrorCode AddPhotoOutput(Camera_PhotoOutput* photoOutput); + + Camera_ErrorCode RemovePhotoOutput(Camera_PhotoOutput* photoOutput); + + Camera_ErrorCode AddVideoOutput(Camera_VideoOutput* videoOutput); + + Camera_ErrorCode RemoveVideoOutput(Camera_VideoOutput* videoOutput); + + Camera_ErrorCode AddMetaDataOutput(Camera_MetadataOutput* metadataOutput); + + Camera_ErrorCode RemoveMetaDataOutput(Camera_MetadataOutput* metadataOutput); + + Camera_ErrorCode IsVideoStabilizationModeSupported(Camera_VideoStabilizationMode mode, bool* isSupported); + + Camera_ErrorCode GetVideoStabilizationMode(Camera_VideoStabilizationMode* mode); + + Camera_ErrorCode SetVideoStabilizationMode(Camera_VideoStabilizationMode mode); + + Camera_ErrorCode GetZoomRatioRange(float* minZoom, float* maxZoom); + + Camera_ErrorCode GetZoomRatio(float* zoom); + + Camera_ErrorCode SetZoomRatio(float zoom); + + Camera_ErrorCode IsFocusModeSupported(Camera_FocusMode focusMode, bool* isSupported); + + Camera_ErrorCode GetFocusMode(Camera_FocusMode* focusMode); + + Camera_ErrorCode SetFocusMode(Camera_FocusMode focusMode); + + Camera_ErrorCode SetFocusPoint(Camera_Point focusPoint); + + Camera_ErrorCode GetFocusPoint(Camera_Point* focusPoint); + + Camera_ErrorCode HasFlash(bool* hasFlash); + + Camera_ErrorCode IsFlashModeSupported(Camera_FlashMode flashMode, bool* isSupported); + + Camera_ErrorCode GetFlashMode(Camera_FlashMode* flashMode); + + Camera_ErrorCode SetFlashMode(Camera_FlashMode flashMode); + + Camera_ErrorCode IsExposureModeSupported(Camera_ExposureMode exposureMode, bool* isSupported); + + Camera_ErrorCode GetExposureMode(Camera_ExposureMode* exposureMode); + + Camera_ErrorCode SetExposureMode(Camera_ExposureMode exposureMode); + + Camera_ErrorCode GetMeteringPoint(Camera_Point* point); + + Camera_ErrorCode SetMeteringPoint(Camera_Point point); + + Camera_ErrorCode GetExposureBiasRange(float* minExposureBias, float* maxExposureBias, float* step); + + Camera_ErrorCode SetExposureBias(float exposureBias); + + Camera_ErrorCode GetExposureBias(float* exposureBias); + + Camera_ErrorCode Start(); + + Camera_ErrorCode Stop(); + + Camera_ErrorCode Release(); + +private: + OHOS::sptr innerCaptureSession_; +}; +#endif // OHOS_CAPTURE_SESSION_IMPL_H \ No newline at end of file diff --git a/frameworks/native/ndk/impl/metadata_output_impl.cpp b/frameworks/native/ndk/impl/metadata_output_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c16569303e07e9aabef2f9cf370fb8e63f12b4bf --- /dev/null +++ b/frameworks/native/ndk/impl/metadata_output_impl.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "metadata_output_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerMetadataOutputCallback : public MetadataStateCallback { +public: + InnerMetadataOutputCallback(Camera_MetadataOutput* metadataOutput, MetadataOutput_Callbacks* callback) + : metadataOutput_(metadataOutput), callback_(*callback) {} + ~InnerMetadataOutputCallback() = default; + + void OnError(const int32_t errorCode) const override + { + MEDIA_DEBUG_LOG("OnError is called!, errorCode: %{public}d", errorCode); + if (metadataOutput_ != nullptr && callback_.onError != nullptr) { + callback_.onError(metadataOutput_, FrameworkToNdkCameraError(errorCode)); + } + } + +private: + Camera_MetadataOutput* metadataOutput_; + MetadataOutput_Callbacks callback_; +}; + +// need fix +class InnerMetadataObjectCallback : public MetadataObjectCallback { +public: + InnerMetadataObjectCallback(Camera_MetadataOutput* metadataOutput, MetadataOutput_Callbacks* callback) + : metadataOutput_(metadataOutput), callback_(*callback) {} + ~InnerMetadataObjectCallback() = default; + + void OnMetadataObjectsAvailable(std::vector> metaObjects) const override + { + if (metaObjects.empty()) { + MEDIA_ERR_LOG("OnMetadataObjectsAvailable: metaObjects is empty"); + } + uint32_t size = metaObjects.size(); + if (size <= 0) { + MEDIA_ERR_LOG("metaObjects size <= 0"); + } + Camera_MetadataObject* object = new Camera_MetadataObject[size]; + Camera_Rect boundingBox; + if (metadataOutput_ != nullptr && callback_.onMetadataObjectAvailable != nullptr) { + for (size_t i = 0; i < metaObjects.size(); i++) { + if (MetadataObjectType::FACE == metaObjects[i]->GetType()) { + object[i].type = Camera_MetadataObjectType::FACE_DETECTION; + } + object[i].timestamp = metaObjects[i]->GetTimestamp(); + boundingBox.topLeftX = metaObjects[i]->GetBoundingBox().topLeftX; + boundingBox.topLeftY = metaObjects[i]->GetBoundingBox().topLeftY; + boundingBox.width = metaObjects[i]->GetBoundingBox().width; + boundingBox.height = metaObjects[i]->GetBoundingBox().height; + object[i].boundingBox = &boundingBox; + } + callback_.onMetadataObjectAvailable(metadataOutput_, object, size); + } + } + +private: + Camera_MetadataOutput* metadataOutput_; + MetadataOutput_Callbacks callback_; +}; + +Camera_MetadataOutput::Camera_MetadataOutput(sptr &innerMetadataOutput) + : innerMetadataOutput_(innerMetadataOutput) +{ + MEDIA_DEBUG_LOG("Camera_MetadataOutput Constructor is called"); +} + +Camera_MetadataOutput::~Camera_MetadataOutput() +{ + MEDIA_DEBUG_LOG("~Camera_MetadataOutput is called"); + if (innerMetadataOutput_) { + innerMetadataOutput_ = nullptr; + } +} + +Camera_ErrorCode Camera_MetadataOutput::RegisterCallback(MetadataOutput_Callbacks* callback) +{ + shared_ptr innerMetadataOutputCallback = + make_shared(this, callback); + innerMetadataOutput_->SetCallback(innerMetadataOutputCallback); + + shared_ptr innerMetadataObjectCallback = + make_shared(this, callback); + innerMetadataOutput_->SetCallback(innerMetadataObjectCallback); + + return CAMERA_OK; +} + +Camera_ErrorCode Camera_MetadataOutput::UnregisterCallback(MetadataOutput_Callbacks* callback) +{ + shared_ptr innerMetadataOutputCallback = nullptr; + innerMetadataOutput_->SetCallback(innerMetadataOutputCallback); + shared_ptr innerMetadataObjectCallback = nullptr; + innerMetadataOutput_->SetCallback(innerMetadataObjectCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_MetadataOutput::Start() +{ + int32_t ret = innerMetadataOutput_->Start(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_MetadataOutput::Stop() +{ + int32_t ret = innerMetadataOutput_->Stop(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_MetadataOutput::Release() +{ + int32_t ret = innerMetadataOutput_->Release(); + return FrameworkToNdkCameraError(ret); +} + +sptr Camera_MetadataOutput::GetInnerMetadataOutput() +{ + return innerMetadataOutput_; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/metadata_output_impl.h b/frameworks/native/ndk/impl/metadata_output_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..de67352cab59d9bd3c1b06c92bf577180ae63a1d --- /dev/null +++ b/frameworks/native/ndk/impl/metadata_output_impl.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_METADATA_OUTPUT_IMPL_H +#define OHOS_METADATA_OUTPUT_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/metadata_output.h" +#include "output/metadata_output.h" + +struct Camera_MetadataOutput { +public: + explicit Camera_MetadataOutput(OHOS::sptr &innerMetadataOutput); + ~Camera_MetadataOutput(); + + Camera_ErrorCode RegisterCallback(MetadataOutput_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(MetadataOutput_Callbacks* callback); + + Camera_ErrorCode Start(); + + Camera_ErrorCode Stop(); + + Camera_ErrorCode Release(); + + OHOS::sptr GetInnerMetadataOutput(); + +private: + OHOS::sptr innerMetadataOutput_; +}; +#endif // OHOS_METADATA_OUTPUT_IMPL_H diff --git a/frameworks/native/ndk/impl/photo_output_impl.cpp b/frameworks/native/ndk/impl/photo_output_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ca198903f54b23613de29f561ae6446ee4a95cc6 --- /dev/null +++ b/frameworks/native/ndk/impl/photo_output_impl.cpp @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "photo_output_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerPhotoOutputCallback : public PhotoStateCallback { +public: + InnerPhotoOutputCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback) + : photoOutput_(photoOutput), callback_(*callback) {} + ~InnerPhotoOutputCallback() = default; + +// need fix + void OnCaptureStarted(const int32_t captureID) const override + { + MEDIA_DEBUG_LOG("OnCaptureStarted is called!, captureID: %{public}d", captureID); + if (photoOutput_ != nullptr && callback_.onFrameStart != nullptr) { + callback_.onFrameStart(photoOutput_); + } + } + +// need fix + void OnFrameShutter(const int32_t captureId, const uint64_t timestamp) const override + { + MEDIA_DEBUG_LOG("onFrameShutter is called!, captureId: %{public}d", captureId); + Camera_FrameShutterInfo info; + info.captureId = captureId; + info.timestamp = timestamp; + if (photoOutput_ != nullptr && callback_.onFrameShutter != nullptr) { + callback_.onFrameShutter(photoOutput_, &info); + } + } + +// need fix + void OnCaptureEnded(const int32_t captureID, const int32_t frameCount) const override + { + MEDIA_DEBUG_LOG("OnCaptureEnded is called! captureID: %{public}d", captureID); + MEDIA_DEBUG_LOG("OnCaptureEnded is called! framecount: %{public}d", frameCount); + if (photoOutput_ != nullptr && callback_.onFrameEnd != nullptr) { + callback_.onFrameEnd(photoOutput_, frameCount); + } + } + + void OnCaptureError(const int32_t captureId, const int32_t errorCode) const override + { + MEDIA_DEBUG_LOG("OnCaptureError is called!, errorCode: %{public}d", errorCode); + if (photoOutput_ != nullptr && callback_.onError != nullptr) { + callback_.onError(photoOutput_, FrameworkToNdkCameraError(errorCode)); + } + } + +private: + Camera_PhotoOutput* photoOutput_; + PhotoOutput_Callbacks callback_; +}; + +Camera_PhotoOutput::Camera_PhotoOutput(sptr &innerPhotoOutput) : innerPhotoOutput_(innerPhotoOutput) +{ + MEDIA_DEBUG_LOG("Camera_PhotoOutput Constructor is called"); +} + +Camera_PhotoOutput::~Camera_PhotoOutput() +{ + MEDIA_DEBUG_LOG("~Camera_PhotoOutput is called"); + if (innerPhotoOutput_) { + innerPhotoOutput_ = nullptr; + } +} + +Camera_ErrorCode Camera_PhotoOutput::RegisterCallback(PhotoOutput_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + innerPhotoOutput_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_PhotoOutput::UnregisterCallback(PhotoOutput_Callbacks* callback) +{ + // call to member function 'SetCallback' is ambiguous + shared_ptr innerCallback = nullptr; + innerPhotoOutput_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_PhotoOutput::Capture() +{ + int32_t ret = innerPhotoOutput_->Capture(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_PhotoOutput::Capture_WithCaptureSetting(Camera_PhotoCaptureSetting setting) +{ + std::shared_ptr capSettings = make_shared(); + + capSettings->SetQuality(static_cast(setting.quality)); + + capSettings->SetRotation(static_cast(setting.rotation)); + + if (setting.location != nullptr) { + std::unique_ptr location = std::make_unique(); + location->latitude = setting.location->latitude; + location->longitude = setting.location->longitude; + location->altitude = setting.location->altitude; + capSettings->SetLocation(location); + } + + capSettings->SetMirror(setting.mirror); + + int32_t ret = innerPhotoOutput_->Capture(capSettings); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_PhotoOutput::Release() +{ + int32_t ret = innerPhotoOutput_->Release(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_PhotoOutput::IsMirrorSupported(bool* isSupported) +{ + *isSupported = innerPhotoOutput_->IsMirrorSupported(); + + return CAMERA_OK; +} + + +sptr Camera_PhotoOutput::GetInnerPhotoOutput() +{ + return innerPhotoOutput_; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/photo_output_impl.h b/frameworks/native/ndk/impl/photo_output_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..82d45d3c12da49566d4df2d6fd49108be42412aa --- /dev/null +++ b/frameworks/native/ndk/impl/photo_output_impl.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_PHOTO_OUTPUT_IMPL_H +#define OHOS_PHOTO_OUTPUT_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/photo_output.h" +#include "output/photo_output.h" + +struct Camera_PhotoOutput { +public: + explicit Camera_PhotoOutput(OHOS::sptr &innerPhotoOutput); + ~Camera_PhotoOutput(); + + Camera_ErrorCode RegisterCallback(PhotoOutput_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(PhotoOutput_Callbacks* callback); + + Camera_ErrorCode Capture(); + + Camera_ErrorCode Capture_WithCaptureSetting(Camera_PhotoCaptureSetting setting); + + Camera_ErrorCode Release(); + + Camera_ErrorCode IsMirrorSupported(bool* isSupported); + + OHOS::sptr GetInnerPhotoOutput(); + +private: + OHOS::sptr innerPhotoOutput_; +}; +#endif // OHOS_PHOTO_OUTPUT_IMPL_H \ No newline at end of file diff --git a/frameworks/native/ndk/impl/preview_output_impl.cpp b/frameworks/native/ndk/impl/preview_output_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3438330da6823ca885852572bbe673267aa58efe --- /dev/null +++ b/frameworks/native/ndk/impl/preview_output_impl.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "preview_output_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerPreviewOutputCallback : public PreviewStateCallback { +public: + InnerPreviewOutputCallback(Camera_PreviewOutput* previewOutput, PreviewOutput_Callbacks* callback) + : previewOutput_(previewOutput), callback_(*callback) {} + ~InnerPreviewOutputCallback() = default; + + void OnFrameStarted() const override + { + MEDIA_DEBUG_LOG("OnFrameStarted is called!"); + if (previewOutput_ != nullptr && callback_.onFrameStart != nullptr) { + callback_.onFrameStart(previewOutput_); + } + } + + void OnFrameEnded(const int32_t frameCount) const override + { + MEDIA_DEBUG_LOG("OnFrameEnded is called! frame count: %{public}d", frameCount); + if (previewOutput_ != nullptr && callback_.onFrameEnd != nullptr) { + callback_.onFrameEnd(previewOutput_, frameCount); + } + } + + void OnError(const int32_t errorCode) const override + { + MEDIA_DEBUG_LOG("OnError is called!, errorCode: %{public}d", errorCode); + if (previewOutput_ != nullptr && callback_.onError != nullptr) { + callback_.onError(previewOutput_, FrameworkToNdkCameraError(errorCode)); + } + } + + void OnSketchAvailable(SketchData& SketchData) const override {} + +private: + Camera_PreviewOutput* previewOutput_; + PreviewOutput_Callbacks callback_; +}; + +Camera_PreviewOutput::Camera_PreviewOutput(sptr &innerPreviewOutput) + : innerPreviewOutput_(innerPreviewOutput) +{ + MEDIA_DEBUG_LOG("Camera_PreviewOutput Constructor is called"); +} + +Camera_PreviewOutput::~Camera_PreviewOutput() +{ + MEDIA_DEBUG_LOG("~Camera_PreviewOutput is called"); + if (innerPreviewOutput_) { + innerPreviewOutput_ = nullptr; + } +} + +Camera_ErrorCode Camera_PreviewOutput::RegisterCallback(PreviewOutput_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + innerPreviewOutput_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_PreviewOutput::UnregisterCallback(PreviewOutput_Callbacks* callback) +{ + innerPreviewOutput_->SetCallback(nullptr); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_PreviewOutput::Start() +{ + int32_t ret = innerPreviewOutput_->Start(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_PreviewOutput::Stop() +{ + int32_t ret = innerPreviewOutput_->Stop(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_PreviewOutput::Release() +{ + int32_t ret = innerPreviewOutput_->Release(); + return FrameworkToNdkCameraError(ret); +} + +sptr Camera_PreviewOutput::GetInnerPreviewOutput() +{ + return innerPreviewOutput_; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/preview_output_impl.h b/frameworks/native/ndk/impl/preview_output_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..146f1333d28b09838d5ca86f75e1ea214b35ccdc --- /dev/null +++ b/frameworks/native/ndk/impl/preview_output_impl.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_PREVIEW_OUTPUT_IMPL_H +#define OHOS_PREVIEW_OUTPUT_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/preview_output.h" +#include "output/preview_output.h" + +struct Camera_PreviewOutput { +public: + explicit Camera_PreviewOutput(OHOS::sptr &innerPreviewOutput); + ~Camera_PreviewOutput(); + + Camera_ErrorCode RegisterCallback(PreviewOutput_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(PreviewOutput_Callbacks* callback); + + Camera_ErrorCode Start(); + + Camera_ErrorCode Stop(); + + Camera_ErrorCode Release(); + + OHOS::sptr GetInnerPreviewOutput(); + +private: + OHOS::sptr innerPreviewOutput_; +}; +#endif // OHOS_PREVIEW_OUTPUT_IMPL_H diff --git a/frameworks/native/ndk/impl/video_output_impl.cpp b/frameworks/native/ndk/impl/video_output_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc61ef2ea6a821ca4bfec1e32b7cdcd967a58543 --- /dev/null +++ b/frameworks/native/ndk/impl/video_output_impl.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "video_output_impl.h" +#include "camera_log.h" +#include "camera_util.h" + +using namespace std; +using namespace OHOS; +using namespace OHOS::CameraStandard; + +class InnerVideoOutputCallback : public VideoStateCallback { +public: + InnerVideoOutputCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) + : videoOutput_(videoOutput), callback_(*callback) {} + ~InnerVideoOutputCallback() = default; + + void OnFrameStarted() const override + { + MEDIA_DEBUG_LOG("OnFrameStarted is called!"); + if (videoOutput_ != nullptr && callback_.onFrameStart != nullptr) { + callback_.onFrameStart(videoOutput_); + } + } + + void OnFrameEnded(const int32_t frameCount) const override + { + MEDIA_DEBUG_LOG("OnFrameEnded is called! frame count: %{public}d", frameCount); + if (videoOutput_ != nullptr && callback_.onFrameEnd != nullptr) { + callback_.onFrameEnd(videoOutput_, frameCount); + } + } + + void OnError(const int32_t errorCode) const override + { + MEDIA_DEBUG_LOG("OnError is called!, errorCode: %{public}d", errorCode); + if (videoOutput_ != nullptr && callback_.onError != nullptr) { + callback_.onError(videoOutput_, FrameworkToNdkCameraError(errorCode)); + } + } + +private: + Camera_VideoOutput* videoOutput_; + VideoOutput_Callbacks callback_; +}; + +Camera_VideoOutput::Camera_VideoOutput(sptr &innerVideoOutput) : innerVideoOutput_(innerVideoOutput) +{ + MEDIA_DEBUG_LOG("Camera_VideoOutput Constructor is called"); +} + +Camera_VideoOutput::~Camera_VideoOutput() +{ + MEDIA_DEBUG_LOG("~Camera_VideoOutput is called"); + if (innerVideoOutput_) { + innerVideoOutput_ = nullptr; + } +} + +Camera_ErrorCode Camera_VideoOutput::RegisterCallback(VideoOutput_Callbacks* callback) +{ + shared_ptr innerCallback = + make_shared(this, callback); + innerVideoOutput_->SetCallback(innerCallback); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_VideoOutput::UnregisterCallback(VideoOutput_Callbacks* callback) +{ + innerVideoOutput_->SetCallback(nullptr); + return CAMERA_OK; +} + +Camera_ErrorCode Camera_VideoOutput::Start() +{ + int32_t ret = innerVideoOutput_->Start(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_VideoOutput::Stop() +{ + int32_t ret = innerVideoOutput_->Stop(); + return FrameworkToNdkCameraError(ret); +} + +Camera_ErrorCode Camera_VideoOutput::Release() +{ + int32_t ret = innerVideoOutput_->Release(); + return FrameworkToNdkCameraError(ret); +} + +sptr Camera_VideoOutput::GetInnerVideoOutput() +{ + return innerVideoOutput_; +} \ No newline at end of file diff --git a/frameworks/native/ndk/impl/video_output_impl.h b/frameworks/native/ndk/impl/video_output_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..743710bd60f595990ca0c1a69331a9ab8db16e1f --- /dev/null +++ b/frameworks/native/ndk/impl/video_output_impl.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023-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. + */ + +#ifndef OHOS_VIDEO_OUTPUT_IMPL_H +#define OHOS_VIDEO_OUTPUT_IMPL_H + +#include "kits/native/include/camera/camera.h" +#include "kits/native/include/camera/video_output.h" +#include "output/video_output.h" + +struct Camera_VideoOutput { +public: + explicit Camera_VideoOutput(OHOS::sptr &innerVideoOutput); + ~Camera_VideoOutput(); + + Camera_ErrorCode RegisterCallback(VideoOutput_Callbacks* callback); + + Camera_ErrorCode UnregisterCallback(VideoOutput_Callbacks* callback); + + Camera_ErrorCode Start(); + + Camera_ErrorCode Stop(); + + Camera_ErrorCode Release(); + + OHOS::sptr GetInnerVideoOutput(); + +private: + OHOS::sptr innerVideoOutput_; +}; +#endif // OHOS_VIDEO_OUTPUT_IMPL_H diff --git a/frameworks/native/ndk/metadata_output.cpp b/frameworks/native/ndk/metadata_output.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c90f080f3ab165811aa7b9d12e9c067f1605680 --- /dev/null +++ b/frameworks/native/ndk/metadata_output.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/metadata_output.h" +#include "impl/metadata_output_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_RegisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onMetadataObjectAvailable!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onMetadataObjectAvailable is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + metadataOutput->RegisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_UnregisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onMetadataObjectAvailable!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onMetadataObjectAvailable is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + metadataOutput->UnregisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput) +{ + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return metadataOutput->Start(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_Stop(Camera_MetadataOutput* metadataOutput) +{ + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return metadataOutput->Stop(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_Release(Camera_MetadataOutput* metadataOutput) +{ + CHECK_AND_RETURN_RET_LOG(metadataOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! metadataOutput is null!"); + + return metadataOutput->Release(); +} +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/photo_output.cpp b/frameworks/native/ndk/photo_output.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9382ee08b15e6d9aa7668f71c6469b434bbb73c0 --- /dev/null +++ b/frameworks/native/ndk/photo_output.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/photo_output.h" +#include "impl/photo_output_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameShutter!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameShutter is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + photoOutput->RegisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + photoOutput->UnregisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return photoOutput->Capture(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput, + Camera_PhotoCaptureSetting setting) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return photoOutput->Capture_WithCaptureSetting(setting); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + + return photoOutput->Release(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported) +{ + CHECK_AND_RETURN_RET_LOG(photoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! photoOutput is null!"); + CHECK_AND_RETURN_RET_LOG(isSupported != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! isSupported is null!"); + + return photoOutput->IsMirrorSupported(isSupported); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/preview_output.cpp b/frameworks/native/ndk/preview_output.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad1462294857423e8b8d7158c6ce25cbebbfab77 --- /dev/null +++ b/frameworks/native/ndk/preview_output.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/preview_output.h" +#include "impl/preview_output_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_RegisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + previewOutput->RegisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_UnregisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + previewOutput->UnregisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_Start(Camera_PreviewOutput* previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return previewOutput->Start(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_Stop(Camera_PreviewOutput* previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return previewOutput->Stop(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_Release(Camera_PreviewOutput* previewOutput) +{ + CHECK_AND_RETURN_RET_LOG(previewOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! previewOutput is null!"); + + return previewOutput->Release(); +} +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/frameworks/native/ndk/video_output.cpp b/frameworks/native/ndk/video_output.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5329afbf436cd27e03f5424bb5be3896787bd75a --- /dev/null +++ b/frameworks/native/ndk/video_output.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2023-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. + */ + +#include "kits/native/include/camera/video_output.h" +#include "impl/video_output_impl.h" +#include "camera_log.h" +#include "hilog/log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + videoOutput->RegisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback) +{ + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + CHECK_AND_RETURN_RET_LOG(callback != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameStart!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameStart is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onFrameEnd!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onFrameEnd is null!"); + CHECK_AND_RETURN_RET_LOG(callback->onError!= nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! callback onError is null!"); + + videoOutput->UnregisterCallback(callback); + return CAMERA_OK; +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return videoOutput->Start(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return videoOutput->Stop(); +} + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput) +{ + CHECK_AND_RETURN_RET_LOG(videoOutput != nullptr, CAMERA_INVALID_ARGUMENT, + "invaild argument! videoOutput is null!"); + + return videoOutput->Release(); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/interfaces/kits/native/include/camera/BUILD.gn b/interfaces/kits/native/include/camera/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bf40d2914558f6f1b02d4b8a43c5cfa09ec08272 --- /dev/null +++ b/interfaces/kits/native/include/camera/BUILD.gn @@ -0,0 +1,47 @@ +# 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") +import("./../../../../../multimedia_camera_framework.gni") + +ohos_ndk_headers("camera_ndk_header") { + dest_dir = "$ndk_headers_out_dir/camera_ndk" + 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("libcamera_ndk") { + output_name = "camera_ndk" + output_extension = "so" + ndk_description_file = "./camera.ndk.json" + system_capability = "SystemCapability.Multimedia.Camera.Core" + system_capability_headers = [ + "multimedia/camera_framework/camera.h", + "multimedia/camera_framework/camera_manager.h", + "multimedia/camera_framework/camera_input.h", + "multimedia/camera_framework/capture_session.h", + "multimedia/camera_framework/metadata_output.h", + "multimedia/camera_framework/photo_output.h", + "multimedia/camera_framework/preview_output.h", + "multimedia/camera_framework/video_output.h", + ] +} diff --git a/interfaces/kits/native/include/camera/camera.h b/interfaces/kits/native/include/camera/camera.h new file mode 100644 index 0000000000000000000000000000000000000000..b8d8724e230961f952391c81a418f6e54e8a3769 --- /dev/null +++ b/interfaces/kits/native/include/camera/camera.h @@ -0,0 +1,518 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Manager Camera_Manager; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_ErrorCode { + /** + * Camera operation success. + */ + CAMERA_OK = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_INVALID_ARGUMENT = 7400101, + + /** + * Camera operation was not allowed. + */ + CAMERA_OPERATION_NOT_ALLOWED = 7400102, + /** + * Camera session not config. + */ + CAMERA_SESSION_NOT_CONFIG = 7400103, + + /** + * Camera session not running. + */ + CAMERA_SESSION_NOT_RUNNING = 7400104, + + /** + * Camera session config locked. + */ + CAMERA_SESSION_CONFIG_LOCKED = 7400105, + + /** + * Camera device setting locked. + */ + CAMERA_DEVICE_SETTING_LOCKED = 7400106, + + /** + * Camera can not use cause of conflict. + */ + CAMERA_CONFLICT_CAMERA = 7400107, + + /** + * Camera disabled cause of security reason. + */ + CAMERA_DEVICE_DISABLED = 7400108, + + /** + * Camera can not use cause of preempted. + */ + CAMERA_DEVICE_PREEMPTED = 7400109, + + /** + * Camera service fatal error. + */ + CAMERA_SERVICE_FATAL_ERROR = 7400201 +} Camera_ErrorCode; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_Status { + /** + * Camera operation success. + */ + CAMERA_STATUS_APPEAR = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_STATUS_DISAPPEAR = 1, + + /** + * Camera operation was not allowed. + */ + CAMERA_STATUS_AVAILABLE = 2, + + /** + * Camera operation was not allowed. + */ + CAMERA_STATUS_UNAVAILABLE = 3 +} Camera_Status; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_Position { + /** + * Camera operation success. + */ + CAMERA_POSITION_UNSPECIFIED = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_POSITION_BACK = 1, + + /** + * Camera operation was not allowed. + */ + CAMERA_POSITION_FRONT = 2 +} Camera_Position; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_Type { + /** + * Camera operation success. + */ + CAMERA_TYPE_DEFAULT = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_TYPE_WIDE_ANGLE = 1, + + /** + * Camera operation was not allowed. + */ + CAMERA_TYPE_ULTRA_WIDE = 2, + + /** + * Camera operation was not allowed. + */ + CAMERA_TYPE_TELEPHOTO = 3, + + /** + * Camera operation was not allowed. + */ + CAMERA_TYPE_TRUE_DEPTH = 4 +} Camera_Type; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_Connection { + /** + * Camera operation success. + */ + CAMERA_CONNECTION_BUILT_IN = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_CONNECTION_USB_PLUGIN = 1, + + /** + * Camera operation was not allowed. + */ + CAMERA_CONNECTION_REMOTE = 2 +} Camera_Connection; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_Format { + /** + * Camera operation success. + */ + CAMERA_FORMAT_RGBA_8888 = 3, + + /** + * Parameter missing or parameter type incorrect. + */ + CAMERA_FORMAT_YUV_420_SP = 1003, + + /** + * Camera operation was not allowed. + */ + CAMERA_FORMAT_JPEG = 2000 +} Camera_Format; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_FlashMode { + /** + * Camera operation success. + */ + FLASH_MODE_CLOSE = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + FLASH_MODE_OPEN = 1, + + /** + * Camera operation was not allowed. + */ + FLASH_MODE_AUTO = 2, + + /** + * Camera operation was not allowed. + */ + FLASH_MODE_ALWAYS_OPEN = 3 +} Camera_FlashMode; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_ExposureMode { + /** + * Camera operation success. + */ + EXPOSURE_MODE_LOCKED = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + EXPOSURE_MODE_AUTO = 1, + + /** + * Camera operation was not allowed. + */ + EXPOSURE_MODE_CONTINUOUS_AUTO = 2 +} Camera_ExposureMode; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_FocusMode { + /** + * Camera operation success. + */ + FOCUS_MODE_MANUAL = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + FOCUS_MODE_CONTINUOUS_AUTO = 1, + + /** + * Camera operation was not allowed. + */ + FOCUS_MODE_AUTO = 2, + + /** + * Camera operation was not allowed. + */ + FOCUS_MODE_LOCKED = 3 +} Camera_FocusMode; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_FocusState { + /** + * Camera operation success. + */ + FOCUS_STATE_SCAN = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + FOCUS_STATE_FOCUSED = 1, + + /** + * Camera operation was not allowed. + */ + FOCUS_STATE_UNFOCUSED = 2 +} Camera_FocusState; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_VideoStabilizationMode { + /** + * Camera operation success. + */ + STABILIZATION_MODE_OFF = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + STABILIZATION_MODE_LOW = 1, + + /** + * Camera operation was not allowed. + */ + STABILIZATION_MODE_MIDDLE = 2, + + /** + * Camera operation was not allowed. + */ + STABILIZATION_MODE_HIGH = 3, + + /** + * Camera operation was not allowed. + */ + STABILIZATION_MODE_AUTO = 4 +} Camera_VideoStabilizationMode; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_ImageRotation { + /** + * Camera operation success. + */ + IAMGE_ROTATION_0 = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + IAMGE_ROTATION_90 = 90, + + /** + * Camera operation was not allowed. + */ + IAMGE_ROTATION_180 = 180, + + /** + * Camera operation was not allowed. + */ + IAMGE_ROTATION_270 = 270 +} Camera_ImageRotation; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_QualityLevel { + /** + * Camera operation success. + */ + QUALITY_LEVEL_HIGH = 0, + + /** + * Parameter missing or parameter type incorrect. + */ + QUALITY_LEVEL_MEDIUM = 1, + + /** + * Camera operation was not allowed. + */ + QUALITY_LEVEL_LOW = 2 +} Camera_QualityLevel; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef enum Camera_MetadataObjectType { + /** + * Camera operation success. + */ + FACE_DETECTION = 0 +} Camera_MetadataObjectType; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Size { + uint32_t width; + uint32_t height; +} Camera_Size; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Profile { + Camera_Format format; + Camera_Size size; +} Camera_Profile; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_FrameRateRange { + uint32_t min; + uint32_t max; +} Camera_FrameRateRange; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_VideoProfile { + Camera_Format format; + Camera_Size size; + Camera_FrameRateRange range; +} Camera_VideoProfile; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_OutputCapability { + Camera_Profile** previewProfiles; + uint32_t previewProfilesSize; + Camera_Profile** photoProfiles; + uint32_t photoProfilesSize; + Camera_VideoProfile** videoProfiles; + uint32_t videoProfilesSize; + Camera_MetadataObjectType** supportedMetadataObjectTypes; + uint32_t metadataProfilesSize; +} Camera_OutputCapability; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Device { + char* cameraId; + Camera_Position cameraPosition; + Camera_Type cameraType; + Camera_Connection connectionType; +} Camera_Device; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_StatusInfo { + Camera_Device* camera; + Camera_Status status; +} Camera_StatusInfo; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Point { + int32_t x; + int32_t y; +} Camera_Point; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Location { + int32_t latitude; + int32_t longitude; + int32_t altitude; +} Camera_Location; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_PhotoCaptureSetting { + Camera_QualityLevel quality; + Camera_ImageRotation rotation; + Camera_Location* location; + bool mirror; +} Camera_PhotoCaptureSetting; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_FrameShutterInfo { + int32_t captureId; + int64_t timestamp; +} Camera_FrameShutterInfo; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_CaptureEndInfo { + int32_t captureId; + int64_t frameCount; +} Camera_CaptureEndInfo; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_Rect { + int32_t topLeftX; + int32_t topLeftY; + int32_t width; + int32_t height; +} Camera_Rect; + +/** + * Enumerates the return values that may be used by the interface. + */ +typedef struct Camera_MetadataObject { + Camera_MetadataObjectType type; + int64_t timestamp; + Camera_Rect* boundingBox; +} Camera_MetadataObject; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_Camera_GetCameraMananger(Camera_Manager** cameraManager); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_CAMERA_H \ No newline at end of file diff --git a/interfaces/kits/native/include/camera/camera.ndk.json b/interfaces/kits/native/include/camera/camera.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..e93adc79d5229cd7a469db2084197e82777fc11e --- /dev/null +++ b/interfaces/kits/native/include/camera/camera.ndk.json @@ -0,0 +1,82 @@ +[ + { "name": "OH_CameraInput_RegisterCallback" }, + { "name": "OH_CameraInput_UnregisterCallback" }, + { "name": "OH_CameraInput_Open" }, + { "name": "OH_CameraInput_Close" }, + { "name": "OH_CameraInput_Release" }, + { "name": "OH_CameraManager_RegisterCallback" }, + { "name": "OH_CameraManager_UnregisterCallback" }, + { "name": "OH_CameraManager_GetSupportedCameras" }, + { "name": "OH_CameraManager_GetSupportedCameraOutputCapability" }, + { "name": "OH_CameraManager_IsCameraMuted" }, + { "name": "OH_CameraManager_CreateCaptureSession" }, + { "name": "OH_CameraManager_CreateCameraInput" }, + { "name": "OH_CameraManager_CreateCameraInput_WithPositionAndType" }, + { "name": "OH_CameraManager_CreatePreviewOutput" }, + { "name": "OH_CameraManager_CreatePhotoOutput" }, + { "name": "OH_CameraManager_CreateVideoOutput" }, + { "name": "OH_CameraManager_CreateMetadataOutput" }, + { "name": "OH_Camera_GetCameraMananger" }, + { "name": "OH_CaptureSession_RegisterCallback" }, + { "name": "OH_CaptureSession_UnregisterCallback" }, + { "name": "OH_CaptureSession_BeginConfig" }, + { "name": "OH_CaptureSession_CommitConfig" }, + { "name": "OH_CaptureSession_AddInput" }, + { "name": "OH_CaptureSession_RemoveInput" }, + { "name": "OH_CaptureSession_AddPreviewOutput" }, + { "name": "OH_CaptureSession_RemovePreviewOutput" }, + { "name": "OH_CaptureSession_AddPhotoOutput" }, + { "name": "OH_CaptureSession_RemovePhotoOutput" }, + { "name": "OH_CaptureSession_AddVideoOutput" }, + { "name": "OH_CaptureSession_RemoveVideoOutput" }, + { "name": "OH_CaptureSession_AddMetadataOutput" }, + { "name": "OH_CaptureSession_RemoveMetadataOutput" }, + { "name": "OH_CaptureSession_Start" }, + { "name": "OH_CaptureSession_Stop" }, + { "name": "OH_CaptureSession_Release" }, + { "name": "OH_CaptureSession_HasFlash" }, + { "name": "OH_CaptureSession_IsFlashModeSupported" }, + { "name": "OH_CaptureSession_GetFlashMode" }, + { "name": "OH_CaptureSession_SetFlashMode" }, + { "name": "OH_CaptureSession_IsExposureModeSupported" }, + { "name": "OH_CaptureSession_GetExposureMode" }, + { "name": "OH_CaptureSession_SetExposureMode" }, + { "name": "OH_CaptureSession_GetMeteringPoint" }, + { "name": "OH_CaptureSession_SetMeteringPoint" }, + { "name": "OH_CaptureSession_GetExposureBiasRange" }, + { "name": "OH_CaptureSession_SetExposureBias" }, + { "name": "OH_CaptureSession_GetExposureBias" }, + { "name": "OH_CaptureSession_IsFocusModeSupported" }, + { "name": "OH_CaptureSession_GetFocusMode" }, + { "name": "OH_CaptureSession_SetFocusMode" }, + { "name": "OH_CaptureSession_GetFocusPoint" }, + { "name": "OH_CaptureSession_SetFocusPoint" }, + { "name": "OH_CaptureSession_GetZoomRatioRange" }, + { "name": "OH_CaptureSession_GetZoomRatio" }, + { "name": "OH_CaptureSession_SetZoomRatio" }, + { "name": "OH_CaptureSession_IsVideoStabilizationModeSupported" }, + { "name": "OH_CaptureSession_GetVideoStabilizationMode" }, + { "name": "OH_CaptureSession_SetVideoStabilizationMode" }, + { "name": "OH_MetadataOutput_RegisterCallback" }, + { "name": "OH_MetadataOutput_UnregisterCallback" }, + { "name": "OH_MetadataOutput_Start" }, + { "name": "OH_MetadataOutput_Stop" }, + { "name": "OH_MetadataOutput_Release" }, + { "name": "OH_PhotoOutput_RegisterCallback" }, + { "name": "OH_PhotoOutput_UnregisterCallback" }, + { "name": "OH_PhotoOutput_Capture" }, + { "name": "OH_PhotoOutput_Capture_WITH_SETTING" }, + { "name": "OH_PhotoOutput_Release" }, + { "name": "OH_PhotoOutput_IsMirrorSupported" }, + { "name": "OH_PreviewOutput_RegisterCallback" }, + { "name": "OH_PreviewOutput_UnregisterCallback" }, + { "name": "OH_PreviewOutput_Start" }, + { "name": "OH_PreviewOutput_Stop" }, + { "name": "OH_PreviewOutput_Release" }, + { "name": "OH_VideoOutput_RegisterCallback" }, + { "name": "OH_VideoOutput_UnregisterCallback" }, + { "name": "OH_VideoOutput_Start" }, + { "name": "OH_VideoOutput_Stop" }, + { "name": "OH_VideoOutput_Release" } + +] diff --git a/interfaces/kits/native/include/camera/camera_input.h b/interfaces/kits/native/include/camera/camera_input.h new file mode 100644 index 0000000000000000000000000000000000000000..b8a1801796e155fc5609fce89934c5d49275bf83 --- /dev/null +++ b/interfaces/kits/native/include/camera/camera_input.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H +#define NATIVE_INCLUDE_CAMERA_CAMERA_INPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_Input Camera_Input; + +typedef void (*OH_CameraInput_OnError)(const Camera_Input* cameraInput, Camera_ErrorCode errorCode); + +typedef struct CameraInput_Callbacks { + OH_CameraInput_OnError onError; +} CameraInput_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraInput_RegisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraInput_UnregisterCallback(Camera_Input* cameraInput, CameraInput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraInput_Open(Camera_Input* cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraInput_Close(Camera_Input* cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/camera_manager.h b/interfaces/kits/native/include/camera/camera_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..833a6e7765c9550464b7adf06647d74511338639 --- /dev/null +++ b/interfaces/kits/native/include/camera/camera_manager.h @@ -0,0 +1,124 @@ +/* + * 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. + */ + +#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 + +typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, Camera_StatusInfo* status); + +typedef struct CameraManager_Callbacks { + OH_CameraManager_StatusCallback onCameraStatus; +} CameraManager_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_RegisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_UnregisterCallback(Camera_Manager* cameraManager, CameraManager_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_GetSupportedCameras(Camera_Manager* cameraManager, + Camera_Device** cameras, uint32_t* size); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_GetSupportedCameraOutputCapability(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_OutputCapability** cameraOutputCapability); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_IsCameraMuted(Camera_Manager* cameraManager, bool* isCameraMuted); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreateCaptureSession(Camera_Manager* cameraManager, + Camera_CaptureSession** captureSession); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreateCameraInput(Camera_Manager* cameraManager, + const Camera_Device* camera, Camera_Input** cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreateCameraInput_WithPositionAndType(Camera_Manager* cameraManager, + Camera_Position position, Camera_Type type, Camera_Input** cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreatePreviewOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PreviewOutput** previewOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManager, const Camera_Profile* profile, + const char* surfaceId, Camera_PhotoOutput** photoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CameraManager_CreateVideoOutput(Camera_Manager* cameraManager, const Camera_VideoProfile* profile, + const char* surfaceId, Camera_VideoOutput** videoOutput); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/capture_session.h b/interfaces/kits/native/include/camera/capture_session.h new file mode 100644 index 0000000000000000000000000000000000000000..42ecba0bdb44973646e2fcc9d17fc7d437094761 --- /dev/null +++ b/interfaces/kits/native/include/camera/capture_session.h @@ -0,0 +1,309 @@ +/* + * 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. + */ + +#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 + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_CaptureSession Camera_CaptureSession; + +typedef void (*OH_CaptureSession_OnFocusStateChange)(Camera_CaptureSession* session, Camera_FocusState focusState); + +typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera_ErrorCode errorCode); + +typedef struct CaptureSession_Callbacks { + OH_CaptureSession_OnFocusStateChange onFocusStateChange; + OH_CaptureSession_OnError onError; +} CaptureSession_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RegisterCallback(Camera_CaptureSession* session, + CaptureSession_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_UnregisterCallback(Camera_CaptureSession* session, + CaptureSession_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_BeginConfig(Camera_CaptureSession* session); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_CommitConfig(Camera_CaptureSession* session); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_AddInput(Camera_CaptureSession* session, Camera_Input* cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RemoveInput(Camera_CaptureSession* session, Camera_Input* cameraInput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_AddPreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RemovePreviewOutput(Camera_CaptureSession* session, + Camera_PreviewOutput* previewOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_AddPhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RemovePhotoOutput(Camera_CaptureSession* session, Camera_PhotoOutput* photoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_AddVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RemoveVideoOutput(Camera_CaptureSession* session, Camera_VideoOutput* videoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_AddMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_RemoveMetadataOutput(Camera_CaptureSession* session, + Camera_MetadataOutput* metadataOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_Start(Camera_CaptureSession* session); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_Stop(Camera_CaptureSession* session); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_Release(Camera_CaptureSession* session); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_HasFlash(Camera_CaptureSession* session, bool* hasFlash); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_IsFlashModeSupported(Camera_CaptureSession* session, + Camera_FlashMode flashMode, bool* isSupported); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetFlashMode(Camera_CaptureSession* session, Camera_FlashMode* flashMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetFlashMode(Camera_CaptureSession* session, Camera_FlashMode flashMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_IsExposureModeSupported(Camera_CaptureSession* session, + Camera_ExposureMode exposureMode, bool* isSupported); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode* exposureMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetExposureMode(Camera_CaptureSession* session, Camera_ExposureMode exposureMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetMeteringPoint(Camera_CaptureSession* session, Camera_Point* point); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetExposureBiasRange(Camera_CaptureSession* session, float* minExposureBias, + float* maxExposureBias, float* step); + +/** + * @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); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetMeteringPoint(Camera_CaptureSession* session, Camera_Point point); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* session, + Camera_FocusMode focusMode, bool* isSupported); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetFocusMode(Camera_CaptureSession* session, Camera_FocusMode* focusMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetFocusMode(Camera_CaptureSession* session, Camera_FocusMode focusMode); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetFocusPoint(Camera_CaptureSession* session, Camera_Point* focusPoint); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetFocusPoint(Camera_CaptureSession* session, Camera_Point focusPoint); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetZoomRatioRange(Camera_CaptureSession* session, float* minZoom, float* maxZoom); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetZoomRatio(Camera_CaptureSession* session, float* zoom); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_SetZoomRatio(Camera_CaptureSession* session, float zoom); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_IsVideoStabilizationModeSupported(Camera_CaptureSession* session, + Camera_VideoStabilizationMode mode, bool* isSupported); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_CaptureSession_GetVideoStabilizationMode(Camera_CaptureSession* session, + Camera_VideoStabilizationMode* mode); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/metadata_output.h b/interfaces/kits/native/include/camera/metadata_output.h new file mode 100644 index 0000000000000000000000000000000000000000..0fd67358ab8ceeac2b66940351c6894ec75c5b53 --- /dev/null +++ b/interfaces/kits/native/include/camera/metadata_output.h @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_MetadataOutput Camera_MetadataOutput; + +typedef void (*OH_MetadataOutput_OnMetadataObjectAvailable)(Camera_MetadataOutput* metadataOutput, + Camera_MetadataObject* metadataObject, uint32_t size); + +typedef void (*OH_MetadataOutput_OnError)(Camera_MetadataOutput* metadataOutput, Camera_ErrorCode errorCode); + +typedef struct MetadataOutput_Callbacks { + OH_MetadataOutput_OnMetadataObjectAvailable onMetadataObjectAvailable; + OH_MetadataOutput_OnError onError; +} MetadataOutput_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_RegisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_UnregisterCallback(Camera_MetadataOutput* metadataOutput, + MetadataOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_MetadataOutput_Stop(Camera_MetadataOutput* metadataOutput); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/photo_output.h b/interfaces/kits/native/include/camera/photo_output.h new file mode 100644 index 0000000000000000000000000000000000000000..1d3e9166108ef67c6268a7c0ded2863994f70473 --- /dev/null +++ b/interfaces/kits/native/include/camera/photo_output.h @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_PhotoOutput Camera_PhotoOutput; + +typedef void (*OH_PhotoOutput_OnFrameStart)(Camera_PhotoOutput* photoOutput); + +typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, Camera_FrameShutterInfo* info); + +typedef void (*OH_PhotoOutput_OnFrameEnd)(Camera_PhotoOutput* photoOutput, int32_t frameCount); + +typedef void (*OH_PhotoOutput_OnError)(Camera_PhotoOutput* photoOutput, Camera_ErrorCode errorCode); + +typedef struct PhotoOutput_Callbacks { + OH_PhotoOutput_OnFrameStart onFrameStart; + OH_PhotoOutput_OnFrameShutter onFrameShutter; + OH_PhotoOutput_OnFrameEnd onFrameEnd; + OH_PhotoOutput_OnError onError; +} PhotoOutput_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput, + Camera_PhotoCaptureSetting setting); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/preview_output.h b/interfaces/kits/native/include/camera/preview_output.h new file mode 100644 index 0000000000000000000000000000000000000000..70424ce55a27d3dc13dfce0ed495dad8882ad2e6 --- /dev/null +++ b/interfaces/kits/native/include/camera/preview_output.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_PreviewOutput Camera_PreviewOutput; + +typedef void (*OH_PreviewOutput_OnFrameStart)(Camera_PreviewOutput* previewOutput); + +typedef void (*OH_PreviewOutput_OnFrameEnd)(Camera_PreviewOutput* previewOutput, int32_t frameCount); + +typedef void (*OH_PreviewOutput_OnError)(Camera_PreviewOutput* previewOutput, Camera_ErrorCode errorCode); + +typedef struct PreviewOutput_Callbacks { + OH_PreviewOutput_OnFrameStart onFrameStart; + OH_PreviewOutput_OnFrameEnd onFrameEnd; + OH_PreviewOutput_OnError onError; +} PreviewOutput_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_RegisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_UnregisterCallback(Camera_PreviewOutput* previewOutput, + PreviewOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_Start(Camera_PreviewOutput* previewOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_PreviewOutput_Stop(Camera_PreviewOutput* previewOutput); + +/** + * @since 11 + * @version 1.0 + */ +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/interfaces/kits/native/include/camera/video_output.h b/interfaces/kits/native/include/camera/video_output.h new file mode 100644 index 0000000000000000000000000000000000000000..e8f59dd70e9656cbda4420f030e6fd83a19cbc40 --- /dev/null +++ b/interfaces/kits/native/include/camera/video_output.h @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#ifndef NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H +#define NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H + +#include +#include +#include "camera.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @since 11 + * @version 1.0 + */ +typedef struct Camera_VideoOutput Camera_VideoOutput; + +typedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput); + +typedef void (*OH_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount); + +typedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode); + +typedef struct VideoOutput_Callbacks { + OH_VideoOutput_OnFrameStart onFrameStart; + OH_VideoOutput_OnFrameEnd onFrameEnd; + OH_VideoOutput_OnError onError; +} VideoOutput_Callbacks; + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput); + +/** + * @since 11 + * @version 1.0 + */ +Camera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H \ No newline at end of file