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 DRIVERS_PERIPHERAL_CODEC_CONFIG_PARSER_H_ 17 #define DRIVERS_PERIPHERAL_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_SUPPORT_PROFILES "supportProfiles" 31 #define CODEC_CONFIG_KEY_IS_SOFTWARE_CODEC "isSoftwareCodec" 32 #define CODEC_CONFIG_KEY_CAPS_MASK "capsMask" 33 #define CODEC_CONFIG_KEY_ALLOCATE_MASK "allocateMask" 34 #define CODEC_CONFIG_KEY_MIN_INPUT_BUFFER_NUM "minInputBufferNum" 35 #define CODEC_CONFIG_KEY_MAX_INPUT_BUFFER_NUM "maxInputBufferNum" 36 #define CODEC_CONFIG_KEY_MIN_OUTPUT_BUFFER_NUM "minOutputBufferNum" 37 #define CODEC_CONFIG_KEY_MAX_OUTPUT_BUFFER_NUM "maxOutputBufferNum" 38 #define CODEC_CONFIG_KEY_MIN_BITRATE "minBitRate" 39 #define CODEC_CONFIG_KEY_MAX_BITRATE "maxBitRate" 40 #define CODEC_CONFIG_KEY_BUFFER_SIZE "bufferSize" 41 #define CODEC_CONFIG_KEY_MIN_WIDTH "minWidth" 42 #define CODEC_CONFIG_KEY_MIN_HEIGHT "minHeight" 43 #define CODEC_CONFIG_KEY_MAX_WIDTH "maxWidth" 44 #define CODEC_CONFIG_KEY_MAX_HEIGHT "maxHeight" 45 #define CODEC_CONFIG_KEY_WIDTH_ALGINMENT "widthAlginment" 46 #define CODEC_CONFIG_KEY_HEIGHT_ALGINMENT "heightAlginment" 47 #define CODEC_CONFIG_KEY_SUPPORT_PIXELF_MTS "supportPixelFmts" 48 #define CODEC_CONFIG_KEY_SUPPORT_LEVELS "supportLevels" 49 #define CODEC_CONFIG_KEY_SAMPLE_FORMATS "sampleFormats" 50 #define CODEC_CONFIG_KEY_SAMPLE_RATE "sampleRate" 51 #define CODEC_CONFIG_KEY_CHANNEL_COUNT "channelCount" 52 53 #define CODEC_CAPABLITY_GROUP_NUM 8 54 55 #include <device_resource_if.h> 56 #include "codec_type.h" 57 58 typedef enum { 59 CODEC_CONFIG_CMD_ENUMERATE_CAP, 60 CODEC_CONFIG_CMD_GET_CAP 61 } CodecInterfaceCmd; 62 63 typedef struct { 64 int num; 65 CodecCapbility *capablitis; 66 } CodecCapablityGroup; 67 68 typedef struct { 69 bool inited; 70 CodecCapablityGroup videoHwEncoderGroup; 71 CodecCapablityGroup videoHwDecoderGroup; 72 CodecCapablityGroup videoSwEncoderGroup; 73 CodecCapablityGroup videoSwDecoderGroup; 74 CodecCapablityGroup audioHwEncoderGroup; 75 CodecCapablityGroup audioHwDecoderGroup; 76 CodecCapablityGroup audioSwEncoderGroup; 77 CodecCapablityGroup audioSwDecoderGroup; 78 } CodecCapablites; 79 80 int32_t LoadCodecCapabilityFromHcs(const struct DeviceResourceNode *node, CodecCapablites *caps); 81 int32_t ClearCapabilityGroup(CodecCapablites *caps); 82 83 #endif // DRIVERS_PERIPHERAL_CODEC_CONFIG_PARSER_H_ 84