From 19b3a01de6c9fabff26502d5397e750c9591d463 Mon Sep 17 00:00:00 2001 From: caochuan Date: Sat, 27 Jul 2024 17:47:24 +0800 Subject: [PATCH 1/2] add media library api Signed-off-by: caochuan --- .../media_access_helper/BUILD.gn | 35 +++ .../lib_media_access_helper_capi.ndk.json | 6 + .../media_library/media_access_helper_capi.h | 45 +++ multimedia/media_library/media_asset/BUILD.gn | 35 +++ .../media_asset/lib_media_asset_capi.ndk.json | 70 +++++ .../media_library/media_asset_base_capi.h | 163 ++++++++++ multimedia/media_library/media_asset_capi.h | 281 ++++++++++++++++++ .../media_asset_change_request/BUILD.gn | 35 +++ ...b_media_asset_change_request_capi.ndk.json | 14 + .../media_asset_change_request_capi.h | 106 +++++++ .../lib_media_asset_namager_capi.ndk.json | 8 + .../media_library/media_asset_manager_capi.h | 44 ++- .../media_library/moving_photo/BUILD.gn | 35 +++ .../lib_moving_photo_capi.ndk.json | 10 + multimedia/media_library/moving_photo_capi.h | 90 ++++++ 15 files changed, 975 insertions(+), 2 deletions(-) create mode 100644 multimedia/media_library/media_access_helper/BUILD.gn create mode 100644 multimedia/media_library/media_access_helper/lib_media_access_helper_capi.ndk.json create mode 100644 multimedia/media_library/media_access_helper_capi.h create mode 100644 multimedia/media_library/media_asset/BUILD.gn create mode 100644 multimedia/media_library/media_asset/lib_media_asset_capi.ndk.json create mode 100644 multimedia/media_library/media_asset_capi.h create mode 100644 multimedia/media_library/media_asset_change_request/BUILD.gn create mode 100644 multimedia/media_library/media_asset_change_request/lib_media_asset_change_request_capi.ndk.json create mode 100644 multimedia/media_library/media_asset_change_request_capi.h create mode 100644 multimedia/media_library/moving_photo/BUILD.gn create mode 100644 multimedia/media_library/moving_photo/lib_moving_photo_capi.ndk.json create mode 100644 multimedia/media_library/moving_photo_capi.h diff --git a/multimedia/media_library/media_access_helper/BUILD.gn b/multimedia/media_library/media_access_helper/BUILD.gn new file mode 100644 index 000000000..8a9094c56 --- /dev/null +++ b/multimedia/media_library/media_access_helper/BUILD.gn @@ -0,0 +1,35 @@ +# 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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/media_library/media_library.gni") + +ohos_ndk_headers("media_access_helper_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/media_library" + sources = [ + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_base_capi.h", + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_access_helper_capi.h", + ] +} + +ohos_ndk_library("libmedia_access_helper") { + ndk_description_file = "./lib_media_access_helper_capi.ndk.json" + output_name = "edia_access_helper" + output_extension = "so" + system_capability = "SystemCapability.FileManagement.PhotoAccessHelper.Core" + system_capability_headers = [ + "multimedia/media_library/media_access_helper_capi.h", + "multimedia/media_library/media_asset_base_capi.h", + ] +} diff --git a/multimedia/media_library/media_access_helper/lib_media_access_helper_capi.ndk.json b/multimedia/media_library/media_access_helper/lib_media_access_helper_capi.ndk.json new file mode 100644 index 000000000..ae83e7564 --- /dev/null +++ b/multimedia/media_library/media_access_helper/lib_media_access_helper_capi.ndk.json @@ -0,0 +1,6 @@ +[ + { + "first_introduced": "12", + "name": "OH_MediaAccessHelper_ApplyChanges" + } + ] \ No newline at end of file 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..4c6c6d591 --- /dev/null +++ b/multimedia/media_library/media_access_helper_capi.h @@ -0,0 +1,45 @@ +/* + * 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_MediaAccessHelper + * @{ + * + * @brief Provides APIs for album management, including creating an album and accessing and + * modifying media data in an album. + * + * @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" + +/** + * @brief Apply the change request of asset or album. + * + * @param changeRequest The change request to be applied + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAccessHelper_ApplyChanges(OH_MediaAssetChangeRequest* changeRequest); + + +#endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ACCESS_HELPER_H \ No newline at end of file diff --git a/multimedia/media_library/media_asset/BUILD.gn b/multimedia/media_library/media_asset/BUILD.gn new file mode 100644 index 000000000..420b6bba0 --- /dev/null +++ b/multimedia/media_library/media_asset/BUILD.gn @@ -0,0 +1,35 @@ +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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/media_library/media_library.gni") + +ohos_ndk_headers("media_asset_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/media_library" + sources = [ + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_base_capi.h", + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_capi.h", + ] +} + +ohos_ndk_library("libmedia_asset") { + ndk_description_file = "./lib_media_asset_capi.ndk.json" + output_name = "media_asset" + output_extension = "so" + system_capability = "SystemCapability.FileManagement.PhotoAccessHelper.Core" + system_capability_headers = [ + "multimedia/media_library/media_asset_capi.h", + "multimedia/media_library/media_asset_base_capi.h", + ] +} diff --git a/multimedia/media_library/media_asset/lib_media_asset_capi.ndk.json b/multimedia/media_library/media_asset/lib_media_asset_capi.ndk.json new file mode 100644 index 000000000..c2fa1929f --- /dev/null +++ b/multimedia/media_library/media_asset/lib_media_asset_capi.ndk.json @@ -0,0 +1,70 @@ +[ + { + "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_GetDataAdded" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDataModified" + }, + { + "first_introduced": "12", + "name": "OH_MediaAsset_GetDataTaken" + }, + { + "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" + } +] \ 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..210a0b025 100644 --- a/multimedia/media_library/media_asset_base_capi.h +++ b/multimedia/media_library/media_asset_base_capi.h @@ -71,6 +71,113 @@ 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. + * Null pointer is returned if the creation fails. + * + * @since 12 + */ +typedef struct OH_MediaAssetChangeRequest OH_MediaAssetChangeRequest; + +/** + * @brief Define Moving Photo + * + * Request the image and video content of the moving photo and write to destination uri. + * Null pointer is returned if the creation fails. + * + * @since 12 + */ +typedef struct OH_MovingPhoto OH_MovingPhoto; + +/** + * @brief Define Media Access Helper + * + * The photoAccessHelper module provides APIs for album management, + * including creating an album and accessing and modifying media data in an album. + * Null pointer is returned if the creation fails. + * + * @since 12 + */ +typedef struct OH_MediaAccessHelper OH_MediaAccessHelper; + +/** + * @brief Define Media Asset + * + * This structure provides the ability to encapsulate file asset attributes. + * + * @since 12 + */ +typedef struct OH_MediaAsset OH_MediaAsset; + +/** + * @brief Enum for mediaLibrary error code. + * + * @since 12 + */ +typedef enum MediaLibrary_ErrorCode { + /** + * Media library result is ok. + */ + MEDIA_LIBRARY_OK = 0, + + /** + * Permission is denied. + */ + MEDIA_LIBRARY_PERMISSION_DENIED = 201, + + /** + * Mandatory parameters are left unspecified or incorrect parameter types or parameter verification failed. + */ + MEDIA_LIBRARY_PARAMETER_ERROR = 401, + + /** + * File does not exist. + */ + MEDIA_LIBRARY_NO_SUCH_FILE = 13900002, + + /** + * File operation has no permission. + */ + MEDIA_LIBRARY_NO_PERMISSION = 13900012, + + /** + * Argument is invalid. + */ + MEDIA_LIBRARY_INVALID_ARGUMENT = 13900020, + + /** + * Unkown error. + */ + MEDIA_LIBRARY_UNKNOWN_ERROR = 13900042, + + /** + * Invalid display name. + */ + MEDIA_LIBRARY_INVALID_DISPLAY_NAME = 14000001, + + /** + * Invalid asset uri. + */ + MEDIA_LIBRARY_INVALID_ASSET_URI = 14000002, + + /** + * System inner fail. + */ + MEDIA_LIBRARY_SYSTEM_INNER_FAIL = 14000011, + + /** + * Member is not a valid PhotoKey. + */ + MEDIA_LIBRARY_INVALID_PHOTO_KEY = 14000014, + + /** + * Operation is not supported. + */ + MEDIA_LIBRARY_OPERATION_NOT_SUPPORT = 14000016 +} MediaLibrary_ErrorCode; + /** * @brief Define MediaLibrary_RequestId * @@ -102,6 +209,34 @@ typedef enum MediaLibrary_DeliveryMode { MEDIA_LIBRARY_BALANCED_MODE = 2 } MediaLibrary_DeliveryMode; +typedef enum MediaLibrary_MediaType { + /*image asset*/ + MEDIA_LIBRARY_IMAGE = 1, + /*video asset*/ + MEDIA_lIBRARY_VIDEO = 2 +}MediaLibrary_MediaType; + +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; + +typedef enum MediaLibrary_ResourceType { + /*image resource*/ + MEDIA_LIBRARY_IMAGE_RESOURCE = 1, + /*video resource*/ + MEDIA_LIBRARY_VIDEO_RESOURCE = 2 +}MediaLibrary_ResourceType; + +typedef enum MediaLibrary_ImageFileType { + /*JPEG type*/ + MEDIA_LIBRARY_IMAGE_JPEG = 1, +}MediaLibrary_ImageFileType; + /** * @brief Called when a requested source is prepared. * @@ -113,6 +248,20 @@ typedef enum MediaLibrary_DeliveryMode { */ typedef void (*OH_MediaLibrary_OnDataPrepared)(int32_t result, MediaLibrary_RequestId requestId); +typedef enum MediaLibrary_MediaQuality { + /*fast quality*/ + MEDIA_LIBRARY_FAST_QUALITY = 1, + /*high quality*/ + MEDIA_LIBRARY_HIGH_QUALITY = 2 +}MediaLibrary_MediaQuality; + +typedef enum MediaLibrary_MediaContentType { + /*compressed media content type*/ + MEDIA_LIBRARY_COMPRESSED = 1, + /*picture object media content type*/ + MEDIA_LIBRARY_PICTURE_OBJECT = 2 //YUV +}MediaLibrary_MediaContentType; + /** * @brief Request Options * @@ -125,6 +274,20 @@ typedef struct MediaLibrary_RequestOptions { MediaLibrary_DeliveryMode deliveryMode; } MediaLibrary_RequestOptions; +/** + * @brief Called when a requested source is prepared. + * + * This function is called when the requested source is prepared. + * + * @param result Results of the processing of the requested resources. + * @param requestId Request ID. + * @param mediaQuality media quality. + * @param type media content type. + * @since 12 + */ +typedef void (*OH_MediaLibrary_OnDataPreparedWithDetails)(MediaLibrary_ErrorCode result, + MediaLibrary_RequestId requestId, MediaLibrary_MediaQuality mediaQuality, MediaLibrary_MediaContentType type); + #ifdef __cplusplus } #endif diff --git a/multimedia/media_library/media_asset_capi.h b/multimedia/media_library/media_asset_capi.h new file mode 100644 index 000000000..a08758707 --- /dev/null +++ b/multimedia/media_library/media_asset_capi.h @@ -0,0 +1,281 @@ +/* + * 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_MediaAsset + * @{ + * + * @brief Provides APIs for encapsulating file asset attributes. + * + * @since 12 + */ + +#ifndef MEDIA_ASSET_CAPI_H +#define MEDIA_ASSET_CAPI_H + +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get the Uri of the media asset + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param uri The uri of the requested media asset + * @param size Size of the requested media asset URI + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @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 Pointer to an OH_MediaAsset instance. + * @param mediaType The media file type of the requested media asset + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetMediaType(OH_MediaAsset* mediaAsset, MediaLibrary_MediaType* mediaType); + +/** + * @brief Get the media asset type of the media asset + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param mediaSubType The media asset type of the requested media asset + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetMediaSubType(OH_MediaAsset* mediaAsset, + MediaLibrary_MediaSubType* mediaSubType); + +/** + * @brief Get the display name of the media asset + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param displayName The display name of the requested media asset + * @param size The size of display name of the requested media asset + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDisplayName(OH_MediaAsset* mediaAsset, const char** displayName); + +/** + * @brief Get the file size of the media asset + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param size The file size(in bytes) of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetSize(OH_MediaAsset* mediaAsset, uint32_t* size); + +/** + * @brief Get the date of the media asset when the file was added + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param dataAdded Date when the file was added. + * 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} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateAdded(OH_MediaAsset* mediaAsset, uint32_t* dataAdded); + +/** + * @brief Get the date of the media asset when the file content was last modified. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param dataModified Date when the file content (not the file name) was last modified. + * 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} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateModified(OH_MediaAsset* mediaAsset, uint32_t* dataModified); + +/** + * @brief Get the date of the media asset when the file (photo) was taken. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param dataTaken Date when the file (photo) was taken. + * 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} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDataTaken(OH_MediaAsset* mediaAsset, uint32_t* dataTaken); + +/** + * @brief Get the date of the media asset when the file was added. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param dateAddedMs Date when the file was added. The value is the number of milliseconds elapsed since the Epoch + * time (00:00:00 UTC on January 1, 1970).NOTE: The photos queried cannot be sorted based on this field. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateAddedMs(OH_MediaAsset* mediaAsset, uint32_t* dateAddedMs); + +/** + * @brief Get the date of the media asset when the file content was last modified. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param dateModifiedMs Date when the album file content (not the album name) was last modified. The value is the + * number of milliseconds elapsed since the Epoch time.NOTE: The photos queried cannot be sorted based on this field. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetDateModifiedMs(OH_MediaAsset* mediaAsset, uint32_t* dateModifiedMs); + +/** + * @brief Get the duration(in ms) of the media asset. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param duration The duration(in ms) of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @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 Pointer to an OH_MediaAsset instance. + * @param width The image width(in pixels) of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @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 Pointer to an OH_MediaAsset instance. + * @param width The image height(in pixels) of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetHeight(OH_MediaAsset* mediaAsset, uint32_t* height); + +/** + * @brief Get the Orientation of the image file. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param orientation The Orientation of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetOrientation(OH_MediaAsset* mediaAsset, uint32_t* orientation); + +/** + * @brief Whether the file is added to favorites. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param favorite The favorite of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_isFavorite(OH_MediaAsset* mediaAsset, uint32_t* favorite); + +/** + * @brief Get the title in the media file. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param title The title of the requested media asset. + * @param size The size of the title of the requested media asset. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * {@LINK #MEDIA_lIBRARY_INVALID_PHOTO_KEY} if member is not a valid PhotoKey + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_GetTitle(OH_MediaAsset* mediaAsset, const char** title); + +/** + * @brief Release the media asset + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAsset_Release(OH_MediaAsset* mediaAsset); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/multimedia/media_library/media_asset_change_request/BUILD.gn b/multimedia/media_library/media_asset_change_request/BUILD.gn new file mode 100644 index 000000000..fe86ae9bd --- /dev/null +++ b/multimedia/media_library/media_asset_change_request/BUILD.gn @@ -0,0 +1,35 @@ +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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/media_library/media_library.gni") + +ohos_ndk_headers("media_asset_change_request_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/media_library" + sources = [ + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_base_capi.h", + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_change_request_capi.h", + ] +} + +ohos_ndk_library("libmedia_asset_change_request") { + ndk_description_file = "./lib_media_asset_change_request_capi.ndk.json" + output_name = "media_asset_change_request" + output_extension = "so" + system_capability = "SystemCapability.FileManagement.PhotoAccessHelper.Core" + system_capability_headers = [ + "multimedia/media_library/media_asset_change_request_capi.h", + "multimedia/media_library/media_asset_base_capi.h", + ] +} diff --git a/multimedia/media_library/media_asset_change_request/lib_media_asset_change_request_capi.ndk.json b/multimedia/media_library/media_asset_change_request/lib_media_asset_change_request_capi.ndk.json new file mode 100644 index 000000000..9d0be0486 --- /dev/null +++ b/multimedia/media_library/media_asset_change_request/lib_media_asset_change_request_capi.ndk.json @@ -0,0 +1,14 @@ +[ + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_Create" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_AddResourceWithUri" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetChangeRequest_AddResourceWithBuffer" + } + ] \ 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..5ed58d90b --- /dev/null +++ b/multimedia/media_library/media_asset_change_request_capi.h @@ -0,0 +1,106 @@ +#ifndef MEDIA_ASSET_CHANGE_REQUEST_H +#define MEDIA_ASSET_CHANGE_REQUEST_H +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create a MediaAssetChangeRequest instance. + * + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +OH_MediaAssetChangeRequest* OH_MediaAssetChangeRequest_Create(OH_MediaAsset* mediaAsset); + +/** + * @brief Add resource of the asset using file uri. + * + * @param changeRequest Pointer to an OH_MediaAssetChangeRequest instance. + * @param resourceType Type of the resource to add. + * @param fileUri Data source of the resource to be added, + * which is specified by a URI in the application sandbox directory. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_NO_SUCH_FILE} if file does not exist + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * {@LINK #MEDIA_LIBRARY_OPERATION_NOT_SUPPORT} 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 Pointer to an OH_MediaAssetChangeRequest instance. + * @param resourceType Type of the resource to add. + * @param buffer Data of the resource to add. + * @param length The data length of the resource to add. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * {@LINK #MEDIA_LIBRARY_OPERATION_NOT_SUPPORT} 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. + * + * @param changeRequest Pointer to an OH_MediaAssetChangeRequest instance. + * @param Fd Write handle of a temporary file. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_OPERATION_NOT_SUPPORT} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_Media_AssetChangeRequest_GetWriteCacheHandler(OH_MediaAssetChangeRequest* changeRequest, + int32_t* Fd); + +/** + * @brief Save the photo asset captured by camera. + * + * @param changeRequest Pointer to an OH_MediaAssetChangeRequest instance. + * @param imageFileType The mage file type of photo asset. + * @return {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * {@LINK #MEDIA_LIBRARY_OPERATION_NOT_SUPPORT} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_Media_AssetChangeRequest_SaveCameraPhoto(OH_MediaAssetChangeRequest* changeRequest, + MediaLibrary_ImageFileType imageFileType); + +/** + * @brief Discard the photo asset captured by camera. + * + * @param changeRequest Pointer to an OH_MediaAssetChangeRequest instance. + * @return {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * {@LINK #MEDIA_LIBRARY_OPERATION_NOT_SUPPORT} if operation is not supported. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_DiscardCameraPhoto(OH_MediaAssetChangeRequest* changeRequest); + +/** + * @brief Release the OH_MediaAssetChangeRequest object. + * + * @param changeRequest Pointer to an OH_MediaAssetManager instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetChangeRequest_Release(OH_MediaAssetChangeRequest* changeRequest); +#ifdef __cplusplus +} +#endif +#endif 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..b0ddeb480 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,13 @@ { "first_introduced": "12", "name": "OH_MediaAssetManager_CancelRequest" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetManager_RequestMovingPhoto" + }, + { + "first_introduced": "12", + "name": "OH_MediaAssetManager_RequestImage" } ] \ 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..24c980626 100644 --- a/multimedia/media_library/media_asset_manager_capi.h +++ b/multimedia/media_library/media_asset_manager_capi.h @@ -30,7 +30,6 @@ * Uses the Native APIs provided by Media Asset Manager * to reqeust media source. * - * @kit MediaLibraryKit * @Syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @library libmedia_asset_manager.so * @since 12 @@ -40,6 +39,7 @@ #define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MEDIA_ASSET_MANAGER_H #include "media_asset_base_capi.h" +#include "image_source_native.h" #ifdef __cplusplus extern "C" { @@ -55,7 +55,7 @@ OH_MediaAssetManager* OH_MediaAssetManager_Create(void); /** * @brief Request image source with dest path. - * + * * @permission ohos.permission.READ_IMAGEVIDEO * @param manager Pointer to an OH_MediaAssetManager instance. * @param uri The uri of the requested image resource. @@ -94,6 +94,46 @@ MediaLibrary_RequestId OH_MediaAssetManager_RequestVideoForPath(OH_MediaAssetMan */ bool OH_MediaAssetManager_CancelRequest(OH_MediaAssetManager* manager, const MediaLibrary_RequestId requestId); +/** + * @brief Requests a moving photo object, which can be used to request the asset data of the moving photo. + * + * @param manager Pointer to an OH_MediaAssetManager instance. + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param requestOptions Options model for requesting resource. + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @param callback Called when a requested source is prepared. + * @return Return request id. + * @since 12 +*/ +MediaLibrary_RequestId OH_MediaAssetManager_RequestMovingPhoto(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset, + MediaLibrary_RequestOptions requestOptions, const OH_MovingPhoto** movingPhoto, + OH_MediaLibrary_OnDataPreparedWithDetails callback); + +/** + * @brief Request image source with dest path. + * + * @param manager Pointer to an OH_MediaAssetManager instance. + * @param mediaAsset Pointer to an OH_MediaAsset instance. + * @param requestOptions Options model for requesting resource. + * @param imageSourceNaive Defines an image source object for the image interface. + * @param callback Called when a requested source is prepared. + * @return Return request id. + * @since 12 +*/ +MediaLibrary_RequestId OH_MediaAssetManager_RequestImage(OH_MediaAssetManager* manager, OH_MediaAsset* mediaAsset, + MediaLibrary_RequestOptions requestOptions, const OH_ImageSourceNative** imageSourceNaive, + OH_MediaLibrary_OnDataPreparedWithDetails callback); + +/** + * @brief Release the media asset manager object. + * + * @param manager Pointer to an OH_MediaAssetManager instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_INVALID_ARGUMENT} if argument is invalid. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MediaAssetManager_Release(OH_MediaAssetManager* manager); + #ifdef __cplusplus } #endif diff --git a/multimedia/media_library/moving_photo/BUILD.gn b/multimedia/media_library/moving_photo/BUILD.gn new file mode 100644 index 000000000..0e86276cf --- /dev/null +++ b/multimedia/media_library/moving_photo/BUILD.gn @@ -0,0 +1,35 @@ +# 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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/media_library/media_library.gni") + +ohos_ndk_headers("moving_photo_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/media_library" + sources = [ + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/media_asset_base_capi.h", + "$MEDIALIB_INTERFACES_PATH/interfaces/kits/c/moving_photo_capi.h", + ] +} + +ohos_ndk_library("libmedia_asset_change_request") { + ndk_description_file = "./lib_media_asset_change_request_capi.ndk.json" + output_name = "media_asset_change_request" + output_extension = "so" + system_capability = "SystemCapability.FileManagement.PhotoAccessHelper.Core" + system_capability_headers = [ + "multimedia/media_library/moving_photo_capi.h", + "multimedia/media_library/media_asset_base_capi.h", + ] +} \ No newline at end of file diff --git a/multimedia/media_library/moving_photo/lib_moving_photo_capi.ndk.json b/multimedia/media_library/moving_photo/lib_moving_photo_capi.ndk.json new file mode 100644 index 000000000..ce4291f81 --- /dev/null +++ b/multimedia/media_library/moving_photo/lib_moving_photo_capi.ndk.json @@ -0,0 +1,10 @@ +[ + { + "first_introduced": "12", + "name": "OH_MovingPhoto_GetUri" + }, + { + "first_introduced": "12", + "name": "OH_MovingPhoto_RequestContent" + } +] \ 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..7fdd34501 --- /dev/null +++ b/multimedia/media_library/moving_photo_capi.h @@ -0,0 +1,90 @@ +#ifndef MOVING_PHOTO_CAPI_H +#define MOVING_PHOTO_CAPI_H +#include "media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get uri of the moving photo. + * + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @param resourceType Resource type of the moving photo content to request. + * @param uri URI of the moving photo obtained. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, MediaLibrary_ResourceType resourceType, + const char** uri); + +/** + * @brief Request the image and video content of the moving photo and write to destination uri. + * + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @param imageUri URI to which the image data of the moving photo is to be written. + * @param videoUri URI to which the video data of the moving photo is to be written. + * @param callback Called when a requested source is prepared. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri, char* videoUri, + OH_MediaLibrary_OnDataPrepared callback); + +/** + * @brief Request the image and video content of the moving photo and write to destination uri. + * + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @param resourceType Resource type of the moving photo content to request. + * @param uri URI to which the moving photo content is to be written. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto, + MediaLibrary_ResourceType resourceType, char* uri); + +/** + * @brief Request content of the moving photo for the given resource type and return the array buffer. + * + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @param resourceType Resource type of the moving photo content to request. + * @param buffer Array buffer of the content. + * @param size The size of array buffer. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto, + MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size); + +/** + * @brief Release the moving photo object. + * + * @param movingPhoto Pointer to an OH_MovingPhoto instance. + * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. + * {@LINK #MEDIA_LIBRARY_PARAMETER_ERROR} if mandatory parameters are left unspecified or incorrect parameter + * types or parameter verification failed. + * {@LINK #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. + * {@LINK #MEDIA_LIBRARY_SYSTEM_INNER_FAIL} if system inner fail. + * @since 12 +*/ +MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto); +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file -- Gitee From 8fdb2f28425b0f519d2af1638ab773a34aacd763 Mon Sep 17 00:00:00 2001 From: caochuan Date: Sat, 27 Jul 2024 10:14:13 +0000 Subject: [PATCH 2/2] update multimedia/media_library/media_asset_base_capi.h. Signed-off-by: caochuan --- multimedia/media_library/media_asset_base_capi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multimedia/media_library/media_asset_base_capi.h b/multimedia/media_library/media_asset_base_capi.h index 210a0b025..bfd753a47 100644 --- a/multimedia/media_library/media_asset_base_capi.h +++ b/multimedia/media_library/media_asset_base_capi.h @@ -234,7 +234,7 @@ typedef enum MediaLibrary_ResourceType { typedef enum MediaLibrary_ImageFileType { /*JPEG type*/ - MEDIA_LIBRARY_IMAGE_JPEG = 1, + MEDIA_LIBRARY_IMAGE_JPEG = 1 }MediaLibrary_ImageFileType; /** -- Gitee