1 /* 2 * Copyright (c) 2021 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_PARSER_H 17 #define CODEC_CONFIG_PARSER_H 18 19 #define NODE_VIDEO_HARDWARE_ENCODERS "VideoHwEncoders" 20 #define NODE_VIDEO_HARDWARE_DECODERS "VideoHwDecoders" 21 #define NODE_VIDEO_SOFTWARE_ENCODERS "VideoSwEncoders" 22 #define NODE_VIDEO_SOFTWARE_DECODERS "VideoSwDecoders" 23 #define NODE_AUDIO_HARDWARE_ENCODERS "AudioHwEncoders" 24 #define NODE_AUDIO_HARDWARE_DECODERS "AudioHwDecoders" 25 #define NODE_AUDIO_SOFTWARE_ENCODERS "AudioSwEncoders" 26 #define NODE_AUDIO_SOFTWARE_DECODERS "AudioSwDecoders" 27 28 #define CODEC_CONFIG_KEY_MIME "mime" 29 #define CODEC_CONFIG_KEY_TYPE "type" 30 #define CODEC_CONFIG_KEY_NAME "name" 31 #define CODEC_CONFIG_KEY_SUPPORT_PROFILES "supportProfiles" 32 #define CODEC_CONFIG_KEY_IS_SOFTWARE_CODEC "isSoftwareCodec" 33 #define CODEC_CONFIG_KEY_PROCESS_MODE_MASK "processModeMask" 34 #define CODEC_CONFIG_KEY_CAPS_MASK "capsMask" 35 #define CODEC_CONFIG_KEY_ALLOCATE_MASK "allocateMask" 36 #define CODEC_CONFIG_KEY_MIN_INPUT_BUFFER_NUM "minInputBufferNum" 37 #define CODEC_CONFIG_KEY_MAX_INPUT_BUFFER_NUM "maxInputBufferNum" 38 #define CODEC_CONFIG_KEY_MIN_OUTPUT_BUFFER_NUM "minOutputBufferNum" 39 #define CODEC_CONFIG_KEY_MAX_OUTPUT_BUFFER_NUM "maxOutputBufferNum" 40 #define CODEC_CONFIG_KEY_MIN_BITRATE "minBitRate" 41 #define CODEC_CONFIG_KEY_MAX_BITRATE "maxBitRate" 42 #define CODEC_CONFIG_KEY_INPUT_BUFFER_SIZE "inputBufferSize" 43 #define CODEC_CONFIG_KEY_OUTPUT_BUFFER_SIZE "outputBufferSize" 44 #define CODEC_CONFIG_KEY_MIN_WIDTH "minWidth" 45 #define CODEC_CONFIG_KEY_MIN_HEIGHT "minHeight" 46 #define CODEC_CONFIG_KEY_MAX_WIDTH "maxWidth" 47 #define CODEC_CONFIG_KEY_MAX_HEIGHT "maxHeight" 48 #define CODEC_CONFIG_KEY_WIDTH_ALIGNMENT "widthAlignment" 49 #define CODEC_CONFIG_KEY_HEIGHT_ALIGNMENT "heightAlignment" 50 #define CODEC_CONFIG_KEY_SUPPORT_PIXELF_MTS "supportPixelFmts" 51 52 #define CODEC_CONFIG_KEY_SAMPLE_FORMATS "sampleFormats" 53 #define CODEC_CONFIG_KEY_SAMPLE_RATE "sampleRate" 54 #define CODEC_CONFIG_KEY_CHANNEL_LAYOUTS "channelLayouts" 55 56 #define CODEC_CAPABLITY_GROUP_NUM 8 57 58 #include <device_resource_if.h> 59 #include "codec_type.h" 60 61 typedef enum { 62 CODEC_CONFIG_CMD_ENUMERATE_CAP, 63 CODEC_CONFIG_CMD_GET_CAP 64 } CodecInterfaceCmd; 65 66 typedef struct { 67 int num; 68 CodecCapability *capablitis; 69 } CodecCapablityGroup; 70 71 typedef struct { 72 bool inited; 73 CodecCapablityGroup videoHwEncoderGroup; 74 CodecCapablityGroup videoHwDecoderGroup; 75 CodecCapablityGroup videoSwEncoderGroup; 76 CodecCapablityGroup videoSwDecoderGroup; 77 CodecCapablityGroup audioHwEncoderGroup; 78 CodecCapablityGroup audioHwDecoderGroup; 79 CodecCapablityGroup audioSwEncoderGroup; 80 CodecCapablityGroup audioSwDecoderGroup; 81 } CodecCapablites; 82 83 typedef struct { 84 const char *attrName; 85 int32_t *array; 86 int32_t length; 87 int32_t endValue; 88 } ConfigUintArrayNodeAttr; 89 90 int32_t LoadCodecCapabilityFromHcs(const struct DeviceResourceNode *node); 91 int32_t ClearCapabilityGroup(); 92 CodecCapablityGroup *GetCapablityGroup(int32_t groupIndex); 93 bool CodecCapablitesInited(); 94 int32_t ReloadCapabilities(); 95 96 #endif // CODEC_CONFIG_PARSER_H 97