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

2026-08-25 浏览 (1)

native_avcodec_base.h

Overview

The file declares the native APIs used for basic audio and video multiplexing, demultiplexing, encoding, and decoding.

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

Library: libnative_media_codecbase.so

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Related module: CodecBase

Sample: AVCodec

Summary

Structs

Nametypedef KeywordDescription
OH_AVCodecAsyncCallbackOH_AVCodecAsyncCallbackDescribes all the asynchronous callback function pointers of an OH_AVCodec instance. To ensure the normal running of OH_AVCodec, you must register the instance of this struct with the OH_AVCodec instance and process the information reported by the callback function. (It is deprecated from API version 11.)
OH_AVCodecCallbackOH_AVCodecCallbackDescribes all the asynchronous callback function pointers of an OH_AVCodec instance. To ensure the normal running of OH_AVCodec, you must register the instance of this struct with the OH_AVCodec instance and process the information reported by the callback function.
OH_AVDataSourceOH_AVDataSourceDescribes a user-defined data source.
OH_AVDataSourceExtOH_AVDataSourceExtDescribes a user-defined data source. User-defined data can be passed to its callback functions through the userData parameter.
NativeWindowOHNativeWindowDescribes a native object for the graphics interface.
OH_AVCodecOH_AVCodecDescribes a native object for the audio and video codec interface.

Enums

Nametypedef KeywordDescription
OH_MediaTypeOH_MediaTypeEnumerates the media types.
OH_AACProfileOH_AACProfileEnumerates the Advanced Audio Coding (AAC) profiles.
(AAC_PROFILE_HE and AAC_PROFILE_HE_V2 are not available yet.)
OH_AVCProfileOH_AVCProfileEnumerates the Advanced Video Coding (AVC) profiles.
OH_HEVCProfileOH_HEVCProfileEnumerates the High Efficiency Video Coding (HEVC) profiles.
OH_VVCProfileOH_VVCProfileEnumerates the VVC profiles.
OH_MPEG2ProfileOH_MPEG2ProfileEnumerates the MPEG2 profiles.
OH_MPEG4ProfileOH_MPEG4ProfileEnumerates the MPEG4 profiles.
OH_H263ProfileOH_H263ProfileEnumerates the H.263 profiles.
OH_VC1ProfileOH_VC1ProfileEnumerates the VC-1 profiles.
OH_AV1ProfileOH_AV1ProfileAV1 profile.
OH_VP9ProfileOH_VP9ProfileVP9 profile.
OH_WVC1ProfileOH_WVC1ProfileWVC1 profile.
OH_WMV3ProfileOH_WMV3ProfileEnumerates the WMV3 profiles.
OH_AVOutputFormatOH_AVOutputFormatEnumerates the output file formats supported by a muxer.
OH_AVSeekModeOH_AVSeekModeEnumerates the seek modes.
OH_ScalingModeOH_ScalingModeEnumerates the scaling modes. This enum is used only in surface mode. (It is deprecated from API version 14.)
OH_BitsPerSampleOH_BitsPerSampleEnumerates the number of audio bits for each coded sample.
OH_ColorPrimaryOH_ColorPrimaryEnumerates the primary colors. This enum is used for both encoding and decoding.
OH_TransferCharacteristicOH_TransferCharacteristicEnumerates the transfer characteristics. This enum is used for both encoding and decoding.
OH_MatrixCoefficientOH_MatrixCoefficientEnumerates the matrix coefficients. This enum is used for both encoding and decoding.
OH_AVCLevelOH_AVCLevelEnumerates the AVC levels.
OH_HEVCLevelOH_HEVCLevelEnumerates the HEVC levels.
OH_VVCLevelOH_VVCLevelEnumerates the VVC levels.
OH_MPEG2LevelOH_MPEG2LevelEnumerates the MPEG2 levels.
OH_MPEG4LevelOH_MPEG4LevelEnumerates the MPEG4 levels.
OH_H263LevelOH_H263LevelEnumerates the H.263 levels.
OH_VC1LevelOH_VC1LevelEnumerates the VC-1 levels.
OH_AV1LevelOH_AV1LevelAV1 level.
OH_VP9LevelOH_VP9LevelVP9 level.
OH_WVC1LevelOH_WVC1LevelWVC1 level.
OH_WMV3LevelOH_WMV3LevelEnumerates the WMV3 levels.
OH_TemporalGopReferenceModeOH_TemporalGopReferenceModeEnumerates the reference modes of temporal image groups.
OH_BitrateModeOH_BitrateModeEnumerates the bit rate modes of an encoder.

Functions

Nametypedef KeywordDescription
typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData)OH_AVCodecOnErrorDefines the pointer to the function that is called to report error information when an error occurs during the running of an OH_AVCodec instance.
typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData)OH_AVCodecOnStreamChangedDefines the pointer to the function that is called to report the new stream description when the resolution of the input video stream being decoded or the output video stream that has been encoded changes.
Starting from API version 15, this function pointer is called to report the new stream description when the stream sampling rate, number of audio channels, or audio sampling format changes during audio decoding. The decoding formats that can detect these changes include AAC, FLAC, MP3, and VORBIS.
Note that the lifecycle of the pointer to the OH_AVFormat instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.
typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)OH_AVCodecOnNeedInputDataDefines the pointer to the function that is called when new input data is required during the running of an OH_AVCodec instance. The function carries a buffer to fill in new input data. (It is deprecated from API version 11.)
typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData)OH_AVCodecOnNewOutputDataDefines the pointer to the function that is called when new output data is generated during the running of an OH_AVCodec instance. The function carries a buffer filled with new output data. Note that the lifecycle of the pointer to the OH_AVCodecBufferAttr instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called. (It is deprecated from API version 11.)
typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)OH_AVCodecOnNeedInputBufferDefines the pointer to the function that is called when new input data is required during the running of an OH_AVCodec instance. The function carries a buffer to fill in new input data.
typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)OH_AVCodecOnNewOutputBufferDefines the pointer to the function that is called when new output data is generated during the running of an OH_AVCodec instance. The function carries a buffer filled with new output data.
typedef int32_t (*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t pos)OH_AVDataSourceReadAtDefines a function pointer used to provide the capability of obtaining user-defined media data.
typedef int32_t (*OH_AVDataSourceReadAtExt)(OH_AVBuffer *data, int32_t length, int64_t pos, void *userData)OH_AVDataSourceReadAtExtDefines a function pointer used to provide the capability of obtaining user-defined media data.

Variables

