1 /* 2 * Copyright (c) 2023-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 #if defined(VIDEO_SUPPORT) 16 #ifndef HISTREAMER_PLUGIN_HDI_CODEC_MANAGER_H 17 #define HISTREAMER_PLUGIN_HDI_CODEC_MANAGER_H 18 #include "codec_manager.h" 19 #include <unordered_map> 20 #include "codec_component_manager.h" 21 #include "codec_callback_type_stub.h" 22 #include "codec_omx_ext.h" 23 24 namespace OHOS { 25 namespace Media { 26 namespace Plugin { 27 namespace CodecAdapter { 28 class HdiCodecManager : public CodecManager { 29 public: 30 static HdiCodecManager& GetInstance(); 31 ~HdiCodecManager() override; 32 33 int32_t CreateComponent(const Plugin::Any& component, uint32_t& id, const std::string& name, 34 const Plugin::Any& appData, const Plugin::Any& callbacks) override; 35 int32_t DestroyComponent(const Plugin::Any& component, uint32_t id) override; 36 37 Status RegisterCodecPlugins(const std::shared_ptr<OHOS::Media::Plugin::Register>& reg) override; 38 Status UnRegisterCodecPlugins() override; 39 private: 40 HdiCodecManager(); 41 void Init(); 42 void Reset(); 43 void AddHdiCap(const CodecCompCapability& hdiCap); 44 void InitCaps(); 45 static std::vector<VideoPixelFormat> GetCodecFormats(const CodecVideoPortCap& port); 46 static std::string GetCodecMime(const AvCodecRole& role); 47 static PluginType GetCodecType(const CodecType& hdiType); 48 49 CodecComponentManager* mgr_ {nullptr}; 50 std::vector<CodecCapability> codecCapabilitys_; 51 }; 52 } // namespace CodecAdapter 53 } // namespace Plugin 54 } // namespace Media 55 } // namespace OHOS 56 #endif // HISTREAMER_PLUGIN_HDI_CODEC_MANAGER_H 57 #endif