1 /* 2 * Copyright (c) 2024-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 CAMERA_ABILITY_BUILDER_H 16 #define CAMERA_ABILITY_BUILDER_H 17 18 #include <set> 19 #include <map> 20 #include <queue> 21 #include <vector> 22 #include <iostream> 23 #include <utility> 24 #include <variant> 25 #include <cstdint> 26 #include <memory> 27 #include <algorithm> 28 #include "metadata_utils.h" 29 #include "ability/camera_ability.h" 30 #include "ability/camera_ability_parse_util.h" 31 #include "session/capture_session.h" 32 33 namespace OHOS { 34 namespace CameraStandard { 35 36 using namespace std; 37 38 class CameraAbilityBuilder : public RefBase { 39 public: 40 virtual ~CameraAbilityBuilder() = default; 41 42 std::vector<sptr<CameraAbility>> GetAbility(int32_t modeName, common_metadata_header_t* metadata, 43 const std::set<int32_t>& specIds, sptr<CaptureSession> session, bool isForApp = true); 44 45 std::vector<sptr<CameraAbility>> GetConflictAbility(int32_t modeName, common_metadata_header_t* metadata); 46 47 private: 48 std::vector<int32_t> GetData(int32_t modeName, common_metadata_header_t* metadata, uint32_t tagId, int32_t specId); 49 50 std::vector<float> GetValidZoomRatioRange(const std::vector<int32_t>& data); 51 bool IsSupportMacro(const std::vector<int32_t>& data); 52 53 void SetModeSpecTagField(sptr<CameraAbility> ability, int32_t modeName, common_metadata_header_t* metadata, 54 uint32_t tagId, int32_t specId); 55 void SetOtherTag(sptr<CameraAbility> ability, int32_t modeName, sptr<CaptureSession> session); 56 57 std::map<uint32_t, std::map<int32_t, std::vector<int32_t>>> cacheTagDataMap_; 58 std::set<uint32_t> cachedTagSet_; 59 }; 60 } // namespace CameraStandard 61 } // namespace OHOS 62 #endif // CAMERA_ABILITY_BUILDER_H 63