diff --git a/codec/hal/include/codec_config_parser.h b/codec/hal/include/codec_config_parser.h index f13f9c4cc73a9cec7d9bdedf653c7a1ba90c97bd..e5bdb17f6397f7ffb86d1d377b7dbf07d42cbcc2 100644 --- a/codec/hal/include/codec_config_parser.h +++ b/codec/hal/include/codec_config_parser.h @@ -52,6 +52,10 @@ #define CODEC_CONFIG_KEY_SUPPORT_PIXEL_FMTS "supportPixelFmts" #define CODEC_CONFIG_KEY_BLOCK_SIZE_WIDTH "blockSizeWidth" #define CODEC_CONFIG_KEY_BLOCK_SIZE_HEIGHT "blockSizeHeight" +#define CODEC_CONFIG_KEY_MIN_FRAME_RATE "minFrameRate" +#define CODEC_CONFIG_KEY_MAX_FRAME_RATE "maxFrameRate" +#define CODEC_CONFIG_KEY_BITE_RATE_MODE "bitRateMode" +#define CODEC_CONFIG_KEY_MESURED_FRAME_RATE "measuredFrameRate" #define CODEC_CONFIG_KEY_SAMPLE_FORMATS "sampleFormats" #define CODEC_CONFIG_KEY_SAMPLE_RATE "sampleRate" diff --git a/codec/hal/src/codec_config_parser.c b/codec/hal/src/codec_config_parser.c index 675dd7da384000e570ceec70a440db081ab4b07c..8f4f8c72f80ecacbe00579f38732897a4546fcd2 100644 --- a/codec/hal/src/codec_config_parser.c +++ b/codec/hal/src/codec_config_parser.c @@ -137,7 +137,9 @@ static int32_t GetVideoPortCapability(const struct DeviceResourceIface *iface, {CODEC_CONFIG_KEY_MIN_BLOCKS_PER_SECOND, (uint32_t*)&cap->port.video.blocksPerSecond.min, 0}, {CODEC_CONFIG_KEY_MAX_BLOCKS_PER_SECOND, (uint32_t*)&cap->port.video.blocksPerSecond.max, 0}, {CODEC_CONFIG_KEY_BLOCK_SIZE_WIDTH, (uint32_t*)&cap->port.video.blockSize.width, 0}, - {CODEC_CONFIG_KEY_BLOCK_SIZE_HEIGHT, (uint32_t*)&cap->port.video.blockSize.height, 0} + {CODEC_CONFIG_KEY_BLOCK_SIZE_HEIGHT, (uint32_t*)&cap->port.video.blockSize.height, 0}, + {CODEC_CONFIG_KEY_MIN_FRAME_RATE, (uint32_t *)&cap->port.video.frameRate.min, 0}, + {CODEC_CONFIG_KEY_MAX_FRAME_RATE, (uint32_t *)&cap->port.video.frameRate.max, 0} }; int32_t count = sizeof(nodeAttrs) / sizeof(ConfigUintNodeAttr); @@ -150,14 +152,21 @@ static int32_t GetVideoPortCapability(const struct DeviceResourceIface *iface, } } - ConfigUintArrayNodeAttr attr = {CODEC_CONFIG_KEY_SUPPORT_PIXEL_FMTS, - cap->port.video.supportPixFmts, PIX_FORMAT_NUM, OMX_COLOR_FormatUnused}; - if (GetUintTableConfig(iface, childNode, &attr) != HDF_SUCCESS) { - HDF_LOGE("%{public}s, failed to get %{public}s.%{public}s!", - __func__, childNode->name, CODEC_CONFIG_KEY_SUPPORT_PIXEL_FMTS); - return HDF_FAILURE; - } + ConfigUintArrayNodeAttr arrayAttrs[] = { + {CODEC_CONFIG_KEY_SUPPORT_PIXEL_FMTS, cap->port.video.supportPixFmts, PIX_FORMAT_NUM, OMX_COLOR_FormatUnused}, + {CODEC_CONFIG_KEY_BITE_RATE_MODE, (int32_t *)cap->port.video.bitRatemode, BIT_RATE_MODE_NUM, + BIT_RATE_MODE_INVALID}, + {CODEC_CONFIG_KEY_MESURED_FRAME_RATE, cap->port.video.measuredFrameRate, MEASURED_FRAME_RATE_NUM, 0} + }; + count = sizeof(arrayAttrs) / sizeof(ConfigUintArrayNodeAttr); + for (int32_t i = 0; i < count; i++) { + if (GetUintTableConfig(iface, childNode, &arrayAttrs[i]) != HDF_SUCCESS) { + HDF_LOGE("%{public}s, failed to get %{public}s.%{public}s!", __func__, childNode->name, + nodeAttrs[i].attrName); + return HDF_FAILURE; + } + } return HDF_SUCCESS; } diff --git a/codec/interfaces/include/codec_component_type.h b/codec/interfaces/include/codec_component_type.h index bb2f229eb8dbf9a4f0fde3c10278874b0bb9e0b8..f7f50676730f195a047010b43d11a4c9a8280a1c 100644 --- a/codec/interfaces/include/codec_component_type.h +++ b/codec/interfaces/include/codec_component_type.h @@ -118,6 +118,23 @@ typedef enum { * @brief Defines the video encoding and decoding capabilities. */ #define PIX_FORMAT_NUM 16 /** Size of the supported pixel format array */ +#define BIT_RATE_MODE_NUM 5 /* Size of the array bit rate mode. */ +#define MEASURED_FRAME_RATE_NUM 32 /* Size of the array measured frame rate. */ + +typedef enum { + BIT_RATE_MODE_INVALID, + /** Variable Bit Rate. */ + BIT_RATE_MODE_VBR, + /* Constant Bit Rate. */ + BIT_RATE_MODE_CBR, + /* Constant Quality. */ + BIT_RATE_MODE_CQ, + /* Constrained VariableBit Rate. */ + BIT_RATE_MODE_VCBR, + /* Average Bit Rate. */ + BIT_RATE_MODE_ABR, +} BitRateMode; + typedef struct { Rect minSize; /** Minimum resolution supported. */ Rect maxSize; /** Maximum resolution supported. */ @@ -127,6 +144,9 @@ typedef struct { Rect blockSize; /** Block size supported. */ int32_t supportPixFmts[PIX_FORMAT_NUM]; /** Supported pixel format. For details, see {@link OMX_COLOR_FORMATTYPE}. */ + BitRateMode bitRatemode[BIT_RATE_MODE_NUM]; /* Bit Rate Mode. For details, see {@link BitRateMode}. */ + RangeValue frameRate; /* Frame Rate. */ + int32_t measuredFrameRate[MEASURED_FRAME_RATE_NUM]; /* Measured Frame Rate. */ } VideoPortCap; /**