We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesMediaAVCodec KitC APIsHeader Filesnative_avcapability.h

native_avcapability.h

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

Overview

The file declares the native APIs used to query the codec capability.

File to include: <multimedia/player_framework/native_avcapability.h>

Library: libnative_media_codecbase.so

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Related module: AVCapability

Summary

Structs

Expand
Name typedef Keyword Description
OH_AVRange OH_AVRange Describes the value range, which contains the minimum value and maximum value.
OH_AVCapability OH_AVCapability Describes a native object for the OH_AVCapability interface.

Enums

Expand
Name typedef Keyword Description
OH_AVCodecCategory OH_AVCodecCategory Enumerates the codec categories.
OH_AVCodecType OH_AVCodecType Codec type.
OH_AVCapabilityFeature OH_AVCapabilityFeature Enumerates the optional features that can be used in specific codec scenarios.

Functions

Expand
Name Description
OH_AVCapability *OH_AVCodec_GetCapability(const char *mime, bool isEncoder) Obtains the codec capability recommended by the system.
OH_AVCapability *OH_AVCodec_GetCapabilityByCategory(const char *mime, bool isEncoder, OH_AVCodecCategory category) Obtains the codec capability by category, which can be a hardware codec or software codec.
OH_AVCapability **OH_AVCodec_GetCapabilityList(OH_AVCodecType codecType, uint32_t *count) Obtains the list of capabilities for the specified codec type. This function retrieves all matching codec capabilities supported by the system based on the provided codec type.
bool OH_AVCapability_IsHardware(OH_AVCapability *capability) Checks whether a codec capability instance describes a hardware codec.
bool OH_AVCapability_IsSecure(OH_AVCapability *capability) Checks whether the capability instance describes a DRM decoder.
const char *OH_AVCapability_GetName(OH_AVCapability *capability) Obtains the corresponding codec name.
const char *OH_AVCapability_GetMimeType(OH_AVCapability *capability) Obtains the MIME type of the codec.
bool OH_AVCapability_CheckMimeType(OH_AVCapability *capability, const char *mimeType) Checks whether the MIME type of the codec matches the specified MIME type.
int32_t OH_AVCapability_GetMaxSupportedInstances(OH_AVCapability *capability) Obtains the maximum number of codec instances supported by a codec.
OH_AVErrCode OH_AVCapability_GetEncoderBitrateRange(OH_AVCapability *capability, OH_AVRange *bitrateRange) Obtains the bit rate range supported by an encoder.
bool OH_AVCapability_IsEncoderBitrateModeSupported(OH_AVCapability *capability, OH_BitrateMode bitrateMode) Checks whether an encoder supports a specific bit rate mode.
OH_AVErrCode OH_AVCapability_GetEncoderQualityRange(OH_AVCapability *capability, OH_AVRange *qualityRange) Obtains the quality range supported by an encoder.
OH_AVErrCode OH_AVCapability_GetEncoderComplexityRange(OH_AVCapability *capability, OH_AVRange *complexityRange) Obtains the complexity range supported by an encoder.
OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRates(OH_AVCapability *capability, const int32_t **sampleRates, uint32_t *sampleRateNum) Obtains the sample rates supported by an audio codec.
OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRateRanges(OH_AVCapability *capability, OH_AVRange **sampleRateRanges, uint32_t *rangesNum) Obtains the sample rate ranges supported by an audio codec.
OH_AVErrCode OH_AVCapability_GetAudioChannelCountRange(OH_AVCapability *capability, OH_AVRange *channelCountRange) Obtains the count range of audio channels supported by an audio codec.
OH_AVErrCode OH_AVCapability_GetVideoWidthAlignment(OH_AVCapability *capability, int32_t *widthAlignment) Obtains the video width alignment supported by a video codec.
OH_AVErrCode OH_AVCapability_GetVideoHeightAlignment(OH_AVCapability *capability, int32_t *heightAlignment) Obtains the video height alignment supported by a video codec.
OH_AVErrCode OH_AVCapability_GetVideoWidthRangeForHeight(OH_AVCapability *capability, int32_t height, OH_AVRange *widthRange) Obtains the video width range supported by a video codec based on a given height.
OH_AVErrCode OH_AVCapability_GetVideoHeightRangeForWidth(OH_AVCapability *capability, int32_t width, OH_AVRange *heightRange) Obtains the video height range supported by a video codec based on a given width.
OH_AVErrCode OH_AVCapability_GetVideoWidthRange(OH_AVCapability *capability, OH_AVRange *widthRange) Obtains the video width range supported by a video codec.
OH_AVErrCode OH_AVCapability_GetVideoHeightRange(OH_AVCapability *capability, OH_AVRange *heightRange) Obtains the video height range supported by a video codec.
bool OH_AVCapability_IsVideoSizeSupported(OH_AVCapability *capability, int32_t width, int32_t height) Checks whether a video codec supports a specific video size.
OH_AVErrCode OH_AVCapability_GetVideoFrameRateRange(OH_AVCapability *capability, OH_AVRange *frameRateRange) Obtains the video frame rate range supported by a video codec.
OH_AVErrCode OH_AVCapability_GetVideoFrameRateRangeForSize(OH_AVCapability *capability, int32_t width, int32_t height, OH_AVRange *frameRateRange) Obtains the video frame rate range supported by a video codec based on a given video size.
bool OH_AVCapability_AreVideoSizeAndFrameRateSupported(OH_AVCapability *capability, int32_t width, int32_t height, int32_t frameRate) Checks whether a video codec supports the combination of a video size and frame rate.
OH_AVErrCode OH_AVCapability_GetVideoSupportedPixelFormats(OH_AVCapability *capability, const int32_t **pixelFormats, uint32_t *pixelFormatNum) Obtains the video pixel formats supported by a video codec.
OH_AVErrCode OH_AVCapability_GetVideoSupportedNativeBufferFormats(OH_AVCapability *capability, const OH_NativeBuffer_Format **nativeBufferFormats, uint32_t *nativeBufferFormatNum) Obtains the OH_NativeBuffer formats supported by a video codec. This function provides the OH_NativeBuffer formats that can be processed by a video codec. For details, see OH_NativeBuffer_Format.
OH_AVErrCode OH_AVCapability_GetSupportedProfiles(OH_AVCapability *capability, const int32_t **profiles, uint32_t *profileNum) Obtains the profiles supported by a codec.
OH_AVErrCode OH_AVCapability_GetSupportedLevelsForProfile(OH_AVCapability *capability, int32_t profile, const int32_t **levels, uint32_t *levelNum) Obtains the codec levels supported by a profile.
bool OH_AVCapability_AreProfileAndLevelSupported(OH_AVCapability *capability, int32_t profile, int32_t level) Checks whether a codec supports the combination of a profile and level.
bool OH_AVCapability_IsFeatureSupported(OH_AVCapability *capability, OH_AVCapabilityFeature feature) Checks whether a codec supports a feature.
OH_AVFormat *OH_AVCapability_GetFeatureProperties(OH_AVCapability *capability, OH_AVCapabilityFeature feature) Obtains the properties of a feature. You must manually release the OH_AVFormat instance in the return value.

