1 /* 2 * Copyright (c) 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 HDI_CODECCONFIGPARSER_H 17 #define HDI_CODECCONFIGPARSER_H 18 19 #include "codec_component_type.h" 20 #include "device_resource_if.h" 21 22 #define NODE_VIDEO_HARDWARE_ENCODERS "VideoHwEncoders" 23 #define NODE_VIDEO_HARDWARE_DECODERS "VideoHwDecoders" 24 #define NODE_VIDEO_SOFTWARE_ENCODERS "VideoSwEncoders" 25 #define NODE_VIDEO_SOFTWARE_DECODERS "VideoSwDecoders" 26 #define NODE_AUDIO_HARDWARE_ENCODERS "AudioHwEncoders" 27 #define NODE_AUDIO_HARDWARE_DECODERS "AudioHwDecoders" 28 #define NODE_AUDIO_SOFTWARE_ENCODERS "AudioSwEncoders" 29 #define NODE_AUDIO_SOFTWARE_DECODERS "AudioSwDecoders" 30 31 #define CODEC_CONFIG_KEY_ROLE "role" 32 #define CODEC_CONFIG_KEY_TYPE "type" 33 #define CODEC_CONFIG_KEY_NAME "name" 34 #define CODEC_CONFIG_KEY_SUPPORT_PROFILES "supportProfiles" 35 #define CODEC_CONFIG_KEY_MAX_INST "maxInst" 36 #define CODEC_CONFIG_KEY_IS_SOFTWARE_CODEC "isSoftwareCodec" 37 #define CODEC_CONFIG_KEY_PROCESS_MODE_MASK "processModeMask" 38 #define CODEC_CONFIG_KEY_CAPS_MASK "capsMask" 39 #define CODEC_CONFIG_KEY_MIN_BITRATE "minBitRate" 40 #define CODEC_CONFIG_KEY_MAX_BITRATE "maxBitRate" 41 42 #define CODEC_CONFIG_KEY_MIN_WIDTH "minWidth" 43 #define CODEC_CONFIG_KEY_MIN_HEIGHT "minHeight" 44 #define CODEC_CONFIG_KEY_MAX_WIDTH "maxWidth" 45 #define CODEC_CONFIG_KEY_MAX_HEIGHT "maxHeight" 46 #define CODEC_CONFIG_KEY_WIDTH_ALIGNMENT "widthAlignment" 47 #define CODEC_CONFIG_KEY_HEIGHT_ALIGNMENT "heightAlignment" 48 #define CODEC_CONFIG_KEY_MIN_BLOCK_COUNT "minBlockCount" 49 #define CODEC_CONFIG_KEY_MAX_BLOCK_COUNT "maxBlockCount" 50 #define CODEC_CONFIG_KEY_MIN_BLOCKS_PER_SECOND "minBlocksPerSecond" 51 #define CODEC_CONFIG_KEY_MAX_BLOCKS_PER_SECOND "maxBlocksPerSecond" 52 #define CODEC_CONFIG_KEY_SUPPORT_PIXEL_FMTS "supportPixelFmts" 53 #define CODEC_CONFIG_KEY_BLOCK_SIZE_WIDTH "blockSizeWidth" 54 #define CODEC_CONFIG_KEY_BLOCK_SIZE_HEIGHT "blockSizeHeight" 55 #define CODEC_CONFIG_KEY_MIN_FRAME_RATE "minFrameRate" 56 #define CODEC_CONFIG_KEY_MAX_FRAME_RATE "maxFrameRate" 57 #define CODEC_CONFIG_KEY_BITE_RATE_MODE "bitRateMode" 58 #define CODEC_CONFIG_KEY_MESURED_FRAME_RATE "measuredFrameRate" 59 #define CODEC_CONFIG_KEY_CAN_SWAP_WIDTH_HEIGHT "canSwapWidthHeight" 60 61 #define CODEC_CONFIG_KEY_SAMPLE_FORMATS "sampleFormats" 62 #define CODEC_CONFIG_KEY_SAMPLE_RATE "sampleRate" 63 #define CODEC_CONFIG_KEY_CHANNEL_LAYOUTS "channelLayouts" 64 #define CODEC_CONFIG_KEY_CHANNEL_COUNT "channelCount" 65 66 #define CODEC_CAPABLITY_GROUP_NUM 8 67 68 typedef struct { 69 int32_t num; 70 CodecCompCapability *capablitis; 71 } CodecCapablityGroup; 72 73 typedef struct { 74 CodecCapablityGroup videoHwEncoderGroup; 75 CodecCapablityGroup videoHwDecoderGroup; 76 CodecCapablityGroup videoSwEncoderGroup; 77 CodecCapablityGroup videoSwDecoderGroup; 78 CodecCapablityGroup audioHwEncoderGroup; 79 CodecCapablityGroup audioHwDecoderGroup; 80 CodecCapablityGroup audioSwEncoderGroup; 81 CodecCapablityGroup audioSwDecoderGroup; 82 int32_t total; 83 bool inited; 84 } CodecCapablites; 85 86 typedef struct { 87 const char *attrName; 88 uint32_t *valueAddr; 89 uint32_t defaultValue; 90 } ConfigUintNodeAttr; 91 92 typedef struct { 93 const char *attrName; 94 int32_t *array; 95 int32_t length; 96 int32_t endValue; 97 } ConfigUintArrayNodeAttr; 98 99 int32_t LoadCodecCapabilityFromHcs(const struct DeviceResourceNode *node, CodecCapablites *caps); 100 int32_t ClearCapabilityGroup(CodecCapablites *caps); 101 102 #endif // HDI_CODECCONFIGPARSER_H 103