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 #ifndef PHOTO_ACCESS_HELPER_FFI_H 16 #define PHOTO_ACCESS_HELPER_FFI_H 17 18 #include "cj_common_ffi.h" 19 #include "ffi_remote_data.h" 20 #include "fetch_result_impl.h" 21 #include "media_asset_manager_ffi.h" 22 #include "media_album_change_request_impl.h" 23 #include "media_asset_change_request_impl.h" 24 #include "media_asset_manager_ffi.h" 25 #include "moving_photo_impl.h" 26 #include "photo_album_impl.h" 27 #include "photo_accesshelper_impl.h" 28 #include "photo_asset_impl.h" 29 30 namespace OHOS { 31 namespace Media { 32 extern "C" { 33 // PhotoAccessHelper 34 FFI_EXPORT int64_t FfiPhotoAccessHelperGetPhotoAccessHelper(int64_t id); 35 FFI_EXPORT int64_t FfiPhotoAccessHelperGetAssets(int64_t id, COptions options, int32_t* errCode); 36 FFI_EXPORT int64_t FfiPhotoAccessHelperGetBurstAssets(int64_t id, char* cBurstKey, 37 COptions options, int32_t* errCode); 38 FFI_EXPORT int64_t FfiPhotoAccessHelperGetAlbums(int64_t id, int32_t type, int32_t subtype, 39 COptions options, int32_t* errCode); 40 FFI_EXPORT void FfiPhotoAccessHelperRegisterChange(int64_t id, char* uri, 41 bool forChildUris, int64_t funcId, int32_t *errCode); 42 FFI_EXPORT void FfiPhotoAccessHelperUnRegisterChange(int64_t id, char* uri, int64_t funcId, int32_t *errCode); 43 FFI_EXPORT void FfiPhotoAccessHelperRelease(int64_t id, int32_t *errCode); 44 FFI_EXPORT void FfiPhotoAccessHelperShowAssetsCreationDialog(int64_t id, CArrString srcFileUris, 45 PhotoCreationConfigs photoCreationConfigs, int64_t funcId, FfiBundleInfo cBundleInfo, int32_t *errCode); 46 FFI_EXPORT PhotoSelectResult FfiPhotoAccessHelperStartPhotoPicker(int64_t id, 47 PhotoSelectOptions option, int32_t *errCode); 48 49 // PhotoAsset 50 FFI_EXPORT char* FfiPhotoAssetGetFileDisplayName(int64_t id); 51 FFI_EXPORT char* FfiPhotoAssetGetFileUri(int64_t id); 52 FFI_EXPORT int32_t FfiPhotoAssetGetMediaType(int64_t id); 53 FFI_EXPORT PhotoAssetMember FfiPhotoAssetUserFileMgrGet(int64_t id, char* member, int32_t* errCode); 54 FFI_EXPORT void FfiPhotoAssetUserFileMgrSet(int64_t id, char* member, char* data, int32_t* errCode); 55 FFI_EXPORT void FfiPhotoAssetCommitModify(int64_t id, int32_t* errCode); 56 FFI_EXPORT int64_t FfiPhotoAssetGetThumbnail(int64_t id, CSize cSize, int32_t* errCode); 57 58 // FetchResult 59 FFI_EXPORT int32_t FfiFetchResultGetCount(int64_t id, int32_t* errCode); 60 FFI_EXPORT bool FfiFetchResultIsAfterLast(int64_t id, int32_t* errCode); 61 FFI_EXPORT void FfiFetchResultClose(int64_t id); 62 FFI_EXPORT FetchResultObject FfiFetchResultGetFirstObject(int64_t id, int32_t* errCode); 63 FFI_EXPORT FetchResultObject FfiFetchResultGetNextObject(int64_t id, int32_t* errCode); 64 FFI_EXPORT FetchResultObject FfiFetchResultGetLastObject(int64_t id, int32_t* errCode); 65 FFI_EXPORT FetchResultObject FfiFetchResultGetObjectAtPosition(int64_t id, int32_t position, int32_t* errCode); 66 FFI_EXPORT CArrayFetchResultObject FfiFetchResultGetAllObjects(int64_t id, int32_t* errCode); 67 68 // Album 69 FFI_EXPORT int32_t FfiPhotoAlbumGetPhotoAlbumType(int64_t id); 70 FFI_EXPORT int32_t FfiPhotoAlbumGetPhotoAlbumSubType(int64_t id); 71 FFI_EXPORT char* FfiPhotoAlbumGetAlbumName(int64_t id); 72 FFI_EXPORT void FfiPhotoAlbumSetAlbumName(int64_t id, char* cAlbumName); 73 FFI_EXPORT char* FfiPhotoAlbumGetAlbumUri(int64_t id); 74 FFI_EXPORT int32_t FfiPhotoAlbumGetCount(int64_t id); 75 FFI_EXPORT char* FfiPhotoAlbumGetCoverUri(int64_t id); 76 FFI_EXPORT int32_t FfiPhotoAlbumGetImageCount(int64_t id); 77 FFI_EXPORT int32_t FfiPhotoAlbumGetVideoCount(int64_t id); 78 FFI_EXPORT int64_t FfiPhotoAlbumGetAssets(int64_t id, COptions options, int32_t* errCode); 79 FFI_EXPORT void FfiPhotoAlbumCommitModify(int64_t id, int32_t* errCode); 80 81 // MediaAssetManager 82 FFI_EXPORT char* FfiMediaAssetManagerRequestImage(int64_t contextId, int64_t photoAssetId, 83 RequestOptions requestOptions, int64_t funcId, int32_t* errCode); 84 FFI_EXPORT char* FfiMediaAssetManagerRequestImageData(int64_t contextId, int64_t photoAssetId, 85 RequestOptions requestOptions, int64_t funcId, int32_t* errCode); 86 FFI_EXPORT char* FfiMediaAssetManagerRequestMovingPhoto(int64_t contextId, int64_t photoAssetId, 87 RequestOptions requestOptions, int64_t funcId, int32_t* errCode); 88 FFI_EXPORT char* FfiMediaAssetManagerRequestVideoFile(int64_t contextId, int64_t photoAssetId, 89 RequestOptions requestOptions, char* fileUri, int64_t funcId, int32_t* errCode); 90 FFI_EXPORT void FfiMediaAssetManagerCancelRequest(int64_t contextId, char* cRequestId, int32_t* errCode); 91 FFI_EXPORT int64_t FfiMediaAssetManagerLoadMovingPhoto(int64_t contextId, 92 char* cImageFileUri, char* cVideoFileUri, int32_t* errCode); 93 94 // MovingPhoto 95 FFI_EXPORT char* FfiMovingPhotoGetUri(int64_t id, int32_t* errCode); 96 FFI_EXPORT void FfiMovingPhotoRequestContentUri(int64_t id, 97 char* imageFileUri, char* videoFileUri, int32_t* errCode); 98 FFI_EXPORT void FfiMovingPhotoRequestContentResourceType(int64_t id, 99 int32_t resourceType, char* fileUri, int32_t* errCode); 100 FFI_EXPORT CArrUI8 FfiMovingPhotoRequestContentArrayBuffer(int64_t id, 101 int32_t resourceType, int32_t* errCode); 102 103 // MediaAssetChangeRequest 104 FFI_EXPORT int64_t FfiMediaAssetChangeRequestImplConstructor(int64_t id, int32_t* errCode); 105 FFI_EXPORT int64_t FfiMediaAssetChangeRequestImplCreateImageAssetRequest(int64_t id, char* fileUri, int32_t* errCode); 106 FFI_EXPORT int64_t FfiMediaAssetChangeRequestImplCreateVideoAssetRequest(int64_t id, char* fileUri, int32_t* errCode); 107 FFI_EXPORT RetDataI64 FfiMediaAssetChangeRequestImplCreateAssetRequest( 108 int64_t id, int32_t photoType, char* extension, char* title, int32_t subType); 109 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplDeleteAssetsByObject(int64_t id, CArrI64 assets); 110 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplDeleteAssetsByString(int64_t id, CArrString assets); 111 FFI_EXPORT int64_t FfiMediaAssetChangeRequestImplGetAsset(int64_t id, int32_t* errCode); 112 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplSetTitle(int64_t id, char* title); 113 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplGetWriteCacheHandler(int64_t id, int32_t* errCode); 114 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplAddResourceByString(int64_t id, int32_t resourceType, char* fileUri); 115 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplAddResourceByBuffer(int64_t id, int32_t resourceType, CArrUI8 data); 116 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplSaveCameraPhoto(int64_t id); 117 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplDiscardCameraPhoto(int64_t id); 118 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplSetOrientation(int64_t id, int32_t orientation); 119 FFI_EXPORT int32_t FfiMediaAssetChangeRequestImplApplyChanges(int64_t id); 120 121 // MediaAlbumChangeRequest 122 FFI_EXPORT int64_t FfiMediaAlbumChangeRequestImplConstructor(int64_t id, int32_t* errCode); 123 FFI_EXPORT int64_t FfiMediaAlbumChangeRequestImplGetAlbum(int64_t id, int32_t* errCode); 124 FFI_EXPORT int32_t FfiMediaAlbumChangeRequestImplSetAlbumName(int64_t id, char* albumName); 125 FFI_EXPORT int32_t FfiMediaAlbumChangeRequestImplAddAssets(int64_t id, CArrI64 assets); 126 FFI_EXPORT int32_t FfiMediaAlbumChangeRequestImplRemoveAssets(int64_t id, CArrI64 assets); 127 FFI_EXPORT int32_t FfiMediaAlbumChangeRequestImplApplyChanges(int64_t id); 128 } 129 } 130 } 131 #endif