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