• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #ifndef FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_GENERATE_HELPER_H_
17 #define FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_GENERATE_HELPER_H_
18 
19 #include "rdb_helper.h"
20 #include "rdb_predicates.h"
21 #include "single_kvstore.h"
22 #include "thumbnail_utils.h"
23 
24 namespace OHOS {
25 namespace Media {
26 class ThumbnailGenerateHelper {
27 public:
28     ThumbnailGenerateHelper() = delete;
29     virtual ~ThumbnailGenerateHelper() = delete;
30     EXPORT static int32_t CreateThumbnailFileScaned(ThumbRdbOpt &opts, bool isSync);
31     EXPORT static int32_t CreateThumbnailFileScanedWithPicture(ThumbRdbOpt &opts,
32         std::shared_ptr<Picture> originalPhotoPicture, bool isSync);
33     EXPORT static int32_t CreateThumbnailBackground(ThumbRdbOpt &opts);
34     EXPORT static int32_t CreateAstcBackground(ThumbRdbOpt &opts);
35     EXPORT static int32_t CreateAstcCloudDownload(ThumbRdbOpt &opts, bool isCloudInsertTaskPriorityHigh = false);
36     EXPORT static int32_t CreateAstcMthAndYear(ThumbRdbOpt &opts);
37     EXPORT static int32_t CreateLcdBackground(ThumbRdbOpt &opts);
38     EXPORT static int32_t GenerateHighlightThumbnailBackground(ThumbRdbOpt &opts);
39     EXPORT static int32_t RegenerateThumbnailFromCloud(ThumbRdbOpt &opts);
40     EXPORT static int32_t TriggerHighlightThumbnail(ThumbRdbOpt &opts, std::string &id, std::string &tracks,
41         std::string &trigger, std::string &genType);
42     EXPORT static int32_t UpgradeThumbnailBackground(ThumbRdbOpt &opts, bool isWifiConnected);
43     EXPORT static int32_t RestoreAstcDualFrame(ThumbRdbOpt &opts,
44         const int32_t &restoreAstcCount = ASTC_GENERATE_COUNT_AFTER_RESTORE);
45     EXPORT static int32_t CreateAstcBatchOnDemand(ThumbRdbOpt &opts, NativeRdb::RdbPredicates &predicate,
46         int32_t requestId);
47     EXPORT static int32_t CreateLocalThumbnail(ThumbRdbOpt &opts);
48     EXPORT static int32_t GetNewThumbnailCount(ThumbRdbOpt &opts, const int64_t &time, int &count);
49     EXPORT static int32_t GetThumbnailPixelMap(ThumbnailData& data, ThumbRdbOpt &opts, ThumbnailType thumbType);
50     EXPORT static int32_t GetKeyFrameThumbnailPixelMap(ThumbRdbOpt &opts, int32_t &timeStamp,
51         int32_t &type);
52     EXPORT static int32_t CheckLcdSizeAndUpdateStatus(ThumbRdbOpt &opts);
53     EXPORT static int32_t RepairExifRotateBackground(ThumbRdbOpt &opts);
54     EXPORT static int32_t FixThumbnailExifRotateAfterDownloadAsset(ThumbRdbOpt &opts);
55 
56 private:
57     EXPORT static int32_t GetLcdCount(ThumbRdbOpt &opts, int &outLcdCount);
58     EXPORT static int32_t GetNoLcdData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas);
59     EXPORT static int32_t GetLocalNoLcdData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas);
60     EXPORT static int32_t GetNoThumbnailData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas);
61     EXPORT static int32_t GetNoAstcData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas);
62     EXPORT static int32_t GetAvailableFile(ThumbRdbOpt &opts, ThumbnailData &data, ThumbnailType thumbType,
63         std::string &fileName);
64     EXPORT static std::string GetAvailablePath(const std::string &path, const ThumbnailType &thumbType);
65     EXPORT static int32_t GetNoHighlightData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas);
66     EXPORT static int32_t GetAvailableKeyFrameFile(ThumbRdbOpt &opts, ThumbnailData &data, int32_t thumbType,
67         std::string &fileName);
68     EXPORT static int32_t GetThumbnailDataNeedUpgrade(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas,
69         bool isWifiConnected);
70     EXPORT static void CheckMonthAndYearKvStoreValid(ThumbRdbOpt &opts);
71 };
72 } // namespace Media
73 } // namespace OHOS
74 
75 #endif  // FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_GENERATE_HELPER_H_
76