Enum Description

OH_AVCodecCategory

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
enum OH_AVCodecCategory

Description

Enumerates the codec categories.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Expand
Value Description
HARDWARE = 0 Hardware codec.
SOFTWARE Software codec.

OH_AVCodecType

Phone24+PC/2in124+Tablet24+TV24+Wearable24+
enum OH_AVCodecType

Description

Codec type.

Since: 24

Expand
Value Description
OH_AVCODEC_TYPE_VIDEO_ENCODER = 0

Video encoder.

Since: 24

OH_AVCODEC_TYPE_VIDEO_DECODER = 1

Video decoder.

Since: 24

OH_AVCODEC_TYPE_AUDIO_ENCODER = 2

Audio encoder.

Since: 24

OH_AVCODEC_TYPE_AUDIO_DECODER = 3

Audio decoder.

Since: 24

OH_AVCapabilityFeature

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
enum OH_AVCapabilityFeature

Description

Enumerates the optional features that can be used in specific codec scenarios.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

Expand
Value Description
VIDEO_ENCODER_TEMPORAL_SCALABILITY = 0 Temporal scalability feature, which is available only in video encoding scenarios.
VIDEO_ENCODER_LONG_TERM_REFERENCE = 1 Long-term reference frame feature, which is available only in video encoding scenarios.
VIDEO_LOW_LATENCY = 2 Low latency feature, which is available only in video decoding scenarios.
VIDEO_ENCODER_B_FRAME = 7