NameDescription
const char * OH_AVCODEC_MIMETYPE_VIDEO_AVCPointer to the key that describes the MIME type of the AVC (H.264) video codec.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_AACPointer to the key that describes the MIME type of the AAC audio codec.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_FLACPointer to the key that describes the MIME type of the FLAC audio codec.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_VORBISPointer to the key that describes the MIME type of the Vorbis audio decoder.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_MPEGPointer to the key that describes the MIME type of the MP3 audio codec.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_HEVCPointer to the key that describes the MIME type of the HEVC (H.265) video codec.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG4Pointer to the key that describes the MIME type of the MPEG4 video encoder, which is used only for multiplexing MPEG4 video streams.
Since: 10
Deprecated from: 11
Substitute: OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2Pointer to the key that describes the MIME type of the MPEG4 Part 2 video codec.
Since: 17
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG2Pointer to the key that describes the MIME type of the MPEG2 video codec.
Since: 17
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_H263Pointer to the key that describes the MIME type of the H.263 video codec.
Since: 17
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_VC1Pointer to the key that describes the MIME type of the VC-1 video codec.
Since: 22
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_AV1MIME type of the AV1 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_VP9MIME type of the VP9 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_VP8MIME type of the VP8 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_RV30MIME type of the RV30 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_RV40MIME type of the RV40 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_WVC1MIME type of the WVC1 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_DVVIDEOMIME type of the DVVIDEO (Digital Video) video codec. Supports DV NTSC, DV PAL, and DVCPRO HD.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_RAWVIDEOMIME type of the RAWVIDEO video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG1MIME type of the MPEG1 video codec.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_CINEPAKMIME type of the Cinepak video codec.
Since: 24
const char * OH_AVCODEC_MIMETYPE_VIDEO_MSVIDEO1Pointer to the key that describes the MIME type of the Microsoft Video 1 (MSVIDEO1) video codec.
Since: 22
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_WMV3Pointer to the key that describes the MIME type of the WMV3 video codec.
Since: 22
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_VIDEO_MJPEGPointer to the key that describes the MIME type of the Motion JPEG (MJPEG) video codec.
Since: 22
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_IMAGE_JPGPointer to the key that describes the MIME type of the JPG image encoder, which is used only for multiplexing JPG covers.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_IMAGE_PNGPointer to the key that describes the MIME type of the PNG image encoder, which is used only for multiplexing PNG covers.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_IMAGE_BMPPointer to the key that describes the MIME type of the BMP image encoder, which is used only for multiplexing BMP covers.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_VIVIDPointer to the key that describes the MIME type of the Audio Vivid audio decoder. (This specification is not available yet.)
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_NBPointer to the key that describes the MIME type of the AMR-NB audio decoder.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_WBPointer to the key that describes the MIME type of the AMR-WB audio decoder.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_OPUSPointer to the key that describes the MIME type of the Opus audio codec. (This specification is not available yet.)
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_G711MUPointer to the key that describes the MIME type of the G.711 mu-law audio codec.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_ALACPointer to the key that describes the MIME type of the Apple Lossless Audio Codec (ALAC) audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_AC3Pointer to the key that describes the MIME type of the Dolby Audio Coding 3 (AC 3) audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_EAC3Pointer to the key that describes the MIME type of the Enhanced AC-3 (EAC3) audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_WMAV1Pointer to the key that describes the MIME type of the Windows Media Audio (WMA) V1 audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_WMAV2Pointer to the key that describes the MIME type of the WMA V2 audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_WMAPROPointer to the key that describes the MIME type of the WMA Pro audio decoder.
Since: 22
const char * OH_MD_KEY_BLOCK_ALIGNSize of the audio data block, in bytes. The value type is int32_t. This key is used only for WMA (V1, V2, and PRO) decoders.
The allowed MIME types include OH_AVCODEC_MIMETYPE_AUDIO_WMAV1, OH_AVCODEC_MIMETYPE_AUDIO_WMAV2, and OH_AVCODEC_MIMETYPE_AUDIO_WMAPRO.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_GSMPointer to the key that describes the MIME type of the Global System for Mobile Communications (GSM) audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_GSM_MSPointer to the key that describes the MIME type of the GSM Microsoft variant (MS) audio decoder.
Since: 22
const char * OH_AVCODEC_MIMETYPE_AUDIO_TWINVQPointer to the key that describes the MIME type of the Transform-domain Weighted Interleave Vector Quantization (TWINVQ) audio decoder.
Since: 23
const char * OH_AVCODEC_MIMETYPE_AUDIO_ILBCPointer to the key that describes the MIME type of the Internet Low Bitrate Codec (ILBC) audio decoder.
Since: 23
const char * OH_AVCODEC_MIMETYPE_AUDIO_TRUEHDPointer to the key that describes the MIME type of the True High Definition (TRUEHD) audio decoder.
Since: 23
const char * OH_AVCODEC_MIMETYPE_VIDEO_VVCPointer to the key that describes the MIME type of the VVC (H.266) video codec.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_APEPointer to the key that describes the MIME type of the APE audio decoder.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_SUBTITLE_SRTPointer to the key that describes the MIME type of the SRT subtitle demuxer.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTTPointer to the key that describes the MIME type of the WEBVTT subtitle demuxer.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_RAWPointer to the key that describes the MIME type of raw audio streams.
Since: 18
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_G711APointer to the key that describes the MIME type of the G.711 a-law audio decoder.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_COOKMIME type of the Cook (RealAudio Cook) audio decoder.
Since: 23
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_DTSMIME type of the DTS (Digital Theater Systems) audio decoder.
Since: 23
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_AVCODEC_MIMETYPE_AUDIO_DVAUDIOMIME type of the DVAUDIO (Digital Video Audio) audio decoder.
Since: 23
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_ED_KEY_TIME_STAMPPointer to the key that describes the surface buffer timestamp. The value is of the int64_t type.
Since: 9
Deprecated from: 14
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_ED_KEY_EOSPointer to the key that describes the end of stream for the surface buffer. The value type is int32_t.
Since: 9
Deprecated from: 14
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRACK_TYPEPointer to the key that describes the track type in a media file. The value type is int32_t. For details, see OH_MediaType.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_CODEC_MIMEPointer to the key that describes the MIME type of the codec. The value type is char *.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_DURATIONPointer to the key that describes the duration in a media file, in microseconds. The value type is int64_t.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_BITRATEPointer to the key that describes the bit rate. The value type is int64_t. You can call OH_AVCapability_GetEncoderBitrateRange to obtain the value range.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_MAX_INPUT_SIZEPointer to the key that describes the maximum size of an input stream to decode. The value type is int32_t.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_WIDTHPointer to the key that describes the video width. The value type is int32_t.
This key is used to set the display width of a video frame when Configure is called during video encoding and decoding. You can call OH_AVCapability_GetVideoWidthRange to obtain the value range.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_HEIGHTPointer to the key that describes the video height. The value type is int32_t.
This key is used to set the display height of a video frame when Configure is called during video encoding and decoding. You can call OH_AVCapability_GetVideoHeightRange to obtain the value range.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_PIXEL_FORMATPointer to the key that describes the video pixel format. The value type is int32_t. For details, see OH_AVPixelFormat.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUDIO_SAMPLE_FORMATPointer to the key that describes the original audio format. The value type is int32_t. For details, see OH_BitsPerSample.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_FRAME_RATEPointer to the key that describes the video frame rate. The value type is double. The value must be greater than 0. You can call OH_AVCapability_GetVideoFrameRateRange to obtain the value range.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODEPointer to the key that describes the video encoding bit rate mode. The value type is int32_t. For details, see OH_BitrateMode.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_PROFILEPointer to the key that describes the encoding grading. The value type is int32_t. For details, see OH_AVCProfile, OH_HEVCProfile, and OH_AACProfile. You can call OH_AVCapability_GetSupportedProfiles to obtain the supported profiles.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUD_CHANNEL_COUNTPointer to the key that describes the number of audio channels. The value type is int32_t.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUD_SAMPLE_RATEPointer to the key that describes the audio sampling rate. The value type is int32_t.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_I_FRAME_INTERVALPointer to the key that describes the key frame interval, in milliseconds. The value type is int32_t. This key is optional and is used only for video encoding.
A negative value means that only the first frame is a keyframe. The value 0 means that all frames are keyframes. A positive value means one keyframe every (frameRate * value)/1000 frames. The default value is 1000.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ROTATIONPointer to the key that describes the rotation angle of the surface, with a clockwise direction. The value type is int32_t, and the value range is {0, 90, 180, 270}. The default value is 0.
This key is optional and is used only for video decoding in surface mode
You are advised to use the OH_MD_KEY_VIDEO_TRANSFORM_TYPE key to set the rotation angle of the surface for video decoding.
Since: 9
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_TRANSFORM_TYPEPointer to the key that describes the video rotation angle. The value type is int32_t. For details, see OH_NativeBuffer_TransformType.
This key is used to set the rotation angle of the surface for video decoding. The default value is 0 (NATIVEBUFFER_ROTATE_NONE).
This key is mutually exclusive with OH_MD_KEY_ROTATION. If both of them are set, OH_MD_KEY_VIDEO_TRANSFORM_TYPE is used. OH_MD_KEY_VIDEO_TRANSFORM_TYPE is recommended.
Note: The angle specified in OH_NativeBuffer_TransformType indicates a counter-clockwise rotation, which is opposite to the rotation direction defined by OH_MD_KEY_ROTATION.
The mapping is as follows.
- NATIVEBUFFER_ROTATE_NONE is equivalent to OH_MD_KEY_ROTATION = 0.
- NATIVEBUFFER_ROTATE_90 is equivalent to OH_MD_KEY_ROTATION = 270.
- NATIVEBUFFER_ROTATE_180 is equivalent to OH_MD_KEY_ROTATION = 180.
- NATIVEBUFFER_ROTATE_270 is equivalent to OH_MD_KEY_ROTATION = 90.

