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