B-frame encoding feature, which is available only in video encoding scenarios.

Since: 20

VIDEO_DECODER_OUTPUT_IN_DECODING_ORDER = 8

Decoding-order frame output feature, which is available only in video decoding scenarios.

Since: 26.0.0

VIDEO_ENCODER_PREPROC_DOWNSAMPLING = 9

Downsampling feature before video encoding, which is available only for video encoders.

This capability can be enabled only when the encoder is created through the OH_VideoEncoder_CreatePrimaryWithPreproc or OH_VideoEncoder_CreateSecondaryFromPrimary API.

Since: 26.0.0

VIDEO_ENCODER_PREPROC_CROP = 10

Cropping feature before video encoding, which is available only for video encoders.

This capability can be enabled only when the encoder is created through the OH_VideoEncoder_CreatePrimaryWithPreproc or OH_VideoEncoder_CreateSecondaryFromPrimary API.

Since: 26.0.0

Function Description

OH_AVCodec_GetCapability()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVCapability *OH_AVCodec_GetCapability(const char *mime, bool isEncoder)

Description

Obtains the codec capability recommended by the system.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
const char *mime Pointer to a string that describes the MIME type. For details, see AVCODEC_MIME_TYPE variables.
bool isEncoder Whether the instance is an encoder. The value true means an encoder and false means a decoder.

Returns

Expand
Type Description
OH_AVCapability * Pointer to the codec capability instance. If no existing codec matches, NULL is returned.

OH_AVCodec_GetCapabilityByCategory()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVCapability *OH_AVCodec_GetCapabilityByCategory(const char *mime, bool isEncoder, OH_AVCodecCategory category)

Description

Obtains the codec capability by category, which can be a hardware codec or software codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
const char *mime Pointer to a string that describes the MIME type. For details, see AVCODEC_MIME_TYPE variables.
bool isEncoder Whether the instance is an encoder. The value true means an encoder and false means a decoder.
OH_AVCodecCategory category Codec category.

Returns

Expand
Type Description
OH_AVCapability * Pointer to the codec capability instance. If no existing codec matches, NULL is returned.

OH_AVCodec_GetCapabilityList()

Phone24+PC/2in124+Tablet24+TV24+Wearable24+
OH_AVCapability **OH_AVCodec_GetCapabilityList(OH_AVCodecType codecType, uint32_t *count)

Description

Obtains the list of capabilities for the specified codec type. This function retrieves all matching codec capabilities supported by the system based on the provided codec type.

NOTE

The memory for the codec capability list is globally maintained by the underlying system. Callers do not need to manage its lifecycle and must not manually allocate or free this memory.

Since: 24

Parameters

Expand
Name Description
OH_AVCodecType codecType Codec type to be queried.
uint32_t *count Pointer to a uint32_t variable for storing the number of matched codec capabilities.

Returns

Expand
Type Description
OH_AVCapability **

If a match is found, a pointer to an array of OH_AVCapability instances is returned.

If no matching codec is found or an error occurs, NULL is returned.

OH_AVCapability_IsHardware()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_IsHardware(OH_AVCapability *capability)

Description

Checks whether a codec capability instance describes a hardware codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.

Returns

Expand
Type Description
bool Check result for whether the codec capability instance describes a hardware codec. true if it describes a hardware codec, false otherwise.