Since: 22
const char * OH_MD_KEY_RANGE_FLAGPointer to the key that describes the video YUV value range flag. The value type is int32_t. The value 1 means a full range, and 0 means a limited range. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_COLOR_PRIMARIESPointer to the key that describes the video primary colors. The value type is int32_t. The default value is COLOR_PRIMARY_UNSPECIFIED. For details, see OH_ColorPrimary. The value complies with Table 2 in H.273.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRANSFER_CHARACTERISTICSPointer to the key that describes the video transfer characteristics. The value type is int32_t. The default value is TRANSFER_CHARACTERISTIC_UNSPECIFIED. For details, see OH_TransferCharacteristic. The value complies with Table 3 in H.273.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_MATRIX_COEFFICIENTSPointer to the key that describes the video matrix coefficients. The value type is int32_t. The default value is MATRIX_COEFFICIENT_UNSPECIFIED. For details, see OH_MatrixCoefficient. The value must comply with Table 4 in H.273.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_REQUEST_I_FRAMEPointer to the key that describes the request for immediate encoding of I-frames. The value type is int32_t. This key is used in OH_VideoEncoder_SetParameter or takes effect immediately with each frame.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_QUALITYPointer to the key that describes the required encoding quality. The value type is int32_t. The default value is 50. In H.264 and H.265 encoding scenarios, the value range can be obtained by calling OH_AVCapability_GetEncoderQualityRange. This key applies only to the encoder in constant quality mode.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_CODEC_CONFIGPointer to the key that describes the codec-specific data. In the case of video, data carried in SPS/PPS is transferred. In the case of audio, data carried in extraData is transferred. The value type is uint8_t*. (This key is not supported yet for the video codec.)
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TITLEPointer to the key that describes the title of a media file . The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ARTISTPointer to the key that describes the artist in a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ALBUMPointer to the key that describes the album media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ALBUM_ARTISTPointer to the key that describes the album artist. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_DATEPointer to the key that describes the date of a media file, for example, 2024. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_COMMENTPointer to the key that describes the comment of a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ENABLE_MOOV_FRONTPointer to the key that specifies whether the moov metadata should be at the front of a media file. The value type is int32_t. The value 1 indicates that the moov metadata should be at the front of a media file, and 0 indicates that the moov metadata should not be at the front of a media file. The default value is 0.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_GENREPointer to the key that describes the genre in a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_COPYRIGHTPointer to the key that describes the copyright of a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_LANGUAGEPointer to the key that describes language of a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_DESCRIPTIONPointer to the key that describes the description of a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_LYRICSPointer to the key that describes the lyrics in a media file. The value type is char *.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRACK_COUNTPointer to the key that describes the number of tracks in a media file. The value type is int32_t.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_CHANNEL_LAYOUTPointer to the key that describes the required encoding channel layout. The value type is int64_t. This key applies only to encoders. For details, see OH_AudioChannelLayout.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_BITS_PER_CODED_SAMPLEPointer to the key that describes the number of bits per sample. The value type is int32_t.
In versions earlier than API version 20, this parameter must be set to 1 for FLAC encoding. Otherwise, OH_AudioCodec_Configure returns the error code AV_ERR_INVALID_VAL. However, this parameter has no actual effect and does not affect the encoding result.
Starting from API version 20, you do not need to set it anymore.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AAC_IS_ADTSPointer to the key that describes the AAC format, which can be ADTS or LATM. The value type is int32_t. The value 0 means the LATM format, and 1 means the ADTS format. This key is supported by AAC decoders.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_SBRPointer to the key that describes the AAC SBR format. The value type is int32_t. This key applies to AAC encoders.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_COMPLIANCE_LEVELPointer to the key that describes the FLAC compliance level. The value type is int32_t. This key is used only for audio encoding.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_IDENTIFICATION_HEADERPointer to the key that describes the vorbis identification header. The value type is uint8_t*. This key applies only to Vorbis decoders.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_SETUP_HEADERPointer to the key that describes the vorbis setup header. The value type is uint8_t*. This key applies only to Vorbis decoders.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_SCALING_MODEPointer to the key that describes the video scaling mode. The value type is int32_t. For details, see OH_ScalingMode.
You are advised to set the scaling mode by calling OH_NativeWindow_NativeWindowSetScalingModeV2. This key is optional and is used only for video decoding in surface mode.
Since: 10
Deprecated from: 14
Substitute: OH_NativeWindow_NativeWindowSetScalingModeV2
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_MAX_INPUT_BUFFER_COUNTPointer to the key that describes the maximum number of input buffers. The value type is int32_t.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_MAX_OUTPUT_BUFFER_COUNTPointer to the key that describes the maximum number of output buffers. The value type is int32_t.
Since: 10
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUDIO_COMPRESSION_LEVELPointer to the key that describes the audio codec compression level. The value type is int32_t type. This key is used only for audio encoding.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_IS_HDR_VIVIDPointer to the key that specifies whether the video track in a media file is HDR Vivid. The value type is int32_t. This key is used for both multiplexing and demultiplexing.
The value 1 means the HDR Vivid video track, and 0 means other cases.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUDIO_OBJECT_NUMBERPointer to the key that describes the number of audio objects. The value type is int32_t. This key is used only for Audio Vivid decoding.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_AUDIO_VIVID_METADATAPointer to the key that describes the Audio Vivid metadata. The value type is uint8_t*. This key is used only for Audio Vivid decoding.
Since: 11
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNTPointer to the key that describes the maximum number of long-term reference (LTR) frames obtained during video encoding. The value type is int32_t.
You can use the API OH_AVCapability_GetFeatureProperties and the enumerated value VIDEO_ENCODER_LONG_TERM_REFERENCE in OH_AVCapabilityFeature to query the maximum number.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITYPointer to the key that describes the enabled status of temporal scalability. The value type is int32_t. 1 if enabled, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
You can use the API OH_AVCapability_IsFeatureSupported and the enumerated value VIDEO_ENCODER_TEMPORAL_SCALABILITY in OH_AVCapabilityFeature to check whether the current video encoder supports temporal scalability.
For details, see Temporally Scalable Video Coding.
This key is optional and used only in the configuration phase of video encoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZEPointer to the key that describes the size of a temporal image group. The value type is int32_t. This key is valid only when temporal scalability is enabled.
This key is optional and used only in the configuration phase of video encoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODEPointer to the key that describes the reference mode in a temporal image group. The value type is int32_t. For details, see OH_TemporalGopReferenceMode. This key is valid only when temporal scalability is enabled.
This key is optional and used only in the configuration phase of video encoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNTPointer to the key that describes the number of LTR frames. The value type is int32_t. The value must be within the supported value range.
Before using this key, you can use the API OH_AVCapability_GetFeatureProperties and the enumerated value VIDEO_ENCODER_LONG_TERM_REFERENCE in OH_AVCapabilityFeature to query the number of supported LTR frames.
This key is optional and used only in the configuration phase of video encoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTRPointer to the key that specifies whether the current frame is marked as an LTR frame. The value type is int32_t. 1 if marked, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
This key takes effect only after the number of LTR frames is configured.
This key is optional and is used only for video encoding input rotation. The configuration takes effect immediately.
For details, see Temporally Scalable Video Coding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTRPointer to the key that describes the POC number of the LTR frame referenced by the current frame. The value type is int32_t.
This key is optional and is used only for video encoding input rotation. The configuration takes effect immediately.
For details, see Temporally Scalable Video Coding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_PER_FRAME_IS_LTRPointer to the key that specifies whether the frame corresponding to the stream output from the current OH_AVBuffer is marked as an LTR frame. The value type is int32_t. 1 if marked, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
This key is optional and is used only for video encoding output rotation.
It indicates the attribute of a frame.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_PER_FRAME_POCPointer to the key that describes the POC of the frame. The value type is int32_t.
This key is optional and is used only for video encoding output rotation.
It indicates the attribute of a frame.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_CROP_TOPPointer to the key that describes the top coordinate (y) of the cropped rectangle. The value type is int32_t.
The row at the top of the cropped rectangle is contained, and the row index starts from 0.
This key is used only for video decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_CROP_BOTTOMPointer to the key that describes the bottom coordinate (y) of the cropped rectangle. The value type is int32_t.
The row at the bottom of the cropped rectangle is contained, and the row index starts from 0.
This key is used only for video decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_CROP_LEFTPointer to the key that describes the left coordinate (x) of the cropped rectangle. The value type is int32_t.
The leftmost column of the cropped rectangle is contained, and the column index starts from 0.
This key is used only for video decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_CROP_RIGHTPointer to the key that describes the right coordinate (x) of the cropped rectangle. The value type is int32_t.
The rightmost column of the cropped rectangle is contained, and the column index starts from 0.
This key is used only for video decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_STRIDEPointer to the key that describes the stride of the video frame. The value type is int32_t.
The stride is the difference between the index of the pixel and the index of the pixel right below.
For the YUV420 format, the stride corresponds to the Y plane. The stride of the U/V plane can be calculated based on the color format, but it is usually not defined and depends on the device and version.
For details, see step 3 in buffer mode in Video Encoding.
For details about the image arrangement and usage examples of width, height, wStride, and hStride, see step 8 in buffer mode in Video Encoding or step 11 in buffer mode in Video Decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_SLICE_HEIGHTPointer to the key that describes the height of the video frame. The value type is int32_t.
The height is the number of rows that must be offset from the top of the Y plane to the top of the U plane. Essentially, the offset of the U plane is sliceHeight * stride.
The height of the U/V plane can be calculated based on the color format, but it is usually not defined and depends on the device and version.
For details, see step 3 in buffer mode in Video Encoding.
For details about the image arrangement and usage examples of width, height, wStride, and hStride, see step 8 in buffer mode in Video Encoding or step 11 in buffer mode in Video Decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_PIC_WIDTHPointer to the key that describes the width of the video frame. The value type is int32_t.
When OH_VideoDecoder_GetOutputDescription is called during video decoding, the width can be parsed from the returned OH_AVFormat instance.
When the decoded output stream changes, the width can be parsed from the OH_AVFormat instance returned by OH_AVCodecOnStreamChanged.
The width and height parsed from the OH_AVFormat instance are aligned, which are different from OH_MD_KEY_WIDTH and OH_MD_KEY_HEIGHT set by calling Configure.
For details about the image arrangement and usage examples of width, height, wStride, and hStride, see step 8 in buffer mode in Video Encoding or step 11 in buffer mode in Video Decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_PIC_HEIGHTPointer to the key that describes the height of the video frame. The value type is int32_t.
When OH_VideoDecoder_GetOutputDescription is called during video decoding, the height can be parsed from the returned OH_AVFormat instance.
When the decoded output stream changes, the height can be parsed from the OH_AVFormat instance returned by OH_AVCodecOnStreamChanged.
The width and height parsed from the OH_AVFormat instance are aligned, which are different from OH_MD_KEY_WIDTH and OH_MD_KEY_HEIGHT set by calling Configure.
For details about the image arrangement and usage examples of width, height, wStride, and hStride, see step 8 in buffer mode in Video Encoding or step 11 in buffer mode in Video Decoding.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCYPointer to the key that describes the enabled status of low-latency video decoding. The value type is int32_t. 1 if enabled, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
This key is optional and used only in the configuration phase.
If enabled, the input and output data held by the video decoder does not exceed the amount required by the decoder standard.
You can call OH_AVCapability_IsFeatureSupported to check whether a specific decoder supports low-latency decoding. If supported, the video decoder outputs frames in the decoding sequence when low-latency video codec is enabled.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_QP_MAXPointer to the key that describes the maximum Quantization Parameter (QP) allowed by the video encoder. The value type is int32_t.
This key is used in the configuration or parameter setting phase or takes effect immediately with each frame.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_QP_MINPointer to the key that describes the minimum QP allowed by the video encoder. The value type is int32_t.
This key is used in the configuration or parameter setting phase or takes effect immediately with each frame.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGEPointer to the key that describes the average QP of video frames. The value type is int32_t.
Pointer to the key that describes the average QP value of the current frame encoding block. It is output with OH_AVBuffer.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_MSEPointer to the key that describes the Mean Squared Error (MSE) of video frames. The value type is double.
Pointer to the key that describes the average MSE value of the current frame encoding block. It is output with OH_AVBuffer.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_DECODING_TIMESTAMPPointer to the key that describes the decoding timestamp corresponding to the audio, video, or subtitle sample carried in AVBuffer, in microseconds. The value type is int64_t.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_BUFFER_DURATIONPointer to the key that describes the duration corresponding to the audio, video, or subtitle sample carried in AVBuffer, in microseconds. The value type is int64_t.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_SARPointer to the key that describes the aspect ratio of the sample. The value type is double.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_START_TIMEPointer to the key that describes the start time of the first frame in a media file, measured in microseconds. The value type is int64_t.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRACK_START_TIMEPointer to the key that describes the start time of the track, measured in microseconds. The value type is int64_t.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACEPointer to the key that describes the output color space of the video decoder. The value type is int32_t.
The supported value is OH_COLORSPACE_BT709_LIMIT. For details, see OH_NativeBuffer_ColorSpace.
It is used in OH_VideoDecoder_Configure.
Before calling OH_VideoDecoder_Start, you must call OH_VideoDecoder_Prepare.
If Color Space Conversion (CSC) is supported and this key is configured, the video decoder automatically transcodes the HDR Vivid video to the specified color space.
If CSC is not supported, the error code AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION in OH_AVErrCode is returned when OH_VideoDecoder_Configure is called. If the input video is not an HDR Vivid video, the callback function OH_AVCodecOnError is invoked to report the error code AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION in OH_AVErrCode.
Since: 12
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRRPointer to the key that specifies whether the decoder enables the video variable frame rate feature. The value type is int32_t.
1 if enabled, 0 otherwise.
Since: 15
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_CREATION_TIMEPointer to the media file creation time metadata. The value type is char *. The value must be in the UTC time format complying with ISO 8601. Time format example: 2024-12-28T00:00:00:000000Z
Since: 14
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTERPointer to the key that describes the duration (in milliseconds) for which the last frame will be resubmitted repeatedly, if no new frame is available after the previous frame is submitted to the encoder. The value type is int32_t.
This key is used only in the configuration phase of video encoding in surface mode.
Configured value.
- If the value is less than or equal to 0, the request is intercepted in the configuration phase and ERROR AV_ERR_INVALID_VAL is returned.
- If the value is greater than 0, the last frame will be resubmitted repeatedly in the specified duration, measured in milliseconds.
Since: 18
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNTPointer to the key that describes the maximum number of times the encoder can repeat encoding the previous frame when no new frame is available. The value type is int32_t.
This key takes effect only when OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER is available and is used only in the configuration phase.
Configured value.
- If the value is equal to 0, the request is intercepted in the configuration phase and ERROR AV_ERR_INVALID_VAL is returned.
- If the value is less than 0 and no new frame is available, the encoder repeatedly encodes the previous frame until the upper limit of the system is reached.
- If the value is greater than 0 and no new frame is available, the encoder repeatedly encodes the previous frame until the maximum number specified is reached.
Since: 18
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAMEPointer to the key that describes the enabled status of B-frame encoding. The value type is int32_t (0 or 1). 1 if enabled, 0 otherwise. This key is optional and used only for video encoding. The default value is 0.
If enabled, the video encoder uses B-frames, resulting in a different decoding order from the display order.
If the platform does not support this feature, the configuration of this key does not take effect.
To check whether the platform supports B-frame encoding, use the OH_AVCapability_IsFeatureSupported API and the enumerated value OH_AVCapabilityFeature.VIDEO_ENCODER_B_FRAME.
This key is used only in the configuration phase.

Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_MAX_B_FRAMESPointer to the key that describes the maximum number of consecutive B-frames supported by the video encoder. The value type is int32_t. Note: This key is used only to query the encoder capability.
The usage specifications are as follows:
1. To check whether the platform supports B-frame encoding, use the OH_AVCapability_IsFeatureSupported API and the enumerated value OH_AVCapabilityFeature.VIDEO_ENCODER_B_FRAME.
2. Obtain the OH_AVFormat pointer through the OH_AVCapability_GetFeatureProperties API and the enumerated value OH_AVCapabilityFeature.VIDEO_ENCODER_B_FRAME.
3. Obtain the maximum number of B-frames through the OH_AVFormat_GetIntValue API and this key.

Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMSPointer to the key that describes the enabled status of ROI encoding in video encoding, with ROI parameters delivered. The parameters take effect immediately with the frame.
The value must be in the format of "Top1,Left1-Bottom1,Right1=Offset1;Top2,Left2-Bottom2,Right2=Offset2;", where multiple ROI parameters are separated by semicolons (;).
Top, Left, Bottom, and Right specify the upper, left, bottom, and right boundaries of an ROI area, respectively. Offset specifies deltaQP. (=Offset) can be omitted. If it is omitted, the default value (–3) is used.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_SQR_FACTORPointer to the key that describes the quality parameter in SQR mode. The value range is [0, 51] (same as the QP value in encoding). A smaller value indicates a higher output bit rate and better quality.
It is used in the configuration or parameter setting phase.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_MAX_BITRATEPointer to the key that describes the maximum bit rate in SQR mode. The value range can be obtained by calling OH_AVCapability_GetEncoderBitrateRange and is the same as that of OH_MD_KEY_BITRATE. The unit is bit/s. The value type is int64_t.
It is used in the configuration or parameter setting phase.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_ENCODER_ENABLE_PTS_BASED_RATECONTROLPointer to the key that describes the enabled status of the PTS-based bit rate control mode. The value type is int32_t. 1 if enabled, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used.
This key is optional and is used only for video encoding.
If this feature is enabled, each video frame must contain PTS information and be sent to the encoder. In surface mode, the PTS is set by calling OH_NativeWindow_NativeWindowHandleOpt, in units of nanosecond (ns). In buffer mode, the PTS is set by calling OH_AVBuffer_SetBufferAttr, in units of microsecond (us).
It is used in the configuration phase.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_REFERENCE_TRACK_IDSPointer to the key that describes the reference relationship between media file tracks. The value type is int32_t*.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRACK_REFERENCE_TYPEPointer to the auxiliary track type of a media file. The value type is char *.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_TRACK_DESCRIPTIONPointer to the auxiliary track description of a media file. The value type is char *.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ENABLE_SYNC_MODEPointer to the key that describes the enabled status of audio/video codec synchronization. The value type is int32_t. 1 if enabled, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used. This key is optional.
If this feature is enabled, pay attention to the following:
1. The codec cannot have a callback function.
2. You must use the buffer query API instead of the callback function.
3. The key can be used only in the configuration phase.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_DECODER_BLANK_FRAME_ON_SHUTDOWNPointer to the key that specifies whether to output blank frames when the video decoder is disabled. The value type is int32_t. 1 to output, 0 otherwise. The default value is 0. If this parameter is set to a non-zero value, the value 1 is used. This key is optional and is used only for video decoding in surface mode.
After this function is enabled, the video decoder outputs a blank frame (usually black) when the OH_VideoDecoder_Stop or OH_VideoDecoder_Destroy API is called. This mechanism prevents frozen frames caused by sudden termination of the decoder.
Since: 20
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_VIDEO_NATIVE_BUFFER_FORMATPointer to the key that is used to query the native buffer pixel format in video encoding and decoding. The value type is int32_t.
For details, see the pixel formats defined in OH_NativeBuffer_Format. This key is used in the following scenarios:
1. Video decoding: Call OH_VideoDecoder_GetOutputDescription or OH_AVCodecOnStreamChanged to obtain the current output format from the returned OH_AVFormat object.
2. Video encoding: Call OH_VideoEncoder_GetInputDescription to obtain the current input format from the returned OH_AVFormat object.
Since: 22
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_BUFFER_SKIP_SAMPLES_INFOPointer to the key carried in the OH_AVBuffer used to skip part of the decoded audio data. It is measured in sample points, with a value type of uint8_t*. This key is supported when using MP3, Vorbis, or OPUS decoders.
It is carried only by the first and last frames of an audio stream and is optional. Method 1: Obtain the information during demultiplexing and set it to the input OH_AVBuffer used for decoding.
1. Obtain the OH_AVBuffer used for decoding from the callback function OH_AVCodecOnNeedInputBuffer of OH_AVCodecCallback.
2. Call OH_AVDemuxer_ReadSampleBuffer to read audio data. This function automatically sets OH_MD_KEY_BUFFER_SKIP_SAMPLES_INFO when needed.
3. Call OH_AudioCodec_PushInputBuffer to push the input OH_AVBuffer for decoding.
Method 2: Construct the data required by the key and set it to the input OH_AVBuffer used for decoding.
Create a 10-byte uint8_t[] array with the structure as follows:
1. Bytes 0-3 (uint32_t, little-endian): number of samples to skip from the beginning of this frame.
2. Bytes 4-7 (uint32_t, little-endian): number of samples to skip from the end of this frame (must not exceed the frame's total sample count).
3. Bytes 8-9: reserved; set to 0.

Since: 23
System capability: SystemCapability.Multimedia.Media.CodecBase
const char * OH_MD_KEY_ENABLE_BUFFER_SKIP_SAMPLESPointer to the key for enabling OH_MD_KEY_BUFFER_SKIP_SAMPLES_INFO in the audio decoder. The value type is int32_t. 1 to enable, 0 otherwise. The default value is 0. If this parameter is set to a value other than 1, the value 0 is used.
This key is optional. It is for the audio decoder only.
Since: 24
const char * OH_MD_KEY_LATITUDELatitude key. The value is of the float type, and the value range is [-90.0, 90.0]. It indicates the latitude in geographic location information.
Since: 24
const char * OH_MD_KEY_LONGITUDELongitude key. The value is of the float type, and the value range is [-180.0, 180.0]. It indicates the longitude in geographic location information.
Since: 24
const char * OH_MD_KEY_ALTITUDEAltitude key. The value is of the float type. This key is optional. It indicates the altitude in geographic location information.
Since: 24

Enum Description

OH_MediaType

enum OH_MediaType

Description

Enumerates the media types.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

ValueDescription
MEDIA_TYPE_AUD = 0Audio track.
MEDIA_TYPE_VID = 1Video track.
MEDIA_TYPE_SUBTITLE = 2Subtitle track.
Since: 12
MEDIA_TYPE_TIMED_METADATA = 5Timed metadata track.
Since: 20
MEDIA_TYPE_AUXILIARY = 6Auxiliary track.
Since: 20

OH_AACProfile

enum OH_AACProfile

Description

Enumerates the AAC profiles.
(AAC_PROFILE_HE and AAC_PROFILE_HE_V2 are not available yet.)

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

ValueDescription
AAC_PROFILE_LC = 0AAC profile of the low complexity level.
AAC_PROFILE_HE = 3AAC profile of the high efficiency level. (This specification is not available yet.)
Since: 14
AAC_PROFILE_HE_V2 = 4AAC profile of the high efficiency V2 level. (This specification is not available yet.)
Since: 14

OH_AVCProfile

enum OH_AVCProfile

Description

Enumerates the AVC profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

ValueDescription
AVC_PROFILE_BASELINE = 0AVC baseline profile.
AVC_PROFILE_HIGH = 4AVC high profile.
AVC_PROFILE_MAIN = 8AVC main profile.

OH_HEVCProfile

enum OH_HEVCProfile

Description

Enumerates the HEVC profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
HEVC_PROFILE_MAIN = 0HEVC profile of the main level.
HEVC_PROFILE_MAIN_10 = 1HEVC profile of the 10-bit main level.
HEVC_PROFILE_MAIN_STILL = 2HEVC profile of the main still picture level.
HEVC_PROFILE_MAIN_10_HDR10 = 3HEVC profile of the main 10 HDR10 level.
Deprecated from: 14
HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4HEVC profile of the main 10 HDR10+ level.
Deprecated from: 14

OH_VVCProfile

enum OH_VVCProfile

Description

Enumerates the VVC profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 15

ValueDescription
VVC_PROFILE_MAIN_10 = 1VVC profile of the 10-bit main level.
VVC_PROFILE_MAIN_12 = 2VVC profile of the 12-bit main level.
VVC_PROFILE_MAIN_12_INTRA = 10VVC profile of the 12-bit intra main level.
VVC_PROFILE_MULTI_MAIN_10 = 17VVC profile of the 10-bit main level for multi-layer encoding.
VVC_PROFILE_MAIN_10_444 = 33VVC profile of the 10-bit full-sample main level.
VVC_PROFILE_MAIN_12_444 = 34VVC profile of the 12-bit full-sample main level.
VVC_PROFILE_MAIN_16_444 = 36VVC profile of the 16-bit full-sample main level.
VVC_PROFILE_MAIN_12_444_INTRA = 42VVC profile of the 12-bit full-sample intra main level.
VVC_PROFILE_MAIN_16_444_INTRA = 44VVC profile of the 16-bit full-sample intra main level.
VVC_PROFILE_MULTI_MAIN_10_444 = 49VVC profile of the 10-bit full-sample main level for multi-layer encoding.
VVC_PROFILE_MAIN_10_STILL = 65VVC profile of the 10-bit still picture main level.
VVC_PROFILE_MAIN_12_STILL = 66VVC profile of the 12-bit still picture main level.
VVC_PROFILE_MAIN_10_444_STILL = 97VVC profile of the 10-bit full-sample still picture main level.
VVC_PROFILE_MAIN_12_444_STILL = 98VVC profile of the 12-bit full-sample still picture main level.
VVC_PROFILE_MAIN_16_444_STILL = 100VVC profile of the 16-bit full-sample still picture main level.

OH_MPEG2Profile

enum OH_MPEG2Profile

Description

Enumerates the MPEG2 profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
MPEG2_PROFILE_SIMPLE = 0Simple profile.
MPEG2_PROFILE_MAIN = 1Main profile.
MPEG2_PROFILE_SNR_SCALABLE = 2Signal-to-Noise Ratio (SNR) scalable profile.
MPEG2_PROFILE_SPATIALLY_SCALABLE = 3Spatial scalable profile.
MPEG2_PROFILE_HIGH = 4High profile.
MPEG2_PROFILE_422 = 54:2:2 profile.

OH_MPEG4Profile

enum OH_MPEG4Profile

Description

Enumerates the MPEG4 profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
MPEG4_PROFILE_SIMPLE = 0Simple profile.
MPEG4_PROFILE_SIMPLE_SCALABLE = 1Simple scalable profile.
MPEG4_PROFILE_CORE = 2Core profile.
MPEG4_PROFILE_MAIN = 3Main profile.
MPEG4_PROFILE_N_BIT = 4N-bit profile.
MPEG4_PROFILE_HYBRID = 5Hybrid profile.
MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6Basic animated texture profile.
MPEG4_PROFILE_SCALABLE_TEXTURE = 7Scalable texture profile.
MPEG4_PROFILE_SIMPLE_FA = 8Simple FA profile.
MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE = 9Advanced real-time simple profile.
MPEG4_PROFILE_CORE_SCALABLE = 10Core scalable profile.
MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11Advanced coding efficiency profile.
MPEG4_PROFILE_ADVANCED_CORE = 12Advanced core profile.
MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE = 13Advanced scalable texture profile.
MPEG4_PROFILE_ADVANCED_SIMPLE = 17Advanced simple profile.

OH_H263Profile

enum OH_H263Profile

Description

Enumerates the H.263 profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
H263_PROFILE_BASELINE = 0Baseline profile.
H263_PROFILE_VERSION_1_BACKWARD_COMPATIBILITY = 2Version 1 backward compatibility.

OH_VC1Profile

enum OH_VC1Profile

Description

Enumerates the VC-1 profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 22

ValueDescription
VC1_PROFILE_SIMPLE = 0Simple profile.
VC1_PROFILE_MAIN = 1Main profile.
VC1_PROFILE_ADVANCED = 2High profile.

OH_AV1Profile

enum OH_AV1Profile

Description

AV1 profile.

Since: 23

ValueDescription
AV1_PROFILE_MAIN = 0Main profile.
AV1_PROFILE_HIGH = 1High profile.
AV1_PROFILE_PROFESSIONAL = 2Professional profile.

OH_VP9Profile

enum OH_VP9Profile

Description

VP9 profile.

Since: 23

ValueDescription
VP9_PROFILE_0 = 0Profile 0.
VP9_PROFILE_1 = 1Profile 1.
VP9_PROFILE_2 = 2Profile 2.
VP9_PROFILE_3 = 3Profile 3.

OH_WVC1Profile

enum OH_WVC1Profile

Description

WVC1 profile.

Since: 23

ValueDescription
WVC1_PROFILE_ADVANCED = 0High profile.

OH_WMV3Profile

enum OH_WMV3Profile

Description

Enumerates the WMV3 profiles.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 22

ValueDescription
WMV3_PROFILE_SIMPLE = 0Simple profile.
WMV3_PROFILE_MAIN = 1Main profile.

OH_AVOutputFormat

enum OH_AVOutputFormat

Description

Enumerates the output file formats supported by a muxer.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
AV_OUTPUT_FORMAT_DEFAULT = 0Default format, which is MP4.
AV_OUTPUT_FORMAT_MPEG_4 = 2MP4.
AV_OUTPUT_FORMAT_M4A = 6M4A.
AV_OUTPUT_FORMAT_AMR = 8AMR.
Since: 12
AV_OUTPUT_FORMAT_MP3 = 9MP3.
Since: 12
AV_OUTPUT_FORMAT_WAV = 10WAV.
Since: 12
AV_OUTPUT_FORMAT_AAC = 11AAC.
Since: 18
AV_OUTPUT_FORMAT_FLAC = 12FLAC.
Since: 20
AV_OUTPUT_FORMAT_OGG = 13OGG.
Since: 23

OH_AVSeekMode

enum OH_AVSeekMode

Description

Enumerates the seek modes.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
SEEK_MODE_NEXT_SYNC = 0Seeks to the next I-frame at the specified position. If there is no I-frame after the specified position, the seek operation may fail.
SEEK_MODE_PREVIOUS_SYNCSeeks to the previous I-frame at the specified position.
SEEK_MODE_CLOSEST_SYNCSeeks to the latest I-frame at the specified position.

OH_ScalingMode

enum OH_ScalingMode

Description

Enumerates the scaling modes. This enum is used only in surface mode.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

Deprecated from: 14

Substitute: OHScalingModeV2

ValueDescription
SCALING_MODE_SCALE_TO_WINDOW = 1Scales the image based on the window size.
Substitute: OHScalingModeV2.OH_SCALING_MODE_SCALE_TO_WINDOW_V2
SCALING_MODE_SCALE_CROP = 2Crops the image based on the window size.
Substitute: OHScalingModeV2.OH_SCALING_MODE_SCALE_CROP_V2

OH_BitsPerSample

enum OH_BitsPerSample

Description

Enumerates the number of audio bits for each coded sample.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
SAMPLE_U8 = 08-bit unsigned integer sampling.
SAMPLE_S16LE = 116-bit signed integer sampling.
SAMPLE_S24LE = 224-bit signed integer sampling.
SAMPLE_S32LE = 332-bit signed integer sampling.
SAMPLE_F32LE = 432-bit floating-point sampling.
SAMPLE_U8P = 58-bit unsigned integer plane sampling.
SAMPLE_S16P = 616-bit signed integer plane sampling.
SAMPLE_S24P = 724-bit signed integer plane sampling.
SAMPLE_S32P = 832-bit signed integer plane sampling.
SAMPLE_F32P = 932-bit floating-point plane sampling.
INVALID_WIDTH = -1Invalid sampling format.

OH_ColorPrimary

enum OH_ColorPrimary

Description

Enumerates the primary colors. This enum is used for both encoding and decoding.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
COLOR_PRIMARY_BT709 = 1BT709 color gamut.
COLOR_PRIMARY_UNSPECIFIED = 2Unspecified color gamut.
COLOR_PRIMARY_BT470_M = 4BT470_M color gamut.
COLOR_PRIMARY_BT601_625 = 5BT601_625 color gamut.
COLOR_PRIMARY_BT601_525 = 6BT601_525 color gamut.
COLOR_PRIMARY_SMPTE_ST240 = 7SMPTE_ST240 color gamut.
COLOR_PRIMARY_GENERIC_FILM = 8GENERIC_FILM color gamut.
COLOR_PRIMARY_BT2020 = 9BT2020 color gamut.
COLOR_PRIMARY_SMPTE_ST428 = 10SMPTE_ST428 color gamut.
COLOR_PRIMARY_P3DCI = 11P3DCI color gamut.
COLOR_PRIMARY_P3D65 = 12P3D65 color gamut.

OH_TransferCharacteristic

enum OH_TransferCharacteristic

Description

Enumerates the transfer characteristics. This enum is used for both encoding and decoding.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
TRANSFER_CHARACTERISTIC_BT709 = 1BT709 transfer function.
TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2Unspecified transfer function.
TRANSFER_CHARACTERISTIC_GAMMA_2_2 = 4GAMMA_2_2 transfer function.
TRANSFER_CHARACTERISTIC_GAMMA_2_8 = 5GAMMA_2_8 transfer function.
TRANSFER_CHARACTERISTIC_BT601 = 6BT601 transfer function.
TRANSFER_CHARACTERISTIC_SMPTE_ST240 = 7SMPTE_ST240 transfer function.
TRANSFER_CHARACTERISTIC_LINEAR = 8Linear transfer function.
TRANSFER_CHARACTERISTIC_LOG = 9Log transfer function.
TRANSFER_CHARACTERISTIC_LOG_SQRT = 10LOG_SQRT transfer function.
TRANSFER_CHARACTERISTIC_IEC_61966_2_4 = 11IEC_61966_2_4 transfer function.
TRANSFER_CHARACTERISTIC_BT1361 = 12BT1361 transfer function.
TRANSFER_CHARACTERISTIC_IEC_61966_2_1 = 13IEC_61966_2_1 transfer function.
TRANSFER_CHARACTERISTIC_BT2020_10BIT = 14BT2020_10BIT transfer function.
TRANSFER_CHARACTERISTIC_BT2020_12BIT = 15BT2020_12BIT transfer function.
TRANSFER_CHARACTERISTIC_PQ = 16PQ transfer function.
TRANSFER_CHARACTERISTIC_SMPTE_ST428 = 17SMPTE_ST428 transfer function.
TRANSFER_CHARACTERISTIC_HLG = 18HLG transfer function.

OH_MatrixCoefficient

enum OH_MatrixCoefficient

Description

Enumerates the matrix coefficients. This enum is used for both encoding and decoding.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
MATRIX_COEFFICIENT_IDENTITY = 0Identity matrix.
MATRIX_COEFFICIENT_BT709 = 1BT709 conversion matrix.
MATRIX_COEFFICIENT_UNSPECIFIED = 2Unspecified conversion matrix.
MATRIX_COEFFICIENT_FCC = 4FCC conversion matrix.
MATRIX_COEFFICIENT_BT601_625 = 5BT601_625 conversion matrix.
MATRIX_COEFFICIENT_BT601_525 = 6BT601_525 conversion matrix.
MATRIX_COEFFICIENT_SMPTE_ST240 = 7SMPTE_ST240 conversion matrix.
MATRIX_COEFFICIENT_YCGCO = 8YCGCO conversion matrix.
MATRIX_COEFFICIENT_BT2020_NCL = 9BT2020_NCL conversion matrix.
MATRIX_COEFFICIENT_BT2020_CL = 10BT2020_CL conversion matrix.
MATRIX_COEFFICIENT_SMPTE_ST2085 = 11SMPTE_ST2085 conversion matrix.
MATRIX_COEFFICIENT_CHROMATICITY_NCL = 12CHROMATICITY_NCL conversion matrix.
MATRIX_COEFFICIENT_CHROMATICITY_CL = 13CHROMATICITY_CL conversion matrix.
MATRIX_COEFFICIENT_ICTCP = 14ICTCP conversion matrix.

OH_AVCLevel

enum OH_AVCLevel

Description

Enumerates the AVC levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

ValueDescription
AVC_LEVEL_1 = 0Level 1.
AVC_LEVEL_1b = 1Level 1b.
AVC_LEVEL_11 = 2Level 1.1.
AVC_LEVEL_12 = 3Level 1.2.
AVC_LEVEL_13 = 4Level 1.3.
AVC_LEVEL_2 = 5Level 2.
AVC_LEVEL_21 = 6Level 2.1.
AVC_LEVEL_22 = 7Level 2.2.
AVC_LEVEL_3 = 8Level 3.
AVC_LEVEL_31 = 9Level 3.1.
AVC_LEVEL_32 = 10Level 3.2.
AVC_LEVEL_4 = 11Level 4.
AVC_LEVEL_41 = 12Level 4.1.
AVC_LEVEL_42 = 13Level 4.2.
AVC_LEVEL_5 = 14Level 5.
AVC_LEVEL_51 = 15Level 5.1.
AVC_LEVEL_52 = 16Level 5.2.
AVC_LEVEL_6 = 17Level 6.
AVC_LEVEL_61 = 18Level 6.1.
AVC_LEVEL_62 = 19Level 6.2.

OH_HEVCLevel

enum OH_HEVCLevel

Description

Enumerates the HEVC levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

ValueDescription
HEVC_LEVEL_1 = 0Level 1.
HEVC_LEVEL_2 = 1Level 2.
HEVC_LEVEL_21 = 2Level 2.1.
HEVC_LEVEL_3 = 3Level 3.
HEVC_LEVEL_31 = 4Level 3.1.
HEVC_LEVEL_4 = 5Level 4.
HEVC_LEVEL_41 = 6Level 4.1.
HEVC_LEVEL_5 = 7Level 5.
HEVC_LEVEL_51 = 8Level 5.1.
HEVC_LEVEL_52 = 9Level 5.2.
HEVC_LEVEL_6 = 10Level 6.
HEVC_LEVEL_61 = 11Level 6.1.
HEVC_LEVEL_62 = 12Level 6.2.

OH_VVCLevel

enum OH_VVCLevel

Description

Enumerates the VVC levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 15

ValueDescription
VVC_LEVEL_1 = 16Level 1.0.
VVC_LEVEL_2 = 32Level 2.0.
VVC_LEVEL_21 = 35Level 2.1.
VVC_LEVEL_3 = 48Level 3.0.
VVC_LEVEL_31 = 51Level 3.1.
VVC_LEVEL_4 = 64Level 4.0.
VVC_LEVEL_41 = 67Level 4.1.
VVC_LEVEL_5 = 80Level 5.0.
VVC_LEVEL_51 = 83Level 5.1.
VVC_LEVEL_52 = 86Level 5.2.
VVC_LEVEL_6 = 96Level 6.0.
VVC_LEVEL_61 = 99Level 6.1.
VVC_LEVEL_62 = 102Level 6.2.
VVC_LEVEL_63 = 105Level 6.3.
VVC_LEVEL_155 = 255Level 15.5.

OH_MPEG2Level

enum OH_MPEG2Level

Description

Enumerates the MPEG2 levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
MPEG2_LEVEL_LOW = 0Low level.
MPEG2_LEVEL_MAIN = 1Main level.
MPEG2_LEVEL_HIGH_1440 = 2High 1440 level.
MPEG2_LEVEL_HIGH = 3High level.

OH_MPEG4Level

enum OH_MPEG4Level

Description

Enumerates the MPEG4 levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
MPEG4_LEVEL_0 = 0Level 0.
MPEG4_LEVEL_0B = 1Level 0B.
MPEG4_LEVEL_1 = 2Level 1.
MPEG4_LEVEL_2 = 3Level 2.
MPEG4_LEVEL_3 = 4Level 3.
MPEG4_LEVEL_3B = 5Level 3B.
MPEG4_LEVEL_4 = 6Level 4.
MPEG4_LEVEL_4A = 7Level 4A.
MPEG4_LEVEL_5 = 8Level 5.
MPEG4_LEVEL_6 = 9Level 6.

OH_H263Level

enum OH_H263Level

Description

Enumerates the H.263 levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 17

ValueDescription
H263_LEVEL_10 = 0Level 10.
H263_LEVEL_20 = 1Level 20.
H263_LEVEL_30 = 2Level 30.
H263_LEVEL_40 = 3Level 40.
H263_LEVEL_45 = 4Level 45.
H263_LEVEL_50 = 5Level 50.
H263_LEVEL_60 = 6Level 60.
H263_LEVEL_70 = 7Level 70.

OH_VC1Level

enum OH_VC1Level

Description

Enumerates the VC-1 levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 22

ValueDescription
VC1_LEVEL_L0 = 0Level L0.
VC1_LEVEL_L1 = 1Level L1.
VC1_LEVEL_L2 = 2Level L2.
VC1_LEVEL_L3 = 3Level L3.
VC1_LEVEL_L4 = 4Level L4.
VC1_LEVEL_LOW = 5Low level.
VC1_LEVEL_MEDIUM = 6Medium level.
VC1_LEVEL_HIGH = 7High level.

OH_AV1Level

enum OH_AV1Level

Description

AV1 level.

Since: 23

ValueDescription
AV1_LEVEL_20 = 0Level 2.0.
AV1_LEVEL_21 = 1Level 2.1.
AV1_LEVEL_22 = 2Level 2.2.
AV1_LEVEL_23 = 3Level 2.3.
AV1_LEVEL_30 = 4Level 3.0.
AV1_LEVEL_31 = 5Level 3.1.
AV1_LEVEL_32 = 6Level 3.2.
AV1_LEVEL_33 = 7Level 3.3.
AV1_LEVEL_40 = 8Level 4.0.
AV1_LEVEL_41 = 9Level 4.1.
AV1_LEVEL_42 = 10Level 4.2.
AV1_LEVEL_43 = 11Level 4.3.
AV1_LEVEL_50 = 12Level 5.0.
AV1_LEVEL_51 = 13Level 5.1.
AV1_LEVEL_52 = 14Level 5.2.
AV1_LEVEL_53 = 15Level 5.3.
AV1_LEVEL_60 = 16Level 6.0.
AV1_LEVEL_61 = 17Level 6.1.
AV1_LEVEL_62 = 18Level 6.2.
AV1_LEVEL_63 = 19Level 6.3.
AV1_LEVEL_70 = 20Level 7.0.
AV1_LEVEL_71 = 21Level 7.1.
AV1_LEVEL_72 = 22Level 7.2.
AV1_LEVEL_73 = 23Level 7.3.

OH_VP9Level

enum OH_VP9Level

Description

VP9 level.

Since: 23

ValueDescription
VP9_LEVEL_1 = 0Level 1.
VP9_LEVEL_11 = 1Level 1.1.
VP9_LEVEL_2 = 2Level 2.
VP9_LEVEL_21 = 3Level 2.1.
VP9_LEVEL_3 = 4Level 3.
VP9_LEVEL_31 = 5Level 3.1.
VP9_LEVEL_4 = 6Level 4.
VP9_LEVEL_41 = 7Level 4.1.
VP9_LEVEL_5 = 8Level 5.
VP9_LEVEL_51 = 9Level 5.1.
VP9_LEVEL_52 = 10Level 5.2.
VP9_LEVEL_6 = 11Level 6.
VP9_LEVEL_61 = 12Level 6.1.
VP9_LEVEL_62 = 13Level 6.2.

OH_WVC1Level

enum OH_WVC1Level

Description

WVC1 level.

Since: 23

ValueDescription
WVC1_LEVEL_L0 = 0Level L0.
WVC1_LEVEL_L1 = 1Level L1.
WVC1_LEVEL_L2 = 2Level L2.
WVC1_LEVEL_L3 = 3Level L3.
WVC1_LEVEL_L4 = 4Level L4.

OH_WMV3Level

enum OH_WMV3Level

Description

Enumerates the WMV3 levels.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 22

ValueDescription
WMV3_LEVEL_LOW = 0Low level.
WMV3_LEVEL_MEDIUM = 1Medium level.
WMV3_LEVEL_HIGH = 2High level.

OH_TemporalGopReferenceMode

enum OH_TemporalGopReferenceMode

Description

Enumerates the reference modes of temporal image groups.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

ValueDescription
ADJACENT_REFERENCE = 0Refers to the nearest short-term reference frame.
JUMP_REFERENCE = 1Refers to the latest LTR frame.
UNIFORMLY_SCALED_REFERENCE = 2Drops video frames at the highest level, and evenly distributes the remaining frames. The number of temporal image groups must be a power of 2.

OH_BitrateMode

enum OH_BitrateMode

Description

Enumerates the bit rate modes of an encoder.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 10

ValueDescription
BITRATE_MODE_CBR = 0Constant bit rate.
BITRATE_MODE_VBR = 1Variable bit rate.
BITRATE_MODE_CQ = 2Constant quality.
BITRATE_MODE_SQR = 3Stable quality. It is supported only for H.265 (HEVC).
Since: 20
BITRATE_MODE_CBR_HIGH_QUALITY = 4High-quality constant bit rate. It is supported only for H.265 (HEVC).
Since: 26.0.0

Function Description

OH_AVCodecOnError()

typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData)

