openharmony 鸿蒙 capi-native-avcapability-h

2026-08-25 浏览 (1)

native_avcapability.h

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

Nametypedef KeywordDescription
OH_AVRangeOH_AVRangeDescribes the value range, which contains the minimum value and maximum value.
OH_AVCapabilityOH_AVCapabilityDescribes a native object for the OH_AVCapability interface.

Enums

Nametypedef KeywordDescription
OH_AVCodecCategoryOH_AVCodecCategoryEnumerates the codec categories.
OH_AVCapabilityFeatureOH_AVCapabilityFeatureEnumerates the optional features that can be used in specific codec scenarios.

Functions

NameDescription
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.
bool OH_AVCapability_IsHardware(OH_AVCapability *capability)Checks whether a codec capability instance describes a hardware codec.
const char *OH_AVCapability_GetName(OH_AVCapability *capability)Obtains the codec name.
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

enum OH_AVCodecCategory

Description

Enumerates the codec categories.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
HARDWARE = 0Hardware codec.
SOFTWARESoftware codec.

OH_AVCapabilityFeature

enum OH_AVCapabilityFeature

Description

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

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

ValueDescription
VIDEO_ENCODER_TEMPORAL_SCALABILITY = 0Temporal scalability feature, which is available only in video encoding scenarios.
VIDEO_ENCODER_LONG_TERM_REFERENCE = 1Long-term reference frame feature, which is available only in video encoding scenarios.
VIDEO_LOW_LATENCY = 2Low latency feature, which is available only in video decoding scenarios.
VIDEO_ENCODER_B_FRAME = 7B-frame encoding feature, which is available only in video encoding scenarios.
Since: 20

Function Description

OH_AVCodec_GetCapability()

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

NameDescription
const char *mimePointer to a string that describes the MIME type. For details, see AVCODEC_MIME_TYPE.
bool isEncoderWhether the instance is an encoder. The value true means an encoder and false means a decoder.

Returns

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

OH_AVCodec_GetCapabilityByCategory()

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

NameDescription
const char *mimePointer to a string that describes the MIME type. For details, see AVCODEC_MIME_TYPE.
bool isEncoderWhether the instance is an encoder. The value true means an encoder and false means a decoder.
OH_AVCodecCategory categoryCodec category.

Returns

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

OH_AVCapability_IsHardware()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.

Returns

TypeDescription
boolCheck result for whether the codec capability instance describes a hardware codec. true if it describes a hardware codec, false otherwise.

OH_AVCapability_GetName()

const char *OH_AVCapability_GetName(OH_AVCapability *capability)

Description

Obtains the codec name.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Parameters

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.

Returns

TypeDescription
const char *Codec name string.

OH_AVCapability_GetMaxSupportedInstances()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.

Returns

TypeDescription
int32_tMaximum number of codec instances supported.

OH_AVCapability_GetEncoderBitrateRange()

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

NameDescription
OH_AVCapability *capabilityPointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *bitrateRangePointer to the bit rate range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_BitrateMode bitrateModeBit rate mode.

Returns

TypeDescription
boolCheck result for the support of the bit rate mode. true if supported, false otherwise.

OH_AVCapability_GetEncoderQualityRange()

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

NameDescription
OH_AVCapability *capabilityPointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *qualityRangePointer to the quality range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the encoder capability. If a pointer to the decoder capability is provided, undefined behavior occurs.
OH_AVRange *complexityRangePointer to the complexity range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
const int32_t **sampleRatesDouble pointer to the sample rate array.
uint32_t *sampleRateNumPointer to the number of elements in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
OH_AVRange **sampleRateRangesDouble pointer to the sample rate range array.
uint32_t *rangesNumPointer to the number of elements in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the audio codec capability. If a pointer to the video codec capability is provided, undefined behavior occurs.
OH_AVRange *channelCountRangePointer to the count range of audio channels supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t *widthAlignmentPointer to the video width alignment supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t *heightAlignmentPointer to the video height alignment supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t heightNumber of vertical video pixels.
OH_AVRange *widthRangePointer to the video width range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t widthNumber of horizontal video pixels.
OH_AVRange *heightRangePointer to the video height range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *widthRangePointer to the video width range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *heightRangePointer to the video height range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t widthNumber of horizontal video pixels.
int32_t heightNumber of vertical video pixels.

Returns

TypeDescription
boolCheck result for the support of the video size. true if supported, false otherwise.

OH_AVCapability_GetVideoFrameRateRange()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
OH_AVRange *frameRateRangePointer to the video frame rate range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t widthNumber of horizontal video pixels.
int32_t heightNumber of vertical video pixels.
OH_AVRange *frameRateRangePointer to the video frame rate range supported.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
int32_t widthNumber of horizontal video pixels.
int32_t heightNumber of vertical video pixels.
int32_t frameRateNumber of frames per second.

Returns

TypeDescription
boolCheck result for the support of the combination of the video size and frame rate. true if supported, false otherwise.

OH_AVCapability_GetVideoSupportedPixelFormats()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability. If a pointer to the audio codec capability is provided, undefined behavior occurs.
const int32_t **pixelFormatsDouble pointer to the video pixel format array.
uint32_t *pixelFormatNumPointer to the number of elements in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the video codec capability.
const OH_NativeBuffer_Format **nativeBufferFormatsDouble pointer to the OH_NativeBuffer_Format array.
uint32_t *nativeBufferFormatNumPointer to the number of elements in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.
const int32_t **profilesDouble pointer to the profile array.
uint32_t *profileNumPointer to the number of profiles in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.
int32_t profileCodec profile.
const int32_t **levelsDouble pointer to the codec level array.
uint32_t *levelNumPointer to the number of elements in the array.

Returns

TypeDescription
OH_AVErrCodeAV_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()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.
int32_t profileCodec profile.
int32_t levelLevel of the codec.

Returns

TypeDescription
boolCheck result for the support of the combination of the profile and level. true if supported, false otherwise.

OH_AVCapability_IsFeatureSupported()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.
OH_AVCapabilityFeature featureCodec feature.

Returns

TypeDescription
boolCheck result for the feature. true if supported, false otherwise.

OH_AVCapability_GetFeatureProperties()

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

NameDescription
OH_AVCapability *capabilityPointer to the codec capability.
OH_AVCapabilityFeature featureCodec feature.

Returns

TypeDescription
OH_AVFormat *Pointer to an OH_AVFormat instance.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-native-avcodec-audiocodec-h

openharmony 鸿蒙 capi-avsource-oh-avsource

openharmony 鸿蒙 capi-native-cencinfo-h

openharmony 鸿蒙 capi-avmuxer

openharmony 鸿蒙 capi-multimedia-drm-oh-avcencinfo

openharmony 鸿蒙 capi-native-avdemuxer-h

openharmony 鸿蒙 capi-media-types-h

openharmony 鸿蒙 capi-native-audio-channel-layout-h

openharmony 鸿蒙 capi-native-avbuffer-info-h

openharmony 鸿蒙 capi-codecbase-oh-avcodecasynccallback

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/PRGHGcUG