OH_AVCapability_IsSecure()

Phone24+PC/2in124+Tablet24+TV24+Wearable24+
bool OH_AVCapability_IsSecure(OH_AVCapability *capability)

Description

Checks whether the capability instance describes a DRM decoder.

Since: 24

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.

Returns

Expand
Type Description
bool

If the capability instance describes a DRM decoder, true is returned.

If the capability instance does not describe a DRM decoder, false is returned.

OH_AVCapability_GetName()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
const char *OH_AVCapability_GetName(OH_AVCapability *capability)

Description

Obtains the corresponding codec name.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.

Returns

Expand
Type Description
const char * Codec name string.

OH_AVCapability_GetMimeType()

Phone24+PC/2in124+Tablet24+TV24+Wearable24+
const char *OH_AVCapability_GetMimeType(OH_AVCapability *capability)

Description

Obtains the MIME type of the codec.

Since: 24

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.

Returns

Expand
Type Description
const char * String indicating the MIME type of the codec.

OH_AVCapability_CheckMimeType()

Phone24+PC/2in124+Tablet24+TV24+Wearable24+
bool OH_AVCapability_CheckMimeType(OH_AVCapability *capability, const char *mimeType)

Description

Checks whether the MIME type of the codec matches the specified MIME type.

Since: 24

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
const char *mimeType Target MIME type string to be checked.

Returns

Expand
Type Description
bool If the MIME types match, true is returned. Otherwise, false is returned.

OH_AVCapability_GetMaxSupportedInstances()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
int32_t OH_AVCapability_GetMaxSupportedInstances(OH_AVCapability *capability)

Description

Obtains the maximum number of codec instances supported by a codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.

Returns

Expand
Type Description
int32_t Maximum number of codec instances supported.

OH_AVCapability_GetEncoderBitrateRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetEncoderBitrateRange(OH_AVCapability *capability, OH_AVRange *bitrateRange)

Description

Obtains the bit rate range supported by an encoder.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *bitrateRange Pointer to the bit rate range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the bit rate range is null.

OH_AVCapability_IsEncoderBitrateModeSupported()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_IsEncoderBitrateModeSupported(OH_AVCapability *capability, OH_BitrateMode bitrateMode)

Description

Checks whether an encoder supports a specific bit rate mode.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_BitrateMode bitrateMode Bit rate mode.

Returns

Expand
Type Description
bool Check result for the support of the bit rate mode. true if supported, false otherwise.

OH_AVCapability_GetEncoderQualityRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetEncoderQualityRange(OH_AVCapability *capability, OH_AVRange *qualityRange)

Description

Obtains the quality range supported by an encoder.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *qualityRange Pointer to the quality range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the quality range is null.

OH_AVCapability_GetEncoderComplexityRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetEncoderComplexityRange(OH_AVCapability *capability, OH_AVRange *complexityRange)

Description

Obtains the complexity range supported by an encoder.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *complexityRange Pointer to the complexity range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the complexity range is null.

OH_AVCapability_GetAudioSupportedSampleRates()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRates(OH_AVCapability *capability, const int32_t **sampleRates, uint32_t *sampleRateNum)

Description

Obtains the sample rates supported by an audio codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
const int32_t **sampleRates Double pointer to the sample rate array.
uint32_t *sampleRateNum Pointer to the number of elements in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the pointer to the sample rate array is null, or the pointer to the number of elements in the array is null.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_GetAudioSupportedSampleRateRanges()

Phone20+PC/2in120+Tablet20+TV20+Wearable20+
OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRateRanges(OH_AVCapability *capability, OH_AVRange **sampleRateRanges, uint32_t *rangesNum)

Description

Obtains the sample rate ranges supported by an audio codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 20

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
OH_AVRange **sampleRateRanges Double pointer to the sample rate range array.
uint32_t *rangesNum Pointer to the number of elements in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the pointer to the sample rate range array is null, or the pointer to the number of elements in the array is null.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_GetAudioChannelCountRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetAudioChannelCountRange(OH_AVCapability *capability, OH_AVRange *channelCountRange)