Description

Defines the pointer to the function that is called to report error information when an error occurs during the running of an OH_AVCodec instance.

Use CaseError Code
Audio encoding/decodingAV_ERR_DRM_DECRYPT_FAILED: DRM decryption failed.
Video encoding/decodingAV_ERROR_NO_MEMORY: System resources are insufficient.
AV_ERROR_UNKNOWN: An unknown error occurs. Analyze the error based on specific logs.
AV_ERR_SERVICE_DIED: The service is dead.
Video decodingAV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION: The current input does not support CSC.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
int32_t errorCodeError code.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVCodecOnStreamChanged()

typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData)

Description

Defines the pointer to the function that is called to report the new stream description when the resolution of the input video stream being decoded or the output video stream that has been encoded changes.
Starting from API version 15, this function pointer is called to report the new stream description when the stream sampling rate, number of audio channels, or audio sampling format changes during audio decoding. The decoding formats that can detect these changes include AAC, FLAC, MP3, and VORBIS.
Note that the lifecycle of the pointer to the OH_AVFormat instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
OH_AVFormat *formatPointer to the description information about the new output stream.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVCodecOnNeedInputData()

typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)

Description

Defines the pointer to the function that is called when new input data is required during the running of an OH_AVCodec instance. The function carries a buffer to fill in new input data.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Deprecated from: 11

