1 /* 2 * Copyright (c) 2022-2023 Shenzhen Kaihong DID 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_HDI_CODEC_V3_0_CODECCOMPONENTMANAGERSERVICE_H 17 #define OHOS_HDI_CODEC_V3_0_CODECCOMPONENTMANAGERSERVICE_H 18 19 #include <map> 20 #include <mutex> 21 #include <hdf_remote_service.h> 22 #include "device_resource_if.h" 23 #include "v3_0/icodec_component.h" 24 #include "v3_0/icodec_component_manager.h" 25 #include "component_mgr.h" 26 namespace OHOS { 27 namespace HDI { 28 namespace Codec { 29 namespace V3_0 { 30 class CodecComponentManagerService : public ICodecComponentManager { 31 public: 32 CodecComponentManagerService(); 33 virtual ~CodecComponentManagerService() = default; 34 int32_t GetComponentNum(int32_t &count) override; 35 int32_t GetComponentCapabilityList(std::vector<CodecCompCapability> &capList, int32_t count) override; 36 int32_t CreateComponent(sptr<ICodecComponent> &component, uint32_t &componentId, const std::string &compName, 37 int64_t appData, const sptr<ICodecCallback> &callbacks) override; 38 int32_t DestroyComponent(uint32_t componentId) override; 39 void LoadCapabilityData(const DeviceResourceNode &node); 40 void GetManagerMap(std::map<uint32_t, sptr<ICodecComponent>> &dumpMap); 41 bool JudgePassThrouth(void); 42 private: 43 uint32_t GetNextComponentId(void); 44 45 private: 46 std::map<uint32_t, sptr<ICodecComponent>> componentMap_; 47 uint32_t componentId_; 48 std::mutex mutex_; 49 DeviceResourceNode resourceNode_; 50 std::shared_ptr<OHOS::Codec::Omx::ComponentMgr> mgr_; 51 }; 52 } // namespace V3_0 53 } // namespace Codec 54 } // namespace HDI 55 } // namespace OHOS 56 57 #endif // OHOS_HDI_CODEC_V3_0_CODECCOMPONENTMANAGERSERVICE_H