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 TriggerHighlightThumbnail(ThumbRdbOpt &opts, std::string &id, std::string &tracks, 40 std::string &trigger, std::string &genType); 41 EXPORT static int32_t UpgradeThumbnailBackground(ThumbRdbOpt &opts, bool isWifiConnected); 42 EXPORT static int32_t RestoreAstcDualFrame(ThumbRdbOpt &opts, 43 const int32_t &restoreAstcCount = ASTC_GENERATE_COUNT_AFTER_RESTORE); 44 EXPORT static int32_t CreateAstcBatchOnDemand(ThumbRdbOpt &opts, NativeRdb::RdbPredicates &predicate, 45 int32_t requestId); 46 EXPORT static int32_t CreateLocalThumbnail(ThumbRdbOpt &opts); 47 EXPORT static int32_t GetNewThumbnailCount(ThumbRdbOpt &opts, const int64_t &time, int &count); 48 EXPORT static int32_t GetThumbnailPixelMap(ThumbRdbOpt &opts, ThumbnailType thumbType); 49 EXPORT static int32_t GetKeyFrameThumbnailPixelMap(ThumbRdbOpt &opts, int32_t &timeStamp, 50 int32_t &type); 51 EXPORT static int32_t CheckLcdSizeAndUpdateStatus(ThumbRdbOpt &opts); 52 53 private: 54 EXPORT static int32_t GetLcdCount(ThumbRdbOpt &opts, int &outLcdCount); 55 EXPORT static int32_t GetNoLcdData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas); 56 EXPORT static int32_t GetLocalNoLcdData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas); 57 EXPORT static int32_t GetNoThumbnailData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas); 58 EXPORT static int32_t GetNoAstcData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas); 59 EXPORT static int32_t GetAvailableFile(ThumbRdbOpt &opts, ThumbnailData &data, ThumbnailType thumbType, 60 std::string &fileName); 61 EXPORT static int32_t GetNoHighlightData(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas); 62 EXPORT static int32_t GetAvailableKeyFrameFile(ThumbRdbOpt &opts, ThumbnailData &data, int32_t thumbType, 63 std::string &fileName); 64 EXPORT static int32_t GetThumbnailDataNeedUpgrade(ThumbRdbOpt &opts, std::vector<ThumbnailData> &outDatas, 65 bool isWifiConnected); 66 EXPORT static void CheckMonthAndYearKvStoreValid(ThumbRdbOpt &opts); 67 }; 68 } // namespace Media 69 } // namespace OHOS 70 71 #endif // FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_GENERATE_HELPER_H_ 72