Substitute: OH_AVCodecOnNeedInputBuffer

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
uint32_t indexIndex of the new input buffer.
OH_AVMemory *dataPointer to the data to fill in the new input buffer.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVCodecOnNewOutputData()

typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData)

Description

Defines the pointer to the function that is called when new output data is generated during the running of an OH_AVCodec instance. The function carries a buffer filled with new output data. Note that the lifecycle of the pointer to the OH_AVCodecBufferAttr instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Deprecated from: 11

Substitute: OH_AVCodecOnNewOutputBuffer

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
uint32_t indexIndex of the new output buffer.
OH_AVMemory *dataPointer to the data filled in the new output buffer.
OH_AVCodecBufferAttr *attrPointer to the description information about the new output buffer.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVCodecOnNeedInputBuffer()

typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)

Description

Defines the pointer to the function that is called when new input data is required during the running of an OH_AVCodec instance. The function carries a buffer to fill in new input data.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 11

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
uint32_t indexIndex of the new input buffer.
OH_AVBuffer *bufferPointer to the data to fill in the new input buffer.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVCodecOnNewOutputBuffer()

typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)

Description

Defines the pointer to the function that is called when new output data is generated during the running of an OH_AVCodec instance. The function carries a buffer filled with new output data.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 11

