diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 1533b86665eb7e6fa58a765a11c5015b9f3e3368..40d01650473be26d535779ce2e614c921e8102ee 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -443,6 +443,14 @@ "first_introduced": "20", "name": "OH_MD_KEY_ENABLE_SYNC_MODE" }, + { + "first_introduced": "20", + "name": "OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAME" + }, + { + "first_introduced": "20", + "name": "OH_MD_KEY_VIDEO_ENCODER_MAX_B_FRAMES" + }, { "first_introduced": "10", "name": "OH_AVCodec_GetCapability" diff --git a/multimedia/av_codec/native_avcapability.h b/multimedia/av_codec/native_avcapability.h index dd17584d4298db54d9597ee18d3289351706aa43..07c94177ba44fae010b8e017fc67758881f06cb4 100644 --- a/multimedia/av_codec/native_avcapability.h +++ b/multimedia/av_codec/native_avcapability.h @@ -86,6 +86,10 @@ typedef enum OH_AVCapabilityFeature { VIDEO_ENCODER_LONG_TERM_REFERENCE = 1, /** Feature for codec supports low latency. It is used in video encoder and video decoder. */ VIDEO_LOW_LATENCY = 2, + /** Feature for codec supports B-frame encoding. It is only used in video encoder. + * @since 20 + */ + VIDEO_ENCODER_B_FRAME = 7, } OH_AVCapabilityFeature; /** diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index 0aa105bb4124276da8f7f363f059a543f92ce87e..28db7ca43af770e883fa926178cf32690ec35f54 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -1059,6 +1059,36 @@ extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER; * @since 18 */ extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT; +/** + * @brief Key to enable B-frame encoding, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise. + * + * This is an optional key that applies only to video encoder, default is 0.\n + * If enabled, the video encoder will use B-frame, the decode order will be different from the display order.\n + * For unsupported platforms, Configuring this key will have no effect.\n + * Platform capability can be checked via {@link OH_AVCapability_IsFeatureSupported} with + * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n + * It's only used in configuration phase.\n + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 20 +*/ +extern const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAME; + +/** + * @brief Key for describing the maximum B-frame count of video encoder, value type is int32_t. + * + * Note: This key is only for querying the capability of the codec currently. + * Usage specifications: + * 1. Check feature support via {@link OH_AVCapability_IsFeatureSupported} with + * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n + * 2. Obtain OH_AVFormat handle via {@link OH_AVCapability_GetFeatureProperties} with + * {@link OH_AVCapabilityFeature::VIDEO_ENCODER_B_FRAME}.\n + * 3. Get maximum B-frame count via {@link OH_AVFormat_GetIntValue} with this key.\n + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 20 +*/ +extern const char *OH_MD_KEY_VIDEO_ENCODER_MAX_B_FRAMES; /** * @brief Key to set the region of interest(ROI) as QpOffset-Rects, value type is string in the format * "Top1,Left1-Bottom1,Right1=Offset1;Top2,Left2-Bottom2,Right2=Offset2;". Each "Top,Left-Bottom,Right=Offset"