• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ASSET_IMPL_H
16 #define PHOTO_ASSET_IMPL_H
17 
18 #include <mutex>
19 
20 #include "cj_ffi/cj_common_ffi.h"
21 #include "file_asset.h"
22 #include "ffi_remote_data.h"
23 #include "photo_accesshelper_utils.h"
24 #include "pixel_map.h"
25 #include "thumbnail_manager.h"
26 #include "userfile_manager_types.h"
27 #include "userfilemgr_uri.h"
28 
29 namespace OHOS {
30 namespace Media {
31 class PhotoAssetImpl : public OHOS::FFI::FFIData {
32     DECL_TYPE(PhotoAssetImpl, OHOS::FFI::FFIData)
33 public:
34     explicit PhotoAssetImpl(std::shared_ptr<FileAsset> fileAssetPtr_);
35     explicit PhotoAssetImpl(std::unique_ptr<FileAsset> fileAssetPtr_);
~PhotoAssetImpl()36     ~PhotoAssetImpl() override
37     {
38         fileAssetPtr = nullptr;
39     }
40     std::shared_ptr<FileAsset> GetFileAssetInstance();
41     std::string GetFileDisplayName();
42     std::string GetFileUri();
43     MediaType GetMediaType();
44     int32_t GetFileId();
45 
46     PhotoAssetMember UserFileMgrGet(std::string &inputKey, int32_t &errCode);
47     bool HandleParamSet(const std::string &inputKey, const std::string &value,
48         ResultNapiType resultNapiType = ResultNapiType::TYPE_PHOTOACCESS_HELPER);
49     void UserFileMgrSet(std::string &inputKey, std::string &value, int32_t &errCode);
50     void CommitModify(int32_t &errCode);
51     int64_t GetThumbnail(CSize cSize, int32_t &errCode);
52 
53 private:
54     std::shared_ptr<FileAsset> fileAssetPtr = nullptr;
55 };
56 }
57 }
58 #endif