1 /* 2 * Copyright 2022 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 CODEC_CONFIG_H 17 #include <refbase.h> 18 #include "v1_0/codec_types.h" 19 #include "device_resource_if.h" 20 using OHOS::HDI::Codec::V1_0::CodecCompCapability; 21 namespace OHOS { 22 namespace Codec { 23 namespace Omx { 24 typedef struct { 25 std::string attrName; 26 int32_t &value; 27 uint32_t defaultValue; 28 } ConfigUintNodeAttr; 29 typedef struct { 30 std::string attrName; 31 std::vector<int32_t> &vec; 32 } ConfigUintArrayNodeAttr; 33 34 class CodecComponentConfig { 35 public: 36 ~CodecComponentConfig() = default; 37 static CodecComponentConfig *GetInstance(); 38 void Init(const DeviceResourceNode &node); 39 int32_t GetComponentNum(int32_t &count); 40 int32_t GetComponentCapabilityList(std::vector<CodecCompCapability> &capList, int32_t count); 41 42 protected: 43 CodecComponentConfig(); 44 45 private: 46 int32_t GetGroupCapabilitiesNumber(const std::string &nodeName, int32_t &num); 47 int32_t GetGroupCapabilities(const std::string &nodeName); 48 int32_t GetOneCapability(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &childNode, 49 CodecCompCapability &cap, bool isVideoGroup); 50 int32_t GetMiscOfCapability(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &childNode, 51 CodecCompCapability &cap); 52 int32_t GetUintTableConfig(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &node, 53 ConfigUintArrayNodeAttr &attr); 54 int32_t GetMaskedConfig(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &node, 55 const std::string &attrName, uint32_t &mask); 56 int32_t GetAudioPortCapability(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &childNode, 57 CodecCompCapability &cap); 58 int32_t GetVideoPortCapability(const struct DeviceResourceIface &iface, const struct DeviceResourceNode &childNode, 59 CodecCompCapability &cap); 60 61 private: 62 DeviceResourceNode node_; 63 std::vector<CodecCompCapability> capList_; 64 static CodecComponentConfig config_; 65 }; 66 } // namespace Omx 67 } // namespace Codec 68 } // namespace OHOS 69 #define CODEC_CONFIG_H 70 #endif // CODEC_CONFIG_H