You can use either of the following methods to obtain the codec capability instance:
Method 1: Call OH_AVCodec_GetCapability to obtain the codec capability instance recommended by the system. The recommendation policy is the same as that of the OH_XXX_CreateByMime series APIs.
// Obtain an example of the recommended audio AAC decoder capability from the system OH_AVCapability *capability = OH_AVCodec_GetCapability(OH_AVCODEC_MIMETYPE_AUDIO_AAC, false);
Method 2: Call OH_AVCodec_GetCapabilityByCategory to obtain the codec capability instance of the specified software or hardware.
// Obtain an instance of video AVC encoder capability for the specified hardware OH_AVCapability *capability = OH_AVCodec_GetCapabilityByCategory(OH_AVCODEC_MIMETYPE_VIDEO_AVC, true, HARDWARE);
After the capability instance is obtained, continue to execute. Once the capability instance is obtained, you can proceed with the execution. The system automatically reclaims the OH_AVCapability instance. You do not need to worry about it.
Reference