Description

Obtains the count range of audio channels supported by an audio codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
OH_AVRange *channelCountRange Pointer to the count range of audio channels supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the count range of audio channels is null.

OH_AVCapability_GetVideoWidthAlignment()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoWidthAlignment(OH_AVCapability *capability, int32_t *widthAlignment)

Description

Obtains the video width alignment supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t *widthAlignment Pointer to the video width alignment supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the video width alignment is null.

OH_AVCapability_GetVideoHeightAlignment()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoHeightAlignment(OH_AVCapability *capability, int32_t *heightAlignment)

Description

Obtains the video height alignment supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t *heightAlignment Pointer to the video height alignment supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the video height alignment is null.

OH_AVCapability_GetVideoWidthRangeForHeight()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoWidthRangeForHeight(OH_AVCapability *capability, int32_t height, OH_AVRange *widthRange)

Description

Obtains the video width range supported by a video codec based on a given height.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t height Number of vertical video pixels.
OH_AVRange *widthRange Pointer to the video width range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the height is not within the supported height range obtained through OH_AVCapability_GetVideoHeightRange, or the pointer to the width range is null.

OH_AVCapability_GetVideoHeightRangeForWidth()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoHeightRangeForWidth(OH_AVCapability *capability, int32_t width, OH_AVRange *heightRange)

Description

Obtains the video height range supported by a video codec based on a given width.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t width Number of horizontal video pixels.
OH_AVRange *heightRange Pointer to the video height range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the width is not within the supported width range obtained through OH_AVCapability_GetVideoWidthRange, or the pointer to the height range is null.

OH_AVCapability_GetVideoWidthRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoWidthRange(OH_AVCapability *capability, OH_AVRange *widthRange)

Description

Obtains the video width range supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *widthRange Pointer to the video width range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the video width range is null.

OH_AVCapability_GetVideoHeightRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoHeightRange(OH_AVCapability *capability, OH_AVRange *heightRange)

Description

Obtains the video height range supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *heightRange Pointer to the video height range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the video height range is null.

OH_AVCapability_IsVideoSizeSupported()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_IsVideoSizeSupported(OH_AVCapability *capability, int32_t width, int32_t height)

Description

Checks whether a video codec supports a specific video size.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t width Number of horizontal video pixels.
int32_t height Number of vertical video pixels.

Returns

Expand
Type Description
bool Check result for the support of the video size. true if supported, false otherwise.

OH_AVCapability_GetVideoFrameRateRange()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoFrameRateRange(OH_AVCapability *capability, OH_AVRange *frameRateRange)

Description

Obtains the video frame rate range supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *frameRateRange Pointer to the video frame rate range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid or the pointer to the video frame rate range is null.

OH_AVCapability_GetVideoFrameRateRangeForSize()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoFrameRateRangeForSize(OH_AVCapability *capability, int32_t width, int32_t height, OH_AVRange *frameRateRange)

Description

Obtains the video frame rate range supported by a video codec based on a given video size.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t width Number of horizontal video pixels.
int32_t height Number of vertical video pixels.
OH_AVRange *frameRateRange Pointer to the video frame rate range supported.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the combination of the width and height is not supported, or the pointer to the frame rate range is null.

OH_AVCapability_AreVideoSizeAndFrameRateSupported()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_AreVideoSizeAndFrameRateSupported(OH_AVCapability *capability, int32_t width, int32_t height, int32_t frameRate)

Description

Checks whether a video codec supports the combination of a video size and frame rate.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t width Number of horizontal video pixels.
int32_t height Number of vertical video pixels.
int32_t frameRate Number of frames per second.

Returns

Expand
Type Description
bool Check result for the support of the combination of the video size and frame rate. true if supported, false otherwise.

OH_AVCapability_GetVideoSupportedPixelFormats()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetVideoSupportedPixelFormats(OH_AVCapability *capability, const int32_t **pixelFormats, uint32_t *pixelFormatNum)