Parameters

NameDescription
OH_AVCodec *codecPointer to an OH_AVCodec instance.
uint32_t indexIndex of the new output buffer.
OH_AVBuffer *bufferPointer to the data filled in the new output buffer.
void *userDataPointer to the data on which the caller depends when executing the callback.

OH_AVDataSourceReadAt()

typedef int32_t (*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t pos)

Description

Defines a function pointer used to provide the capability of obtaining user-defined media data.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 12

Parameters

NameDescription
OH_AVBuffer *dataPointer to the buffer to be filled in.
int32_t lengthLength of the data to read.
int64_t posOffset from which the data is read.

Returns

TypeDescription
int32_tActual length of the data read to the buffer.

OH_AVDataSourceReadAtExt()

typedef int32_t (*OH_AVDataSourceReadAtExt)(OH_AVBuffer *data, int32_t length, int64_t pos, void *userData)

Description

Defines a function pointer used to provide the capability of obtaining user-defined media data.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 20

Parameters

NameDescription
OH_AVBuffer *dataPointer to the buffer to be filled in.
int32_t lengthLength of the data to read.
int64_t posOffset from which the data is read.
void *userDataPointer to user-defined data.

Returns

TypeDescription
int32_tActual length of the data read to the buffer.

你可能感兴趣的鸿蒙文章

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/ffOSQQAG