diff --git a/multimedia/camera_framework/BUILD.gn b/multimedia/camera_framework/BUILD.gn index 5193d84e080d5a418fdeeb2b85ed7668ce47e195..2773cb88b913c78a75810c6816b4c20ba429c49b 100644 --- a/multimedia/camera_framework/BUILD.gn +++ b/multimedia/camera_framework/BUILD.gn @@ -23,6 +23,7 @@ ohos_ndk_headers("camera_ndk_header") { "./camera_manager.h", "./capture_session.h", "./metadata_output.h", + "./photo_native.h", "./photo_output.h", "./preview_output.h", "./video_output.h", @@ -44,5 +45,6 @@ ohos_ndk_library("libohcamera") { "ohcamera/photo_output.h", "ohcamera/preview_output.h", "ohcamera/video_output.h", + "ohcamera/photo_native.h", ] } diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index cfd6120d91df7457549db081afa628ec9c5aa76e..50cc20db4e252cf0ed4fd270291ff047ad76448e 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -91,6 +91,10 @@ "first_introduced": "12", "name": "OH_CameraManager_CreatePhotoOutputUsedInPreconfig" }, + { + "first_introduced": "12", + "name": "OH_CameraManager_CreatePhotoOutputWithoutSurface" + }, { "first_introduced": "11", "name": "OH_CameraManager_CreateVideoOutput" @@ -439,6 +443,22 @@ "first_introduced": "11", "name": "OH_PhotoOutput_Capture" }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_RegisterPhotoAvailableCallback" + }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_UnregisterPhotoAvailableCallback" + }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_RegisterPhotoAssetAvailableCallback" + }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_UnregisterPhotoAssetAvailableCallback" + }, { "first_introduced": "11", "name": "OH_PhotoOutput_Capture_WithCaptureSetting" @@ -459,6 +479,14 @@ "first_introduced": "12", "name": "OH_PhotoOutput_DeleteProfile" }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_IsMovingPhotoSupported" + }, + { + "first_introduced": "12", + "name": "OH_PhotoOutput_EnableMovingPhoto" + }, { "first_introduced": "11", "name": "OH_PreviewOutput_RegisterCallback" @@ -550,5 +578,13 @@ { "first_introduced": "12", "name": "OH_CameraDevice_GetCameraOrientation" + }, + { + "first_introduced": "12", + "name": "OH_PhotoNative_GetMainImage" + }, + { + "first_introduced": "12", + "name": "OH_PhotoNative_Release" } ] diff --git a/multimedia/camera_framework/camera_manager.h b/multimedia/camera_framework/camera_manager.h index ed72fcff9a40e2579affe14c8b35804ce7ef0531..42bcc1aaaaec9ea5616078ab178ecdc4e2117cd0 100644 --- a/multimedia/camera_framework/camera_manager.h +++ b/multimedia/camera_framework/camera_manager.h @@ -315,6 +315,20 @@ Camera_ErrorCode OH_CameraManager_CreatePhotoOutput(Camera_Manager* cameraManage Camera_ErrorCode OH_CameraManager_CreatePhotoOutputUsedInPreconfig(Camera_Manager* cameraManager, const char* surfaceId, Camera_PhotoOutput** photoOutput); +/** + * @brief Create a photo output instance without surfaceId. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param profile the {@link Camera_Profile} to create {@link Camera_PhotoOutput}. + * @param photoOutput the {@link Camera_PhotoOutput} will be created if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 12 + */ +Camera_ErrorCode OH_CameraManager_CreatePhotoOutputWithoutSurface(Camera_Manager *cameraManager, + const Camera_Profile *profile, Camera_PhotoOutput **photoOutput); + /** * @brief Create a video output instance. * diff --git a/multimedia/camera_framework/photo_native.h b/multimedia/camera_framework/photo_native.h new file mode 100644 index 0000000000000000000000000000000000000000..2168831191b813817109da2ea1ecc30285d5f267 --- /dev/null +++ b/multimedia/camera_framework/photo_native.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup OH_Camera + * @{ + * + * @brief Provide the definition of the C interface for the camera module. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * + * @since 12 + * @version 1.0 + */ + +/** + * @file photo_native.h + * + * @brief Declare the camera photo concepts. + * + * @library libohcamera.so + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + * @version 1.0 + */ + +#ifndef NATIVE_INCLUDE_PHOTO_NATIVE_H +#define NATIVE_INCLUDE_PHOTO_NATIVE_H + +#include +#include +#include "camera.h" +#include "multimedia/image_framework/image/image_native.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Camera photo object + * + * A pointer can be created using {@link OH_PhotoNative} method. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_PhotoNative OH_PhotoNative; + +/** + * @brief Get main image. + * + * @param photo the {@link OH_PhotoNative} instance. + * @param main the {@link OH_ImageNative} which use to get main image. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoNative_GetMainImage(OH_PhotoNative* photo, OH_ImageNative* mainImage); + +/** + * @brief Release camera photo. + * + * @param photo the {@link OH_PhotoNative} instance to released. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + * @version 1.0 + */ +Camera_ErrorCode OH_PhotoNative_Release(OH_PhotoNative* photo); + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_INCLUDE_PHOTO_NATIVE_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/photo_output.h b/multimedia/camera_framework/photo_output.h index 941cef603282771134842230142d36c224756d62..2ec0654fe2ada52f20fa7ddefd02e805985d3724 100644 --- a/multimedia/camera_framework/photo_output.h +++ b/multimedia/camera_framework/photo_output.h @@ -43,6 +43,8 @@ #include #include #include "camera.h" +#include "photo_native.h" +#include "multimedia/media_library/media_asset_base_capi.h" #ifdef __cplusplus extern "C" { @@ -139,6 +141,24 @@ typedef void (*OH_PhotoOutput_CaptureReady) (Camera_PhotoOutput* photoOutput); */ typedef void (*OH_PhotoOutput_EstimatedCaptureDuration) (Camera_PhotoOutput* photoOutput, int64_t duration); +/** + * @brief Photo output available high-resolution images callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @param photo the {@link OH_PhotoNative} which delivered by the callback. + * @since 12 + */ +typedef void (*OH_PhotoOutput_PhotoAvailable)(Camera_PhotoOutput* photoOutput, OH_PhotoNative* photo); + +/** + * @brief Photo output photo asset available callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback. + * @param photoAsset the {@link OH_MediaAsset} which delivered by the callback. + * @since 12 + */ +typedef void (*OH_PhotoOutput_PhotoAssetAvailable)(Camera_PhotoOutput* photoOutput, OH_MediaAsset* photoAsset); + /** * @brief A listener for photo output. * @@ -310,6 +330,54 @@ Camera_ErrorCode OH_PhotoOutput_RegisterEstimatedCaptureDurationCallback(Camera_ Camera_ErrorCode OH_PhotoOutput_UnregisterEstimatedCaptureDurationCallback(Camera_PhotoOutput* photoOutput, OH_PhotoOutput_EstimatedCaptureDuration callback); +/** + * @brief Register photo output photo available callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link OH_PhotoOutput_PhotoAvailable} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_RegisterPhotoAvailableCallback(Camera_PhotoOutput* photoOutput, + OH_PhotoOutput_PhotoAvailable callback); + +/** + * @brief Unregister photo output photo available callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link PhotoOutput_Callbacks} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_UnregisterPhotoAvailableCallback(Camera_PhotoOutput* photoOutput, + OH_PhotoOutput_PhotoAvailable callback); + +/** + * @brief Register photo output photo asset available callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link OH_PhotoOutput_PhotoAssetAvailable} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_RegisterPhotoAssetAvailableCallback(Camera_PhotoOutput* photoOutput, + OH_PhotoOutput_PhotoAssetAvailable callback); + +/** + * @brief Unregister photo output photo asset available callback. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance. + * @param callback the {@link OH_PhotoOutput_PhotoAssetAvailable} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_UnregisterPhotoAssetAvailableCallback(Camera_PhotoOutput* photoOutput, + OH_PhotoOutput_PhotoAssetAvailable callback); + /** * @brief Capture photo. * @@ -381,6 +449,30 @@ Camera_ErrorCode OH_PhotoOutput_GetActiveProfile(Camera_PhotoOutput* photoOutput */ Camera_ErrorCode OH_PhotoOutput_DeleteProfile(Camera_Profile* profile); +/** + * @brief Check whether to support moving photo. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to check whether moving photo supported. + * @param isSupported the result of whether moving photo supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_IsMovingPhotoSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); + +/** + * @brief Enable moving photo or not. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to enable moving photo or not. + * @param enabled the flag of enable moving photo or not. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 12 + */ +Camera_ErrorCode OH_PhotoOutput_EnableMovingPhoto(Camera_PhotoOutput* photoOutput, bool enabled); + #ifdef __cplusplus } #endif