Description

Obtains the video pixel formats supported by a video codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
const int32_t **pixelFormats Output Parameter. Pointer to an array of video pixel formats. For details, see OH_AVPixelFormat.
uint32_t *pixelFormatNum Pointer to the number of elements in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the pointer to the video pixel format array is null, or the pointer to the number of elements in the array is null.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_GetVideoSupportedNativeBufferFormats()

Phone22+PC/2in122+Tablet22+TV22+Wearable22+
OH_AVErrCode OH_AVCapability_GetVideoSupportedNativeBufferFormats(OH_AVCapability *capability, const OH_NativeBuffer_Format **nativeBufferFormats, uint32_t *nativeBufferFormatNum)

Description

Obtains the OH_NativeBuffer formats supported by a video codec. This function provides the OH_NativeBuffer formats that can be processed by a video codec. For details, see OH_NativeBuffer_Format.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 22

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the video codec capability.
const OH_NativeBuffer_Format **nativeBufferFormats Double pointer to the OH_NativeBuffer_Format array.
uint32_t *nativeBufferFormatNum Pointer to the number of elements in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the capability instance is an audio codec capability, the pointer to the OH_NativeBuffer_Format array is nullptr,

or the pointer to the number of elements in the array is nullptr.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_GetSupportedProfiles()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetSupportedProfiles(OH_AVCapability *capability, const int32_t **profiles, uint32_t *profileNum)

Description

Obtains the profiles supported by a codec.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
const int32_t **profiles Output Parameter. Pointer to the profile array. For example, for H.264 profiles, see OH_AVCProfile.
uint32_t *profileNum Pointer to the number of profiles in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the pointer to the profile array is null, or the pointer to the number of elements in the array is null.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_GetSupportedLevelsForProfile()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVErrCode OH_AVCapability_GetSupportedLevelsForProfile(OH_AVCapability *capability, int32_t profile, const int32_t **levels, uint32_t *levelNum)

Description

Obtains the codec levels supported by a profile.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
int32_t profile Codec profile.
const int32_t **levels Output Parameter. Pointer to the level array. For example, for H.264 levels, see OH_AVCLevel.
uint32_t *levelNum Pointer to the number of elements in the array.

Returns

Expand
Type Description
OH_AVErrCode

AV_ERR_OK: The operation is successful.

AV_ERR_INVALID_VAL: The capability instance is invalid, the level is not in the supported level array obtained through OH_AVCapability_GetSupportedProfiles, the pointer to the level array is null, or the pointer to the number of elements in the array is null.

AV_ERR_UNKNOWN: An unknown error occurs.

AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVCapability_AreProfileAndLevelSupported()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_AreProfileAndLevelSupported(OH_AVCapability *capability, int32_t profile, int32_t level)

Description

Checks whether a codec supports the combination of a profile and level.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
int32_t profile Codec profile.
int32_t level Level of the codec.

Returns

Expand
Type Description
bool Check result for the support of the combination of the profile and level. true if supported, false otherwise.

OH_AVCapability_IsFeatureSupported()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
bool OH_AVCapability_IsFeatureSupported(OH_AVCapability *capability, OH_AVCapabilityFeature feature)

Description

Checks whether a codec supports a feature.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
OH_AVCapabilityFeature feature Codec feature.

Returns

Expand
Type Description
bool Check result for the feature. true if supported, false otherwise.

OH_AVCapability_GetFeatureProperties()

Phone12+PC/2in113+Tablet12+TV19+Wearable18+
OH_AVFormat *OH_AVCapability_GetFeatureProperties(OH_AVCapability *capability, OH_AVCapabilityFeature feature)

Description

Obtains the properties of a feature. You must manually release the OH_AVFormat instance in the return value.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

Parameters

Expand
Name Description
OH_AVCapability *capability Pointer to the codec capability.
OH_AVCapabilityFeature feature Codec feature.

Returns

Expand
Type Description
OH_AVFormat * Pointer to an OH_AVFormat instance.
Search in References
Enter a keyword.