From 0ad0a829288d00142bb0483c7bb9a1e19f16fdc7 Mon Sep 17 00:00:00 2001 From: caochuan Date: Sat, 27 Jul 2024 18:48:33 +0800 Subject: [PATCH] add media library ndk api Signed-off-by: caochuan Signed-off-by: caochuan@huawei.com --- .../media_library/media_access_helper_capi.h | 68 ++++ .../media_library/media_asset_base_capi.h | 209 +++++++++++- multimedia/media_library/media_asset_capi.h | 308 ++++++++++++++++++ .../media_asset_change_request_capi.h | 168 ++++++++++ .../media_asset_manager/BUILD.gn | 8 + .../lib_media_asset_namager_capi.ndk.json | 132 ++++++++ .../media_library/media_asset_manager_capi.h | 67 +++- multimedia/media_library/moving_photo_capi.h | 138 ++++++++ 8 files changed, 1088 insertions(+), 10 deletions(-) create mode 100644 multimedia/media_library/media_access_helper_capi.h create mode 100644 multimedia/media_library/media_asset_capi.h create mode 100644 multimedia/media_library/media_asset_change_request_capi.h create mode 100644 multimedia/media_library/moving_photo_capi.h diff --git a/multimedia/media_library/media_access_helper_capi.h b/multimedia/media_library/media_access_helper_capi.h new file mode 100644 index 000000000..776bc9e2c --- /dev/null +++ b/multimedia/media_library/media_access_helper_capi.h @@ -0,0 +1,68 @@ +/* + * 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 MediaAccessHelper + * @{ + * + * @brief Provides APIs of request capability for Media Source. + * + * @since 12 + */ + +/** + * @file media_access_helper_capi.h + * + * @brief Defines APIs related to media assess helper. + * + * Provides the ability to create photo albums, as well as access and modify media data information in the albums. + * + * @kit MediaLibraryKit + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @library libmedia_asset_manager.so + * @since 12 + */ + +#ifndef MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ACCESS_HELPER_H +#define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ACCESS_HELPER_H + +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Apply the change request of asset or album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance to be applied. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} Permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAccessHelper_ApplyChanges(OH_MediaAssetChangeRequest* changeRequest); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ACCESS_HELPER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_library/media_asset_base_capi.h b/multimedia/media_library/media_asset_base_capi.h index 164893324..49d733489 100644 --- a/multimedia/media_library/media_asset_base_capi.h +++ b/multimedia/media_library/media_asset_base_capi.h @@ -38,7 +38,7 @@ * MediaLibrary_RequestOptions structure: This structure provides options for requesting media library resources. \n * * @kit MediaLibraryKit - * @Syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @library libmedia_asset_manager.so * @since 12 */ @@ -48,6 +48,8 @@ #include +#include "multimedia/image_framework/image/image_source_native.h" + #ifdef __cplusplus extern "C" { #endif @@ -71,6 +73,33 @@ static const int32_t UUID_STR_MAX_LENGTH = 37; */ typedef struct OH_MediaAssetManager OH_MediaAssetManager; +/** + * @brief Define Media Asset Change Request + * + * This structure provides the ability to handle a media asset change request. + * + * @since 12 + */ +typedef struct OH_MediaAssetChangeRequest OH_MediaAssetChangeRequest; + +/** + * @brief Define Moving Photo + * + * This structure provides the ability to obtain information about moving photo. + * + * @since 12 + */ +typedef struct OH_MovingPhoto OH_MovingPhoto; + +/** + * @brief Define Media Asset + * + * This structure provides the ability to encapsulate file asset attributes. + * + * @since 12 + */ +typedef struct OH_MediaAsset OH_MediaAsset; + /** * @brief Define MediaLibrary_RequestId * @@ -85,6 +114,64 @@ typedef struct MediaLibrary_RequestId { char requestId[UUID_STR_MAX_LENGTH]; } MediaLibrary_RequestId; +/** + * @brief Enum for media library error code. + * + * @since 12 + */ +typedef enum MediaLibrary_ErrorCode { + /** + * @error Media library result is ok. + */ + MEDIA_LIBRARY_OK = 0, + + /** + * @error Permission is denied. + */ + MEDIA_LIBRARY_PERMISSION_DENIED = 201, + + /** + * @error Mandatory parameters are left unspecified + * or incorrect parameter types or parameter verification failed. + */ + MEDIA_LIBRARY_PARAMETER_ERROR = 401, + + /** + * @error File does not exist. + */ + MEDIA_LIBRARY_NO_SUCH_FILE = 23800101, + + /** + * @error Invalid display name. + */ + MEDIA_LIBRARY_INVALID_DISPLAY_NAME = 23800102, + + /** + * @error Invalid asset uri. + */ + MEDIA_LIBRARY_INVALID_ASSET_URI = 23800103, + + /** + * @error Member is not a valid PhotoKey. + */ + MEDIA_LIBRARY_INVALID_PHOTO_KEY = 23800104, + + /** + * @error Operation is not supported. + */ + MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED = 23800201, + + /** + * @error Internal system error. + * It is recommended to retry and check the logs. + * Possible causes: + * 1. Database corrupted. + * 2. The file system is abnormal. + * 3. The IPC request timed out. + */ + MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR = 23800301, +} MediaLibrary_ErrorCode; + /** * @brief Delivery Mode * @@ -102,6 +189,90 @@ typedef enum MediaLibrary_DeliveryMode { MEDIA_LIBRARY_BALANCED_MODE = 2 } MediaLibrary_DeliveryMode; +/** + * @brief Request Options + * + * This structure provides options for requesting media library resources. + * + * @since 12 + */ +typedef struct MediaLibrary_RequestOptions { + /*delivery mode*/ + MediaLibrary_DeliveryMode deliveryMode; +} MediaLibrary_RequestOptions; + +/** + * @brief Enum for media type. + * + * @since 12 + */ +typedef enum MediaLibrary_MediaType { + /*image asset*/ + MEDIA_LIBRARY_IMAGE = 1, + /*video asset*/ + MEDIA_LIBRARY_VIDEO = 2 +} MediaLibrary_MediaType; + +/** + * @brief Enum for media asset subtype. + * + * @since 12 + */ +typedef enum MediaLibrary_MediaSubType { + /*default Photo Type*/ + MEDIA_LIBRARY_DEFAULT = 0, + /*moving Photo Type*/ + MEDIA_LIBRARY_MOVING_PHOTO = 3, + /*burst Photo Type*/ + MEDIA_LIBRARY_BURST = 4 +} MediaLibrary_MediaSubType; + +/** + * @brief Enum for resource types. + * + * @since 12 + */ +typedef enum MediaLibrary_ResourceType { + /*image resource*/ + MEDIA_LIBRARY_IMAGE_RESOURCE = 1, + /*video resource*/ + MEDIA_LIBRARY_VIDEO_RESOURCE = 2 +} MediaLibrary_ResourceType; + +/** + * @brief Enum for image file Type. + * + * @since 12 + */ +typedef enum MediaLibrary_ImageFileType { + /*JPEG type*/ + MEDIA_LIBRARY_IMAGE_JPEG = 1 +} MediaLibrary_ImageFileType; + +/** + * @brief Enum for media quality. + * + * @since 12 + */ +typedef enum MediaLibrary_MediaQuality { + /*fast quality*/ + MEDIA_LIBRARY_QUALITY_FAST = 1, + /*full quality*/ + MEDIA_LIBRARY_QUALITY_FULL = 2 +} MediaLibrary_MediaQuality; + +/** + * @brief Enum for media content type. + * + * @since 12 + */ +typedef enum MediaLibrary_MediaContentType { + /*compressed media content type*/ + MEDIA_LIBRARY_COMPRESSED = 1, + /*picture object media content type*/ + MEDIA_LIBRARY_PICTURE_OBJECT = 2 +} MediaLibrary_MediaContentType; + /** * @brief Called when a requested source is prepared. * @@ -114,18 +285,40 @@ typedef enum MediaLibrary_DeliveryMode { typedef void (*OH_MediaLibrary_OnDataPrepared)(int32_t result, MediaLibrary_RequestId requestId); /** - * @brief Request Options + * @brief Called when a requested image source is prepared. * - * This structure provides options for requesting media library resources. + * This function is called when the requested image source is prepared. * + * @param result results {@link MediaLibrary_ErrorCode} of the processing of the requested resources. + * @param requestId indicates the {@link MediaLibrary_RequestId} of the request. + * @param mediaQuality the {@link MediaLibrary_MediaQuality} of the requested source. + * @param type the {@link MediaLibrary_MediaContentType} of the requested source. + * @param imageSourceNative it used to obtain {@link OH_ImageSourceNative} information when image source is prepared. * @since 12 */ -typedef struct MediaLibrary_RequestOptions { - /*delivery mode*/ - MediaLibrary_DeliveryMode deliveryMode; -} MediaLibrary_RequestOptions; +typedef void (*OH_MediaLibrary_OnImageDataPrepared)(MediaLibrary_ErrorCode result, + MediaLibrary_RequestId requestId, MediaLibrary_MediaQuality mediaQuality, MediaLibrary_MediaContentType type, + OH_ImageSourceNative* imageSourceNative); + +/** + * @brief Called when a requested moving photo is prepared. + * + * This function is called when the requested moving photo is prepared. + * + * @param result results {@link MediaLibrary_ErrorCode} of the processing of the requested resources. + * @param requestId indicates the {@link MediaLibrary_RequestId} of the request. + * @param mediaQuality the {@link MediaLibrary_MediaQuality} of the requested source. + * @param type the {@link MediaLibrary_MediaContentType} of the requested source. + * @param movingPhoto it used to obtain {@link OH_MovingPhoto} information when the data is prepared. + * @since 12 + */ +typedef void (*OH_MediaLibrary_OnMovingPhotoDataPrepared)(MediaLibrary_ErrorCode result, + MediaLibrary_RequestId requestId, MediaLibrary_MediaQuality mediaQuality, MediaLibrary_MediaContentType type, + OH_MovingPhoto* movingPhoto); #ifdef __cplusplus } #endif -#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_BASE_H \ No newline at end of file + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_BASE_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_library/media_asset_capi.h b/multimedia/media_library/media_asset_capi.h new file mode 100644 index 000000000..676458e62 --- /dev/null +++ b/multimedia/media_library/media_asset_capi.h @@ -0,0 +1,308 @@ +/* + * 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 MediaAsset + * @{ + * + * @brief Provides APIs of request capability for Media Source. + * + * @since 12 + */ + +/** + * @file media_asset_capi.h + * + * @brief Defines APIs related to media asset. + * + * Provides the ability to obtain image or video information. + * + * @kit MediaLibraryKit + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @library libmedia_asset_manager.so + * @since 12 + */ + +#ifndef MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_H +#define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_H + +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get the uri of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param uri the uri of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetUri(OH_MediaAsset* mediaAsset, const char** uri); + +/** + * @brief Get the media file type of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param mediaType the media file type of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetMediaType(OH_MediaAsset* mediaAsset, MediaLibrary_MediaType* mediaType); + +/** + * @brief Get the subtype of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param mediaSubType the subtype of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetMediaSubType(OH_MediaAsset* mediaAsset, + MediaLibrary_MediaSubType* mediaSubType); + +/** + * @brief Get the display name of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param displayName the display name of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDisplayName(OH_MediaAsset* mediaAsset, const char** displayName); + +/** + * @brief Get the file size of the media asset + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param size the file size(in bytes) of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetSize(OH_MediaAsset* mediaAsset, uint32_t* size); + +/** + * @brief Get the date of asset creation. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param dateAdded the creation date of the asset. + * The value is the number of seconds elapsed since the Epoch time (00:00:00 UTC on January 1, 1970). + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateAdded(OH_MediaAsset* mediaAsset, uint32_t* dateAdded); + +/** + * @brief Get the modified date of the asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param dateModified the modified date of the asset. + * The value is the number of seconds elapsed since the Epoch time. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateModified(OH_MediaAsset* mediaAsset, uint32_t* dateModified); + +/** + * @brief Get the date taken of the asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param dateTaken the date taken of the asset. + * The value is the number of seconds elapsed since the Epoch time. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateTaken(OH_MediaAsset* mediaAsset, uint32_t* dateTaken); + +/** + * @brief Get the creation time of the asset in milliseconds. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param dateAddedMs the creation time of the asset in milliseconds. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateAddedMs(OH_MediaAsset* mediaAsset, uint32_t* dateAddedMs); + +/** + * @brief Get the modified time of the asset in milliseconds. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param dateModifiedMs the modified time of the asset in milliseconds. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateModifiedMs(OH_MediaAsset* mediaAsset, uint32_t* dateModifiedMs); + +/** + * @brief Get the duration of the media asset in milliseconds. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param duration the duration of the media asset in milliseconds. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDuration(OH_MediaAsset* mediaAsset, uint32_t* duration); + +/** + * @brief Get the image width(in pixels) of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param width the image width(in pixels) of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetWidth(OH_MediaAsset* mediaAsset, uint32_t* width); + +/** + * @brief Get the image height(in pixels) of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param height the image height(in pixels) of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetHeight(OH_MediaAsset* mediaAsset, uint32_t* height); + +/** + * @brief Get the orientation of the image. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param orientation the orientation of the image. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetOrientation(OH_MediaAsset* mediaAsset, uint32_t* orientation); + +/** + * @brief Get the favorite state of the asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param favorite the favorite state of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_IsFavorite(OH_MediaAsset* mediaAsset, uint32_t* favorite); + +/** + * @brief Get the title of the media asset. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @param title the title of the media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetTitle(OH_MediaAsset* mediaAsset, const char** title); + +/** + * @brief Release the media asset + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_Release(OH_MediaAsset* mediaAsset); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_library/media_asset_change_request_capi.h b/multimedia/media_library/media_asset_change_request_capi.h new file mode 100644 index 000000000..decd62d3b --- /dev/null +++ b/multimedia/media_library/media_asset_change_request_capi.h @@ -0,0 +1,168 @@ +/* + * 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 MediaAssetChangeRequest + * @{ + * + * @brief Provides APIs of request capability for Media Source. + * + * @since 12 + */ + +/** + * @file media_asset_change_request_capi.h + * + * @brief Defines APIs related to media asset change request. + * + * Provides the ability to change assets. + * + * @kit MediaLibraryKit + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @library libmedia_asset_manager.so + * @since 12 + */ + +#ifndef MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_CHANGE_REQUEST_H +#define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_CHANGE_REQUEST_H + +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create a {@link OH_MediaAssetChangeRequest} instance. + * + * @param mediaAsset the {@link OH_MediaAsset} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +OH_MediaAssetChangeRequest* OH_MediaAssetChangeRequest_Create(OH_MediaAsset* mediaAsset); + +/** + * @brief Add resource of the asset using file uri. + * + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @param resourceType the {@link MediaLibrary_ResourceType} of the resource to add. + * @param fileUri the file uri. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_NO_SUCH_FILE} if file does not exist. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithUri(OH_MediaAssetChangeRequest* changeRequest, + MediaLibrary_ResourceType resourceType, char* fileUri); + +/** + * @brief Add resource of the asset using ArrayBuffer. + * + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @param resourceType the {@link MediaLibrary_ResourceType} of the resource to add. + * @param buffer the data buffer to add. + * @param length the length of the data buffer. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_AddResourceWithBuffer(OH_MediaAssetChangeRequest* changeRequest, + MediaLibrary_ResourceType resourceType, uint8_t* buffer, uint32_t length); + +/** + * @brief Get write cache handler. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @param fd the write cache handler. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_GetWriteCacheHandler(OH_MediaAssetChangeRequest* changeRequest, + int32_t* fd); + +/** + * @brief Save the photo asset captured by camera. + * + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @param imageFileType The {@link MediaLibrary_ImageFileType} of photo to be saved. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_SaveCameraPhoto(OH_MediaAssetChangeRequest* changeRequest, + MediaLibrary_ImageFileType imageFileType); + +/** + * @brief Discard the photo asset captured by camera. + * + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_DiscardCameraPhoto(OH_MediaAssetChangeRequest* changeRequest); + +/** + * @brief Release the {@link OH_MediaAssetChangeRequest} instance. + * + * @param changeRequest the {@link OH_MediaAssetChangeRequest} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_Release(OH_MediaAssetChangeRequest* changeRequest); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_CHANGE_REQUEST_H +/** @} */ diff --git a/multimedia/media_library/media_asset_manager/BUILD.gn b/multimedia/media_library/media_asset_manager/BUILD.gn index 57c7fb44c..9385e2e92 100644 --- a/multimedia/media_library/media_asset_manager/BUILD.gn +++ b/multimedia/media_library/media_asset_manager/BUILD.gn @@ -18,8 +18,12 @@ import("//foundation/multimedia/media_library/media_library.gni") ohos_ndk_headers("media_asset_manager_header") { dest_dir = "$ndk_headers_out_dir/multimedia/media_library" sources = [ + "../media_access_helper_capi.h", "../media_asset_base_capi.h", + "../media_asset_capi.h", + "../media_asset_change_request_capi.h", "../media_asset_manager_capi.h", + "../moving_photo_capi.h", ] } @@ -31,5 +35,9 @@ ohos_ndk_library("libmedia_asset_manager") { system_capability_headers = [ "multimedia/media_library/media_asset_manager_capi.h", "multimedia/media_library/media_asset_base_capi.h", + "multimedia/media_library/media_access_helper_capi.h", + "multimedia/media_library/media_asset_capi.h", + "multimedia/media_library/moving_photo_capi.h", + "multimedia/media_library/media_asset_change_request_capi.h", ] } diff --git a/multimedia/media_library/media_asset_manager/lib_media_asset_namager_capi.ndk.json b/multimedia/media_library/media_asset_manager/lib_media_asset_namager_capi.ndk.json index 7e910b968..f78edcc8b 100644 --- a/multimedia/media_library/media_asset_manager/lib_media_asset_namager_capi.ndk.json +++ b/multimedia/media_library/media_asset_manager/lib_media_asset_namager_capi.ndk.json @@ -14,5 +14,137 @@ { "first_introduced": "12", "name": "OH_MediaAssetManager_CancelRequest" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetManager_RequestMovingPhoto" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetManager_RequestImage" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetManager_Release" + }, + { + "first_introduced": "12", + "name": "OH_MediaAccessHelper_ApplyChanges" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetUri" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetMediaType" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetMediaSubType" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDisplayName" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetSize" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDateAdded" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDateModified" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDateTaken" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDateAddedMs" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDateModifiedMs" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDuration" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetWidth" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetHeight" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetOrientation" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_IsFavorite" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetTitle" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_Release" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_GetUri" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_RequestContentWithUris" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_RequestContentWithUri" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_RequestContentWithBuffer" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_Release" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_Create" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_AddResourceWithUri" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_AddResourceWithBuffer" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_GetWriteCacheHandler" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_SaveCameraPhoto" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_DiscardCameraPhoto" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_Release" } ] \ No newline at end of file diff --git a/multimedia/media_library/media_asset_manager_capi.h b/multimedia/media_library/media_asset_manager_capi.h index 4b465e05e..9a9d8d536 100644 --- a/multimedia/media_library/media_asset_manager_capi.h +++ b/multimedia/media_library/media_asset_manager_capi.h @@ -31,7 +31,7 @@ * to reqeust media source. * * @kit MediaLibraryKit - * @Syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @library libmedia_asset_manager.so * @since 12 */ @@ -94,7 +94,70 @@ MediaLibrary_RequestId OH_MediaAssetManager_RequestVideoForPath(OH_MediaAssetMan */ bool OH_MediaAssetManager_CancelRequest(OH_MediaAssetManager* manager, const MediaLibrary_RequestId requestId); +/** + * @brief Request moving photo object. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param manager the pointer to {@link OH_MediaAssetManager} instance. + * @param mediaAsset the {@link OH_MediaAsset} instance of media file object to be requested. + * @param requestOptions the {@link MediaLibrary_RequestOptions} for image request strategy mode. + * @param requestId indicates the {@link MediaLibrary_RequestId} of the request, which is an output parameter. + * @param callback the {@link OH_MediaLibrary_OnMovingPhotoDataPrepared} that will be called + * when the requested source is prepared. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetManager_RequestMovingPhoto(OH_MediaAssetManager* manager, + OH_MediaAsset* mediaAsset, MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId, + OH_MediaLibrary_OnMovingPhotoDataPrepared callback); + +/** + * @brief Request image resources based on different strategy modes. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param manager the pointer to {@link OH_MediaAssetManager} instance. + * @param mediaAsset the {@link OH_MediaAsset} instance of media file object to be requested. + * @param requestOptions the {@link MediaLibrary_RequestOptions} for image request strategy mode. + * @param requestId indicates the {@link MediaLibrary_RequestId} of the request, which is an output parameter. + * @param callback the {@link OH_MediaLibrary_OnImageDataPrepared} that will be called + * when the requested source is prepared. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_OPERATION_NOT_SUPPORTED} if operation is not supported. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetManager_RequestImage(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset, + MediaLibrary_RequestOptions requestOptions, MediaLibrary_RequestId* requestId, + OH_MediaLibrary_OnImageDataPrepared callback); + +/** + * @brief Release the {@link OH_MediaAssetManager} instance. + * + * @param manager the {@link OH_MediaAssetManager} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetManager_Release(OH_MediaAssetManager* manager); + #ifdef __cplusplus } #endif -#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_MANAGER_H \ No newline at end of file + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_MANAGER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_library/moving_photo_capi.h b/multimedia/media_library/moving_photo_capi.h new file mode 100644 index 000000000..b89560145 --- /dev/null +++ b/multimedia/media_library/moving_photo_capi.h @@ -0,0 +1,138 @@ +/* + * 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 MovingPhoto + * @{ + * + * @brief Provides APIs of request capability for Media Source. + * + * @since 12 + */ + +/** + * @file moving_photo_capi.h + * + * @brief Defines APIs related to moving photo. + * + * Provides the ability to obtain moving photo information. + * + * @kit MediaLibraryKit + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @library libmedia_asset_manager.so + * @since 12 + */ + +#ifndef MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H +#define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H + +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get uri of the moving photo. + * + * @param movingPhoto the {@link OH_MovingPhoto} instance. + * @param uri the uri of the moving photo. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri); + +/** + * @brief Request the image and video content of the moving photo and write to destination uri. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param movingPhoto the {@link OH_MovingPhoto} instance. + * @param imageUri the destination file uri to save the image data. + * @param videoUri the destination file uri to save the video data. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri, + char* videoUri); + +/** + * @brief Request the image or video content of the moving photo and write to destination uri. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param movingPhoto the {@link OH_MovingPhoto} instance. + * @param resourceType the {@link MediaLibrary_ResourceType} of the moving photo content to request. + * @param uri the destination file uri to save the data. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto, + MediaLibrary_ResourceType resourceType, char* uri); + +/** + * @brief Request data of the moving photo. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param movingPhoto the {@link OH_MovingPhoto} instance. + * @param resourceType the {@link MediaLibrary_ResourceType} of the moving photo content to request. + * @param buffer the buffer of the content. + * @param size the size of the buffer. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto, + MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size); + +/** + * @brief Release the {@link OH_MovingPhoto} instance. + * + * @param movingPhoto the {@link OH_MovingPhoto} instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H +/** @} */ \ No newline at end of file -- Gitee