1 /* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup MediaAssetManager 18 * @{ 19 * 20 * @brief Provides APIs of request capability for Media Source. 21 * 22 * @since 13 23 */ 24 25 /** 26 * @file moving_photo_capi.h 27 * 28 * @brief Defines APIs related to moving photo. 29 * 30 * Provides the ability to obtain moving photo information. 31 * 32 * @kit MediaLibraryKit 33 * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core 34 * @library libmedia_asset_manager.so 35 * @since 13 36 */ 37 38 #ifndef MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H 39 #define MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H 40 41 #include "media_asset_base_capi.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Get uri of the moving photo. 49 * 50 * @param movingPhoto the {@link OH_MovingPhoto} instance. 51 * @param uri the uri of the moving photo. 52 * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. 53 * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: 54 * 1. Mandatory parameters are left unspecified. 55 * 2. Incorrect parameter types. 56 * 3. Parameter verification failed. 57 * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. 58 * @since 13 59 */ 60 MediaLibrary_ErrorCode OH_MovingPhoto_GetUri(OH_MovingPhoto* movingPhoto, const char** uri); 61 62 /** 63 * @brief Request the image and video content of the moving photo and write to destination uri. 64 * 65 * @permission ohos.permission.READ_IMAGEVIDEO 66 * @param movingPhoto the {@link OH_MovingPhoto} instance. 67 * @param imageUri the destination file uri to save the image data. 68 * @param videoUri the destination file uri to save the video data. 69 * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. 70 * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: 71 * 1. Mandatory parameters are left unspecified. 72 * 2. Incorrect parameter types. 73 * 3. Parameter verification failed. 74 * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. 75 * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. 76 * @since 13 77 */ 78 MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUris(OH_MovingPhoto* movingPhoto, char* imageUri, 79 char* videoUri); 80 81 /** 82 * @brief Request the image or video content of the moving photo and write to destination uri. 83 * 84 * @permission ohos.permission.READ_IMAGEVIDEO 85 * @param movingPhoto the {@link OH_MovingPhoto} instance. 86 * @param resourceType the {@link MediaLibrary_ResourceType} of the moving photo content to request. 87 * @param uri the destination file uri to save the data. 88 * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. 89 * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: 90 * 1. Mandatory parameters are left unspecified. 91 * 2. Incorrect parameter types. 92 * 3. Parameter verification failed. 93 * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. 94 * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. 95 * @since 13 96 */ 97 MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithUri(OH_MovingPhoto* movingPhoto, 98 MediaLibrary_ResourceType resourceType, char* uri); 99 100 /** 101 * @brief Request data of the moving photo. 102 * 103 * @permission ohos.permission.READ_IMAGEVIDEO 104 * @param movingPhoto the {@link OH_MovingPhoto} instance. 105 * @param resourceType the {@link MediaLibrary_ResourceType} of the moving photo content to request. 106 * @param buffer the buffer of the content. 107 * @param size the size of the buffer. 108 * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. 109 * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: 110 * 1. Mandatory parameters are left unspecified. 111 * 2. Incorrect parameter types. 112 * 3. Parameter verification failed. 113 * {@link #MEDIA_LIBRARY_PERMISSION_DENIED} if permission is denied. 114 * {@link #MEDIA_LIBRARY_INTERNAL_SYSTEM_ERROR} if internal system error. 115 * @since 13 116 */ 117 MediaLibrary_ErrorCode OH_MovingPhoto_RequestContentWithBuffer(OH_MovingPhoto* movingPhoto, 118 MediaLibrary_ResourceType resourceType, const uint8_t** buffer, uint32_t* size); 119 120 /** 121 * @brief Release the {@link OH_MovingPhoto} instance. 122 * 123 * @param movingPhoto the {@link OH_MovingPhoto} instance. 124 * @return {@link #MEDIA_LIBRARY_OK} if the method call succeeds. 125 * {@link #MEDIA_LIBRARY_PARAMETER_ERROR} Parameter error. Possible causes: 126 * 1. Mandatory parameters are left unspecified. 127 * 2. Incorrect parameter types. 128 * 3. Parameter verification failed. 129 * @since 13 130 */ 131 MediaLibrary_ErrorCode OH_MovingPhoto_Release(OH_MovingPhoto* movingPhoto); 132 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif // MULTIMEDIA_MEDIA_LIBRARY_NATIVE_MOVING_PHOTO_H 138 /** @} */ 139