1 /* 2 * Copyright (C) 2023 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 OHOS_MEDIALIBRARY_VISION_OPERATIOINS_H 17 #define OHOS_MEDIALIBRARY_VISION_OPERATIOINS_H 18 19 #include <string> 20 #include <unordered_map> 21 22 #include "abs_shared_result_set.h" 23 #include "medialibrary_command.h" 24 #include "medialibrary_async_worker.h" 25 #include "datashare_predicates.h" 26 #include "foreground_analysis_meta.h" 27 28 namespace OHOS { 29 namespace Media { 30 class UpdateVisionAsyncTaskData : public AsyncTaskData { 31 public: UpdateVisionAsyncTaskData(int32_t fileId)32 UpdateVisionAsyncTaskData(int32_t fileId) : fileId_(fileId) {}; 33 virtual ~UpdateVisionAsyncTaskData() override = default; 34 int32_t fileId_; 35 }; 36 37 class MediaLibraryVisionOperations { 38 public: 39 static int32_t InsertOperation(MediaLibraryCommand &cmd); 40 static int32_t UpdateOperation(MediaLibraryCommand &cmd); 41 static int32_t DeleteOperation(MediaLibraryCommand &cmd); 42 EXPORT static int32_t EditCommitOperation(MediaLibraryCommand &cmd); 43 static std::shared_ptr<NativeRdb::ResultSet> QueryOperation(MediaLibraryCommand &cmd, 44 const std::vector<std::string> &columns); 45 static std::shared_ptr<NativeRdb::ResultSet> HandleForegroundAnalysisOperation(MediaLibraryCommand &cmd); 46 static int32_t PrepareDelayFgAnalysis(const std::string &assetUri, MediaType mediaType); 47 48 private: 49 static int32_t InitForegroundAnalysisMeta(MediaLibraryCommand &cmd, 50 std::shared_ptr<ForegroundAnalysisMeta> &infoPtr); 51 }; 52 } // namespace Media 53 } // namespace OHOS 54 #endif // OHOS_MEDIALIBRARY_VISION_OPERATIOINS_H