1# native_avcodec_base.h 2 3## Overview 4 5The file declares the native APIs used for basic audio and video multiplexing, demultiplexing, encoding, and decoding. 6 7**File to include**: <multimedia/player_framework/native_avcodec_base.h> 8 9**Library**: libnative_media_codecbase.so 10 11**System capability**: SystemCapability.Multimedia.Media.CodecBase 12 13**Since**: 9 14 15**Related module**: [CodecBase](capi-codecbase.md) 16 17**Sample**: [AVCodec](https://gitcode.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/AVCodec) 18 19## Summary 20 21### Structs 22 23| Name| typedef Keyword| Description| 24| -- | -- | -- | 25| [OH_AVCodecAsyncCallback](capi-codecbase-oh-avcodecasynccallback.md) | OH_AVCodecAsyncCallback | Describes all the asynchronous callback function pointers of an OH_AVCodec instance. (It is deprecated from API version 11.) 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.| 26| [OH_AVCodecCallback](capi-codecbase-oh-avcodeccallback.md) | OH_AVCodecCallback | Describes 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.| 27| [OH_AVDataSource](capi-codecbase-oh-avdatasource.md) | OH_AVDataSource | Describes a user-defined data source.| 28| [OH_AVDataSourceExt](capi-codecbase-oh-avdatasourceext.md) | OH_AVDataSourceExt | Describes a user-defined data source. User-defined data can be passed to its callback functions through the **userData** parameter.| 29| [NativeWindow](../apis-arkgraphics2d/capi-nativewindow-nativewindow.md) | OHNativeWindow | Describes a native object for the graphics interface.| 30| [OH_AVCodec](capi-codecbase-oh-avcodec.md) | OH_AVCodec | Describes a native object for the audio and video codec interface.| 31 32### Enums 33 34| Name| typedef Keyword| Description| 35| -- | -- | -- | 36| [OH_MediaType](#oh_mediatype) | OH_MediaType | Enumerates the media types.| 37| [OH_AACProfile](#oh_aacprofile) | OH_AACProfile | Enumerates the Advanced Audio Coding (AAC) profiles.<!--Del--><br>(**AAC_PROFILE_HE** and **AAC_PROFILE_HE_V2** are not available yet.)<!--DelEnd--> | 38| [OH_AVCProfile](#oh_avcprofile) | OH_AVCProfile | Enumerates the Advanced Video Coding (AVC) profiles.| 39| [OH_HEVCProfile](#oh_hevcprofile) | OH_HEVCProfile | Enumerates the High Efficiency Video Coding (HEVC) profiles.| 40| [OH_VVCProfile](#oh_vvcprofile) | OH_VVCProfile | Enumerates the VVC profiles.| 41| [OH_MPEG2Profile](#oh_mpeg2profile) | OH_MPEG2Profile | Enumerates the MPEG2 profiles.| 42| [OH_MPEG4Profile](#oh_mpeg4profile) | OH_MPEG4Profile | Enumerates the MPEG4 profiles.| 43| [OH_H263Profile](#oh_h263profile) | OH_H263Profile | Enumerates the H.263 profiles.| 44| [OH_AVOutputFormat](#oh_avoutputformat) | OH_AVOutputFormat | Enumerates the output file formats supported by a muxer.| 45| [OH_AVSeekMode](#oh_avseekmode) | OH_AVSeekMode | Enumerates the seek modes.| 46| [OH_ScalingMode](#oh_scalingmode) | OH_ScalingMode | Enumerates the scaling modes. This enum is used only in surface mode.| 47| [OH_BitsPerSample](#oh_bitspersample) | OH_BitsPerSample | Enumerates the number of audio bits for each coded sample.| 48| [OH_ColorPrimary](#oh_colorprimary) | OH_ColorPrimary | Enumerates the primary colors. This enum is used for both encoding and decoding.| 49| [OH_TransferCharacteristic](#oh_transfercharacteristic) | OH_TransferCharacteristic | Enumerates the transfer characteristics. This enum is used for both encoding and decoding.| 50| [OH_MatrixCoefficient](#oh_matrixcoefficient) | OH_MatrixCoefficient | Enumerates the matrix coefficients. This enum is used for both encoding and decoding.| 51| [OH_AVCLevel](#oh_avclevel) | OH_AVCLevel | Enumerates the AVC levels.| 52| [OH_HEVCLevel](#oh_hevclevel) | OH_HEVCLevel | Enumerates the HEVC levels.| 53| [OH_VVCLevel](#oh_vvclevel) | OH_VVCLevel | Enumerates the VVC levels.| 54| [OH_MPEG2Level](#oh_mpeg2level) | OH_MPEG2Level | Enumerates the MPEG2 levels.| 55| [OH_MPEG4Level](#oh_mpeg4level) | OH_MPEG4Level | Enumerates the MPEG4 levels.| 56| [OH_H263Level](#oh_h263level) | OH_H263Level | Enumerates the H.263 levels.| 57| [OH_TemporalGopReferenceMode](#oh_temporalgopreferencemode) | OH_TemporalGopReferenceMode | Enumerates the reference modes of temporal image groups.| 58| [OH_BitrateMode](#oh_bitratemode) | OH_BitrateMode | Enumerates the bit rate modes of an encoder.| 59 60### Functions 61 62| Name| typedef Keyword| Description| 63| -- | -- | -- | 64| [typedef void (\*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData)](#oh_avcodeconerror) | OH_AVCodecOnError | 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.| 65| [typedef void (\*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData)](#oh_avcodeconstreamchanged) | OH_AVCodecOnStreamChanged | Defines the pointer to the function that is called to report the new stream description when the resolution of the input stream being decoded or the output stream that has been encoded changes. 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.| 66| [typedef void (\*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)](#oh_avcodeconneedinputdata) | OH_AVCodecOnNeedInputData | 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.| 67| [typedef void (\*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data,OH_AVCodecBufferAttr *attr, void *userData)](#oh_avcodeconnewoutputdata) | OH_AVCodecOnNewOutputData | 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.| 68| [typedef void (\*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)](#oh_avcodeconneedinputbuffer) | OH_AVCodecOnNeedInputBuffer | 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.| 69| [typedef void (\*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData)](#oh_avcodeconnewoutputbuffer) | OH_AVCodecOnNewOutputBuffer | 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.| 70| [typedef int32_t (\*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t pos)](#oh_avdatasourcereadat) | OH_AVDataSourceReadAt | Defines a function pointer used to provide the capability of obtaining user-defined media data.| 71| [typedef int32_t (\*OH_AVDataSourceReadAtExt)(OH_AVBuffer *data, int32_t length, int64_t pos, void *userData)](#oh_avdatasourcereadatext) | OH_AVDataSourceReadAtExt | Defines a function pointer used to provide the capability of obtaining user-defined media data.| 72 73### Variables 74 75| Name| Description| 76| -- | -- | 77| const char * OH_AVCODEC_MIMETYPE_VIDEO_AVC | Pointer to the key that describes the MIME type of the AVC (H.264) video codec.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 78| const char * OH_AVCODEC_MIMETYPE_AUDIO_AAC | Pointer to the key that describes the MIME type of the AAC audio codec.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 79| const char * OH_AVCODEC_MIMETYPE_AUDIO_FLAC | Pointer to the key that describes the MIME type of the FLAC audio codec.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 80| const char * OH_AVCODEC_MIMETYPE_AUDIO_VORBIS | Pointer to the key that describes the MIME type of the Vorbis audio decoder.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 81| const char * OH_AVCODEC_MIMETYPE_AUDIO_MPEG | Pointer to the key that describes the MIME type of the MP3 audio codec.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 82| const char * OH_AVCODEC_MIMETYPE_VIDEO_HEVC | Pointer to the key that describes the MIME type of the HEVC (H.265) video codec.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 83| const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG4 | Pointer to the key that describes the MIME type of the MPEG4 video encoder, which is used only for multiplexing MPEG4 video streams.<br>**Since**: 10<br>**Deprecated from**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 84| const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2 | Pointer to the key that describes the MIME type of the MPEG4 Part 2 video codec.<br>**Since**: 17<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 85| const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG2 | Pointer to the key that describes the MIME type of the MPEG2 video codec.<br>**Since**: 17<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 86| const char * OH_AVCODEC_MIMETYPE_VIDEO_H263 | Pointer to the key that describes the MIME type of the H.263 video codec.<br>**Since**: 17<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 87| const char * OH_AVCODEC_MIMETYPE_IMAGE_JPG | Pointer to the key that describes the MIME type of the JPG image encoder, which is used only for multiplexing JPG covers.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 88| const char * OH_AVCODEC_MIMETYPE_IMAGE_PNG | Pointer to the key that describes the MIME type of the PNG image encoder, which is used only for multiplexing PNG covers.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 89| const char * OH_AVCODEC_MIMETYPE_IMAGE_BMP | Pointer to the key that describes the MIME type of the BMP image encoder, which is used only for multiplexing BMP covers.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 90| const char * OH_AVCODEC_MIMETYPE_AUDIO_VIVID | Pointer to the key that describes the MIME type of the Audio Vivid audio decoder. <!--Del-->(This specification is not available yet.)<!--DelEnd--><br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 91| const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB | Pointer to the key that describes the MIME type of the AMR-NB audio decoder.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 92| const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB | Pointer to the key that describes the MIME type of the AMR-WB audio decoder.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 93| const char * OH_AVCODEC_MIMETYPE_AUDIO_OPUS | Pointer to the key that describes the MIME type of the Opus audio codec. <!--Del-->(This specification is not available yet.)<!--DelEnd--><br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 94| const char * OH_AVCODEC_MIMETYPE_AUDIO_G711MU | Pointer to the key that describes the MIME type of the G.711 mu-law audio codec.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 95| const char * OH_AVCODEC_MIMETYPE_VIDEO_VVC | Pointer to the key that describes the MIME type of the VVC (H.266) video codec.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 96| const char * OH_AVCODEC_MIMETYPE_AUDIO_APE | Pointer to the key that describes the MIME type of the APE audio decoder.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 97| const char * OH_AVCODEC_MIMETYPE_SUBTITLE_SRT | Pointer to the key that describes the MIME type of the SRT subtitle demuxer.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 98| const char * OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT | Pointer to the key that describes the MIME type of the WEBVTT subtitle demuxer.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 99| const char * OH_AVCODEC_MIMETYPE_AUDIO_RAW | Pointer to the key that describes the MIME type of raw audio streams.<br>**Since**: 18<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 100| const char * OH_AVCODEC_MIMETYPE_AUDIO_G711A | Pointer to the key that describes the MIME type of the G.711 a-law audio decoder.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 101| const char * OH_ED_KEY_TIME_STAMP | Pointer to the key that describes the surface buffer timestamp. The value is of the int64_t type.<br>**Since**: 9<br>**Deprecated from**: 14<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 102| const char * OH_ED_KEY_EOS | Pointer to the key that describes the end of stream for the surface buffer. The value type is int32_t.<br>**Since**: 9<br>**Deprecated from**: 14<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 103| const char * OH_MD_KEY_TRACK_TYPE | Pointer to the key that describes the track type in a media file. The value type is int32_t. For details, see [OH_MediaType](#oh_mediatype).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 104| const char * OH_MD_KEY_CODEC_MIME | Pointer to the key that describes the MIME type of the codec. The value type is string.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 105| const char * OH_MD_KEY_DURATION | Pointer to the key that describes the duration in a media file, in microseconds. The value type is int64_t.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 106| const char * OH_MD_KEY_BITRATE | Pointer to the key that describes the bit rate. The value type is int64_t.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 107| const char * OH_MD_KEY_MAX_INPUT_SIZE | Pointer to the key that describes the maximum size of an input stream to decode. The value type is int32_t.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 108| const char * OH_MD_KEY_WIDTH | Pointer to the key that describes the video width. The value type is int32_t.<br>This key is used to set the display width of a video frame when **Configure** is called during video encoding and decoding.<br>For details about the development guide, see step 5 in surface mode or step 4 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 109| const char * OH_MD_KEY_HEIGHT | Pointer to the key that describes the video height. The value type is int32_t.<br>This key is used to set the display height of a video frame when **Configure** is called during video encoding and decoding.<br>For details about the development guide, see step 5 in surface mode or step 4 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 110| const char * OH_MD_KEY_PIXEL_FORMAT | Pointer to the key that describes the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat-1).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 111| const char * OH_MD_KEY_AUDIO_SAMPLE_FORMAT | Pointer to the key that describes the original audio format. The value type is int32_t. For details, see [OH_BitsPerSample](#oh_bitspersample).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 112| const char * OH_MD_KEY_FRAME_RATE | Pointer to the key that describes the video frame rate. The value type is double. The value must be greater than **0**.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 113| const char * OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE | Pointer to the key that describes the video encoding bit rate mode. The value type is int32_t. For details, see [OH_BitrateMode](#oh_bitratemode).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 114| const char * OH_MD_KEY_PROFILE | Pointer to the key that describes the encoding grading. The value type is int32_t. For details, see [OH_AVCProfile](#oh_avcprofile), [OH_HEVCProfile](#oh_hevcprofile), and [OH_AACProfile](#oh_aacprofile).<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 115| const char * OH_MD_KEY_AUD_CHANNEL_COUNT | Pointer to the key that describes the number of audio channels. The value type is int32_t.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 116| const char * OH_MD_KEY_AUD_SAMPLE_RATE | Pointer to the key that describes the audio sampling rate. The value type is int32_t.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 117| const char * OH_MD_KEY_I_FRAME_INTERVAL | Pointer 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.<br>A negative value indicates that only the first frame is a key frame, and a zero value indicates that all frames are key frames.<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 118| const char * OH_MD_KEY_ROTATION | Pointer to the key that describes the rotation angle of the surface. The value type is int32_t, and the value range is {0, 90, 180, 270}. The default value is 0.<br>This key is optional and is used only for video decoding in surface mode<br>**Since**: 9<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 119| const char * OH_MD_KEY_RANGE_FLAG | Pointer 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.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 120| const char * OH_MD_KEY_COLOR_PRIMARIES | Pointer to the key that describes the video primary colors. The value type is int32_t. For details, see [OH_ColorPrimary](#oh_colorprimary). The value complies with Table 2 in H.273.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 121| const char * OH_MD_KEY_TRANSFER_CHARACTERISTICS | Pointer to the key that describes the video transfer characteristics. The value type is int32_t. For details, see [OH_TransferCharacteristic](#oh_transfercharacteristic). The value complies with Table 3 in H.273.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 122| const char * OH_MD_KEY_MATRIX_COEFFICIENTS | Pointer to the key that describes the video matrix coefficients. The value type is int32_t. For details, see [OH_MatrixCoefficient](#oh_matrixcoefficient). The value complies with Table 4 in H.273.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 123| const char * OH_MD_KEY_REQUEST_I_FRAME | Pointer 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](_video_encoder.md#oh_videoencoder_setparameter) or takes effect immediately with each frame.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 124| const char * OH_MD_KEY_QUALITY | Pointer to the key that describes the required encoding quality. The value type is int32_t. In H.264 and H.265 encoding scenarios, the value range can be obtained by calling [OH_AVCapability_GetEncoderQualityRange](capi-native-avcapability-h.md#oh_avcapability_getencoderqualityrange). This key applies only to the encoder in constant quality mode.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 125| const char * OH_MD_KEY_CODEC_CONFIG | Pointer 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*. <!--Del-->(This key is not supported yet for the video codec.)<!--DelEnd--><br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 126| const char * OH_MD_KEY_TITLE | Pointer to the key that describes the title in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 127| const char * OH_MD_KEY_ARTIST | Pointer to the key that describes the lyrics in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 128| const char * OH_MD_KEY_ALBUM | Pointer to the key that describes the album in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 129| const char * OH_MD_KEY_ALBUM_ARTIST | Pointer to the key that describes the album artist of the input media. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 130| const char * OH_MD_KEY_DATE | Pointer to the key that describes the date in a media file, for example, 2024. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 131| const char * OH_MD_KEY_COMMENT | Pointer to the key that describes the comment in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 132| const char * OH_MD_KEY_GENRE | Pointer to the key that describes the genre in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 133| const char * OH_MD_KEY_COPYRIGHT | Pointer to the key that describes the copyright in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 134| const char * OH_MD_KEY_LANGUAGE | Pointer to the key that describes the language in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 135| const char * OH_MD_KEY_DESCRIPTION | Pointer to the key that describes the description in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 136| const char * OH_MD_KEY_LYRICS | Pointer to the key that describes the lyrics in a media file. The value type is string.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 137| const char * OH_MD_KEY_TRACK_COUNT | Pointer to the key that describes the number of tracks in a media file. The value type is int32_t.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 138| const char * OH_MD_KEY_CHANNEL_LAYOUT | Pointer 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](_core.md#oh_audiochannellayout-1).<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 139| const char * OH_MD_KEY_BITS_PER_CODED_SAMPLE | Pointer to the key that describes the number of bits per sample. The value type is int32_t.<br>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.<br>Starting from API version 20, you do not need to set it anymore.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 140| const char * OH_MD_KEY_AAC_IS_ADTS | Pointer 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.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 141| const char * OH_MD_KEY_SBR | Pointer to the key that describes the AAC SBR format. The value type is int32_t. This key applies to AAC encoders.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 142| const char * OH_MD_KEY_COMPLIANCE_LEVEL | Pointer to the key that describes the FLAC compliance level. The value type is int32_t. This key is used only for audio encoding.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 143| const char * OH_MD_KEY_IDENTIFICATION_HEADER | Pointer to the key that describes the vorbis identification header. The value type is uint8_t*. This key applies only to Vorbis decoders.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 144| const char * OH_MD_KEY_SETUP_HEADER | Pointer to the key that describes the vorbis setup header. The value type is uint8_t*. This key applies only to Vorbis decoders.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 145| const char * OH_MD_KEY_SCALING_MODE | Pointer to the key that describes the video scaling mode. The value type is int32_t. For details, see [OH_ScalingMode](#oh_scalingmode).<br>You are advised to set the scaling mode by calling [OH_NativeWindow_NativeWindowSetScalingModeV2](../apis-arkgraphics2d/capi-external-window-h.md#oh_nativewindow_nativewindowsetscalingmodev2). This key is optional and is used only for video decoding in surface mode.<br>**Since**: 10<br>**Deprecated from**: 14<br>**Substitute**: [OH_NativeWindow_NativeWindowSetScalingModeV2](../apis-arkgraphics2d/capi-external-window-h.md#oh_nativewindow_nativewindowsetscalingmodev2)<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 146| const char * OH_MD_MAX_INPUT_BUFFER_COUNT | Pointer to the key that describes the maximum number of input buffers. The value type is int32_t.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 147| const char * OH_MD_MAX_OUTPUT_BUFFER_COUNT | Pointer to the key that describes the maximum number of output buffers. The value type is int32_t.<br>**Since**: 10<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 148| const char * OH_MD_KEY_AUDIO_COMPRESSION_LEVEL | Pointer 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.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 149| const char * OH_MD_KEY_VIDEO_IS_HDR_VIVID | Pointer 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.<br>The value **1** means the HDR Vivid video track, and **0** means other cases.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 150| const char * OH_MD_KEY_AUDIO_OBJECT_NUMBER | Pointer 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.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 151| const char * OH_MD_KEY_AUDIO_VIVID_METADATA | Pointer to the key that describes the Audio Vivid metadata. The value type is uint8_t*. This key is used only for Audio Vivid decoding.<br>**Since**: 11<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 152| const char * OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNT | Pointer 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](capi-native-avcapability-h.md#oh_avcapability_getfeatureproperties) and the enumerated value **VIDEO_ENCODER_LONG_TERM_REFERENCE** in [OH_AVCapabilityFeature](capi-native-avcapability-h.md#oh_avcapabilityfeature) to query the maximum number.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 153| const char * OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITY | Pointer to the key that describes the enabled status of temporal scalability. The value type is int32_t. The value **1** means temporal scalability is enabled, and **0** means the opposite.<br>You can use the API [OH_AVCapability_IsFeatureSupported](capi-native-avcapability-h.md#oh_avcapability_isfeaturesupported) and the enumerated value **VIDEO_ENCODER_TEMPORAL_SCALABILITY** in [OH_AVCapabilityFeature](capi-native-avcapability-h.md#oh_avcapabilityfeature) to check whether the current video encoder supports temporal scalability. For details, see [Temporally Scalable Video Coding](../../media/avcodec/video-encoding-temporal-scalability.md#available-apis).<br>This key is optional and used only in the configuration phase of video encoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 154| const char * OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZE | Pointer 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.<br>This key is optional and used only in the configuration phase of video encoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 155| const char * OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODE | Pointer to the key that describes the reference mode in a temporal image group. The value type is int32_t. For details, see [OH_TemporalGopReferenceMode](#oh_temporalgopreferencemode). This key is valid only when temporal scalability is enabled.<br>This key is optional and used only in the configuration phase of video encoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 156| const char * OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNT | Pointer 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.<br>Before using this key, you can use the API [OH_AVCapability_GetFeatureProperties](capi-native-avcapability-h.md#oh_avcapability_getfeatureproperties) and the enumerated value **VIDEO_ENCODER_LONG_TERM_REFERENCE** in [OH_AVCapabilityFeature](capi-native-avcapability-h.md#oh_avcapabilityfeature) to query the number of supported LTR frames.<br>This key is optional and used only in the configuration phase of video encoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 157| const char * OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTR | Pointer to the key that specifies whether the current frame is marked as an LTR frame. The value type is int32_t. The value **1** means that the frame is marked as an LTR frame, and **0** means the opposite.<br>This key takes effect only after the number of LTR frames is configured.<br>This key is optional and is used only for video encoding input rotation. The configuration takes effect immediately.<br>For details, see [Temporally Scalable Video Coding](../../media/avcodec/video-encoding-temporal-scalability.md#available-apis).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 158| const char * OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTR | Pointer to the key that describes the POC number of the LTR frame referenced by the current frame. The value type is int32_t.<br>This key is optional and is used only for video encoding input rotation. The configuration takes effect immediately.<br>For details, see [Temporally Scalable Video Coding](../../media/avcodec/video-encoding-temporal-scalability.md#available-apis).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 159| const char * OH_MD_KEY_VIDEO_PER_FRAME_IS_LTR | Pointer 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. The value **1** means that the frame is an LTR frame, and **0** means the opposite.<br>This key is optional and is used only for video encoding output rotation.<br>It indicates the attribute of a frame.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 160| const char * OH_MD_KEY_VIDEO_PER_FRAME_POC | Pointer to the key that describes the POC of the frame. The value type is int32_t.<br>This key is optional and is used only for video encoding output rotation.<br>It indicates the attribute of a frame.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 161| const char * OH_MD_KEY_VIDEO_CROP_TOP | Pointer to the key that describes the top coordinate (y) of the cropped rectangle. The value type is int32_t.<br>The row at the top of the cropped rectangle is contained, and the row index starts from 0.<br>This key is used only for video decoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 162| const char * OH_MD_KEY_VIDEO_CROP_BOTTOM | Pointer to the key that describes the bottom coordinate (y) of the cropped rectangle. The value type is int32_t.<br>The row at the bottom of the cropped rectangle is contained, and the row index starts from 0.<br>This key is used only for video decoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 163| const char * OH_MD_KEY_VIDEO_CROP_LEFT | Pointer to the key that describes the left coordinate (x) of the cropped rectangle. The value type is int32_t.<br>The leftmost column of the cropped rectangle is contained, and the column index starts from 0.<br>This key is used only for video decoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 164| const char * OH_MD_KEY_VIDEO_CROP_RIGHT | Pointer to the key that describes the right coordinate (x) of the cropped rectangle. The value type is int32_t.<br>The rightmost column of the cropped rectangle is contained, and the column index starts from 0.<br>This key is used only for video decoding.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 165| const char * OH_MD_KEY_VIDEO_STRIDE | Pointer to the key that describes the stride of the video frame. The value type is int32_t.<br>The stride is the difference between the index of the pixel and the index of the pixel right below.<br>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.<br>For details, see step 3 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode).<br>For details about the image arrangement and usage examples of **width**, **height**, **wStride**, and **hStride**, see step 8 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode) or step 11 in buffer mode in [Video Decoding](../../media/avcodec/video-decoding.md#buffer-mode).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 166| const char * OH_MD_KEY_VIDEO_SLICE_HEIGHT | Pointer to the key that describes the height of the video frame. The value type is int32_t.<br>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.<br>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.<br>For details, see step 3 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode).<br>For details about the image arrangement and usage examples of **width**, **height**, **wStride**, and **hStride**, see step 8 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode) or step 11 in buffer mode in [Video Decoding](../../media/avcodec/video-decoding.md#buffer-mode).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 167| const char * OH_MD_KEY_VIDEO_PIC_WIDTH | Pointer to the key that describes the width of the video frame. The value type is int32_t.<br>When [OH_VideoDecoder_GetOutputDescription](_video_decoder.md#oh_videodecoder_getoutputdescription) is called during video decoding, the width can be parsed from the returned OH_AVFormat instance.<br>When the decoded output stream<!--RP2--><!--RP2End--> changes, the width can be parsed from the OH_AVForamt instance returned by [OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged).<br>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**.<br>For details about the image arrangement and usage examples of **width**, **height**, **wStride**, and **hStride**, see step 8 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode) or step 11 in buffer mode in [Video Decoding](../../media/avcodec/video-decoding.md#buffer-mode).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 168| const char * OH_MD_KEY_VIDEO_PIC_HEIGHT | Pointer to the key that describes the height of the video frame. The value type is int32_t.<br>When [OH_VideoDecoder_GetOutputDescription](_video_decoder.md#oh_videodecoder_getoutputdescription) is called during video decoding, the height can be parsed from the returned OH_AVFormat instance.<br>When the decoded output stream<!--RP2--><!--RP2End--> changes, the height can be parsed from the OH_AVForamt instance returned by [OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged).<br>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**.<br>For details about the image arrangement and usage examples of **width**, **height**, **wStride**, and **hStride**, see step 8 in buffer mode in [Video Encoding](../../media/avcodec/video-encoding.md#buffer-mode) or step 11 in buffer mode in [Video Decoding](../../media/avcodec/video-decoding.md#buffer-mode).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 169| const char * OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCY | Pointer to the key that describes the enabled status of low-latency video codec. The value type is int32_t. The value **1** means that low-latency video codec is enabled, and **0** means the opposite.<br>This key is optional and used only in the configuration phase.<br>If enabled, the input and output data held by the video encoder or decoder does not exceed the amount required by the codec standard.<br>If supported by the platform, the video decoder outputs frames in the decoding sequence when low-latency video codec is enabled.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 170| const char * OH_MD_KEY_VIDEO_ENCODER_QP_MAX | Pointer to the key that describes the maximum Quantization Parameter (QP) allowed by the video encoder. The value type is int32_t.<br>This key is used in the configuration or parameter setting phase or takes effect immediately with each frame.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 171| const char * OH_MD_KEY_VIDEO_ENCODER_QP_MIN | Pointer to the key that describes the minimum QP allowed by the video encoder. The value type is int32_t.<br>This key is used in the configuration or parameter setting phase or takes effect immediately with each frame.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 172| const char * OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGE | Pointer to the key that describes the average QP of video frames. The value type is int32_t.<br>Pointer to the key that describes the average QP value of the current frame encoding block. It is output with [OH_AVBuffer](_core.md#oh_avbuffer)<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 173| const char * OH_MD_KEY_VIDEO_ENCODER_MSE | Pointer to the key that describes the Mean Squared Error (MSE) of video frames. The value type is double.<br>Pointer to the key that describes the average MSE value of the current frame encoding block. It is output with [OH_AVBuffer](_core.md#oh_avbuffer)<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 174| const char * OH_MD_KEY_DECODING_TIMESTAMP | Pointer 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.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 175| const char * OH_MD_KEY_BUFFER_DURATION | Pointer 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.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 176| const char * OH_MD_KEY_VIDEO_SAR | Pointer to the key that describes the aspect ratio of the sample. The value type is double.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 177| const char * OH_MD_KEY_START_TIME | Pointer 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.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 178| const char * OH_MD_KEY_TRACK_START_TIME | Pointer to the key that describes the start time of the track, measured in microseconds. The value type is int64_t.<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 179| const char * OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE | Pointer to the key that describes the output color space of the video decoder. The value type is int32_t.<br>The supported value is **OH_COLORSPACE_BT709_LIMIT**. For details, see [OH_NativeBuffer_ColorSpace](../apis-arkgraphics2d/capi-buffer-common-h.md#oh_nativebuffer_colorspace).<br>It is used when [OH_VideoDecoder_Configure](_video_decoder.md#oh_videodecoder_configure) is called.<br>Before calling **OH_VideoDecoder_Start**, you must call **OH_VideoDecoder_Prepare**.<br>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.<br>If CSC function not supported, the error code **AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION** in [OH_AVErrCode](_core.md#oh_averrcode-1) is returned when [OH_VideoDecoder_Configure](_video_decoder.md#oh_videodecoder_configure) is called.<br>If the input video is not an HDR Vivid video, the callback function [OH_AVCodecOnError](#oh_avcodeconerror) is invoked to report the error code **AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION** in [OH_AVErrCode](_core.md#oh_averrcode-1).<br>**Since**: 12<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 180| const char * OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRR | Pointer to the key that specifies whether the decoder enables the video variable frame rate feature. The value type is int32_t.<br>**1** if enabled, **0** otherwise.<br>**Since**: 15<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 181| const char * OH_MD_KEY_CREATION_TIME | Pointer to the key that describes the media file creation time. The value type is string. The value must be in the UTC time format complying with ISO 8601. An example time format is 2024-12-28T00:00:00:000000Z.<br>**Since**: 14<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 182| const char * OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER | Pointer 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.<br>This key is used only in the configuration phase of video encoding in surface mode.<br>Configured value.<br>- 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.<br>- If the value is greater than 0, the last frame will be resubmitted repeatedly in the specified duration, measured in milliseconds.<br>**Since**: 18<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 183| const char * OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT | Pointer 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.<br>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.<br>Configured value.<br>- If the value is equal to 0, the request is intercepted in the configuration phase and **ERROR AV_ERR_INVALID_VAL** is returned.<br>- 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.<br>- 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.<br>**Since**: 18<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 184| const char * OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMS | Pointer 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.<br>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 (;).<br>**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.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 185| const char * OH_MD_KEY_SQR_FACTOR | Pointer 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.<br>It is used in the configuration or parameter setting phase.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 186| const char * OH_MD_KEY_MAX_BITRATE | Pointer to the key that describes the maximum bit rate in SQR mode. The value range can be obtained by calling [OH_AVCapability_GetEncoderBitrateRange](capi-native-avcapability-h.md#oh_avcapability_getencoderbitraterange) and is the same as that of **OH_MD_KEY_BITRATE**. The unit is bit/s.<br>It is used in the configuration or parameter setting phase.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 187| const char * OH_MD_KEY_VIDEO_ENCODER_ENABLE_PTS_BASED_RATECONTROL | Pointer 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.<br>This key is optional and used only for video encoding. The default value is **0**.<br>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](../apis-arkgraphics2d/capi-external-window-h.md#oh_nativewindow_nativewindowhandleopt), in units of nanosecond (ns). In buffer mode, the PTS is set by calling [OH_AVBuffer_SetBufferAttr](_core.md#oh_avbuffer_setbufferattr), in units of microsecond (us).<br>It is used in the configuration phase.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 188| const char * OH_MD_KEY_REFERENCE_TRACK_IDS | Pointer to the key that describes the reference relationship between media file tracks. The value type is int32_t\*.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 189| const char * OH_MD_KEY_TRACK_REFERENCE_TYPE | Pointer to the key that describes the auxiliary track type of a media file. The value type is string.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 190| const char * OH_MD_KEY_TRACK_DESCRIPTION | Pointer to the key that describes the auxiliary track description of a media file. The value type is string.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 191| const char * OH_MD_KEY_ENABLE_SYNC_MODE | Pointer to the key that describes the enabled status of video codec synchronization. The value type is int32_t. The value **1** means that low-latency video codec is enabled, and **0** means the opposite. This key is optional. The default value is **0**.<br>If this feature is enabled, pay attention to the following:<br> 1. The codec cannot have a callback function.<br> 2. You must use the buffer query API instead of the callback function.<br> 3. The key can be used only in the configuration phase.<br>**Since**: 20<br>**System capability**: SystemCapability.Multimedia.Media.CodecBase| 192 193## Enum Description 194 195### OH_MediaType 196 197``` 198enum OH_MediaType 199``` 200 201**Description** 202 203Enumerates the media types. 204 205**System capability**: SystemCapability.Multimedia.Media.CodecBase 206 207**Since**: 9 208 209| Value| Description| 210| -- | -- | 211| MEDIA_TYPE_AUD = 0 | Audio track.| 212| MEDIA_TYPE_VID = 1 | Video track.| 213| MEDIA_TYPE_SUBTITLE = 2 | Subtitle track.<br>**Since**: 12| 214| MEDIA_TYPE_TIMED_METADATA = 5 | Timed metadata track.<br>**Since**: 20| 215| MEDIA_TYPE_AUXILIARY = 6 | Auxiliary track.<br>**Since**: 20| 216 217### OH_AACProfile 218 219``` 220enum OH_AACProfile 221``` 222 223**Description** 224 225Enumerates the Advanced Audio Coding (AAC) profiles.<!--Del--><br>(**AAC_PROFILE_HE** and **AAC_PROFILE_HE_V2** are not available yet.)<!--DelEnd--> 226 227**System capability**: SystemCapability.Multimedia.Media.CodecBase 228 229**Since**: 9 230 231| Value| Description| 232| -- | -- | 233| AAC_PROFILE_LC = 0 | AAC profile of the low complexity level.| 234| AAC_PROFILE_HE | AAC profile of the high efficiency level. <!--Del-->(This specification is not available yet.)<!--DelEnd--><br>**Since**: 14| 235| AAC_PROFILE_HE_V2 | AAC profile of the high efficiency V2 level. <!--Del-->(This specification is not available yet.)<!--DelEnd--><br>**Since**: 14| 236 237### OH_AVCProfile 238 239``` 240enum OH_AVCProfile 241``` 242 243**Description** 244 245Enumerates the AVC profiles. 246 247**System capability**: SystemCapability.Multimedia.Media.CodecBase 248 249**Since**: 9 250 251| Value| Description| 252| -- | -- | 253| AVC_PROFILE_BASELINE = 0 | AVC baseline profile.| 254| AVC_PROFILE_HIGH = 4 | AVC high profile.| 255| AVC_PROFILE_MAIN = 8 | AVC main profile.| 256 257### OH_HEVCProfile 258 259``` 260enum OH_HEVCProfile 261``` 262 263**Description** 264 265Enumerates the HEVC profiles. 266 267**System capability**: SystemCapability.Multimedia.Media.CodecBase 268 269**Since**: 10 270 271| Value| Description| 272| -- | -- | 273| HEVC_PROFILE_MAIN = 0 | HEVC profile of the main level.| 274| HEVC_PROFILE_MAIN_10 = 1 | HEVC profile of the 10-bit main level.| 275| HEVC_PROFILE_MAIN_STILL = 2 | HEVC profile of the main still picture level.| 276| HEVC_PROFILE_MAIN_10_HDR10 = 3 | HEVC profile of the main 10 HDR10 level.<br>**Deprecated from**: 14| 277| HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4 | HEVC profile of the main 10 HDR10+ level.<br>**Deprecated from**: 14| 278 279### OH_VVCProfile 280 281``` 282enum OH_VVCProfile 283``` 284 285**Description** 286 287Enumerates the VVC profiles. 288 289**System capability**: SystemCapability.Multimedia.Media.CodecBase 290 291**Since**: 15 292 293| Value| Description| 294| -- | -- | 295| VVC_PROFILE_MAIN_10 = 1 | VVC profile of the 10-bit main level.| 296| VVC_PROFILE_MAIN_12 = 2 | VVC profile of the 12-bit main level.| 297| VVC_PROFILE_MAIN_12_INTRA = 10 | VVC profile of the 12-bit intra main level.| 298| VVC_PROFILE_MULTI_MAIN_10 = 17 | VVC profile of the 10-bit main level for multi-layer encoding.| 299| VVC_PROFILE_MAIN_10_444 = 33 | VVC profile of the 10-bit full-sample main level.| 300| VVC_PROFILE_MAIN_12_444 = 34 | VVC profile of the 12-bit full-sample main level.| 301| VVC_PROFILE_MAIN_16_444 = 36 | VVC profile of the 16-bit full-sample main level.| 302| VVC_PROFILE_MAIN_12_444_INTRA = 42 | VVC profile of the 12-bit full-sample intra main level.| 303| VVC_PROFILE_MAIN_16_444_INTRA = 44 | VVC profile of the 16-bit full-sample intra main level.| 304| VVC_PROFILE_MULTI_MAIN_10_444 = 49 | VVC profile of the 10-bit full-sample main level for multi-layer encoding.| 305| VVC_PROFILE_MAIN_10_STILL = 65 | VVC profile of the 10-bit still picture main level.| 306| VVC_PROFILE_MAIN_12_STILL = 66 | VVC profile of the 12-bit still picture main level.| 307| VVC_PROFILE_MAIN_10_444_STILL = 97 | VVC profile of the 10-bit full-sample still picture main level.| 308| VVC_PROFILE_MAIN_12_444_STILL = 98 | VVC profile of the 12-bit full-sample still picture main level.| 309| VVC_PROFILE_MAIN_16_444_STILL = 100 | VVC profile of the 16-bit full-sample still picture main level.| 310 311### OH_MPEG2Profile 312 313``` 314enum OH_MPEG2Profile 315``` 316 317**Description** 318 319Enumerates the MPEG2 profiles. 320 321**System capability**: SystemCapability.Multimedia.Media.CodecBase 322 323**Since**: 17 324 325| Value| Description| 326| -- | -- | 327| MPEG2_PROFILE_SIMPLE = 0 | Simple profile.| 328| MPEG2_PROFILE_MAIN = 1 | Main profile.| 329| MPEG2_PROFILE_SNR_SCALABLE = 2 | Signal-to-Noise Ratio (SNR) scalable profile.| 330| MPEG2_PROFILE_SPATIALLY_SCALABLE = 3 | Spatial scalable profile.| 331| MPEG2_PROFILE_HIGH = 4 | High profile.| 332| MPEG2_PROFILE_422 = 5 | 4:2:2 profile.| 333 334### OH_MPEG4Profile 335 336``` 337enum OH_MPEG4Profile 338``` 339 340**Description** 341 342Enumerates the MPEG4 profiles. 343 344**System capability**: SystemCapability.Multimedia.Media.CodecBase 345 346**Since**: 17 347 348| Value| Description| 349| -- | -- | 350| MPEG4_PROFILE_SIMPLE = 0 | Simple profile.| 351| MPEG4_PROFILE_SIMPLE_SCALABLE = 1 | Simple scalable profile.| 352| MPEG4_PROFILE_CORE = 2 | Core profile.| 353| MPEG4_PROFILE_MAIN = 3 | Main profile.| 354| MPEG4_PROFILE_N_BIT = 4 | N-bit profile.| 355| MPEG4_PROFILE_HYBRID = 5 | Hybrid profile.| 356| MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6 | Basic animated texture profile.| 357| MPEG4_PROFILE_SCALABLE_TEXTURE = 7 | Scalable texture profile.| 358| MPEG4_PROFILE_SIMPLE_FA = 8 | Simple FA profile.| 359| MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE = 9 | Advanced real-time simple profile.| 360| MPEG4_PROFILE_CORE_SCALABLE = 10 | Core scalable profile.| 361| MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11 | Advanced coding efficiency profile.| 362| MPEG4_PROFILE_ADVANCED_CORE = 12 | Advanced core profile.| 363| MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE = 13 | Advanced scalable texture profile.| 364| MPEG4_PROFILE_ADVANCED_SIMPLE = 17 | Advanced simple profile.| 365 366### OH_H263Profile 367 368``` 369enum OH_H263Profile 370``` 371 372**Description** 373 374Enumerates the H.263 profiles. 375 376**System capability**: SystemCapability.Multimedia.Media.CodecBase 377 378**Since**: 17 379 380| Value| Description| 381| -- | -- | 382| H263_PROFILE_BASELINE = 0 | Baseline profile.| 383| H263_PROFILE_VERSION_1_BACKWARD_COMPATIBILITY = 2 | Version 1 backward compatibility.| 384 385### OH_AVOutputFormat 386 387``` 388enum OH_AVOutputFormat 389``` 390 391**Description** 392 393Enumerates the output file formats supported by a muxer. 394 395**System capability**: SystemCapability.Multimedia.Media.CodecBase 396 397**Since**: 10 398 399| Value| Description| 400| -- | -- | 401| AV_OUTPUT_FORMAT_DEFAULT = 0 | Default format, which is MP4.| 402| AV_OUTPUT_FORMAT_MPEG_4 = 2 | MP4.| 403| AV_OUTPUT_FORMAT_M4A = 6 | M4A.| 404| AV_OUTPUT_FORMAT_AMR = 8 | AMR.<br>**Since**: 12| 405| AV_OUTPUT_FORMAT_MP3 = 9 | MP3.<br>**Since**: 12| 406| AV_OUTPUT_FORMAT_WAV = 10 | WAV.<br>**Since**: 12| 407| AV_OUTPUT_FORMAT_AAC = 11 | AAC.<br>**Since**: 18| 408| AV_OUTPUT_FORMAT_FLAC = 12 | FLAC.<br>**Since**: 20| 409 410### OH_AVSeekMode 411 412``` 413enum OH_AVSeekMode 414``` 415 416**Description** 417 418Enumerates the seek modes. 419 420**System capability**: SystemCapability.Multimedia.Media.CodecBase 421 422**Since**: 10 423 424| Value| Description| 425| -- | -- | 426| SEEK_MODE_NEXT_SYNC = 0 | Seeks to the next I-frame at the specified position. If there is no I-frame after the specified position, the seek operation may fail.| 427| SEEK_MODE_PREVIOUS_SYNC | Seeks to the previous I-frame at the specified position.| 428| SEEK_MODE_CLOSEST_SYNC | Seeks to the latest I-frame at the specified position.| 429 430### OH_ScalingMode 431 432``` 433enum OH_ScalingMode 434``` 435 436**Description** 437 438Enumerates the scaling modes. This enum is used only in surface mode. 439 440**System capability**: SystemCapability.Multimedia.Media.CodecBase 441 442**Since**: 10 443 444**Deprecated from**: 14 445 446**Substitute**: [OHScalingModeV2](../apis-arkgraphics2d/capi-external-window-h.md#ohscalingmodev2) 447 448| Value| Description| 449| -- | -- | 450| SCALING_MODE_SCALE_TO_WINDOW = 1 | Scales the image based on the window size.<br>**Deprecated from**: 14<br>**Substitute**: [OHScalingModeV2](../apis-arkgraphics2d/capi-external-window-h.md#ohscalingmodev2).OH_SCALING_MODE_SCALE_TO_WINDOW_V2| 451| SCALING_MODE_SCALE_CROP = 2 | Crops the image based on the window size.<br>**Deprecated from**: 14<br>**Substitute**: [OHScalingModeV2](../apis-arkgraphics2d/capi-external-window-h.md#ohscalingmodev2).OH_SCALING_MODE_SCALE_CROP_V2 | 452 453### OH_BitsPerSample 454 455``` 456enum OH_BitsPerSample 457``` 458 459**Description** 460 461Enumerates the number of audio bits for each coded sample. 462 463**System capability**: SystemCapability.Multimedia.Media.CodecBase 464 465**Since**: 10 466 467| Value| Description| 468| -- | -- | 469| SAMPLE_U8 = 0 | 8-bit unsigned integer sampling.| 470| SAMPLE_S16LE = 1 | 16-bit signed integer sampling.| 471| SAMPLE_S24LE = 2 | 24-bit signed integer sampling.| 472| SAMPLE_S32LE = 3 | 32-bit signed integer sampling.| 473| SAMPLE_F32LE = 4 | 32-bit floating-point sampling.| 474| SAMPLE_U8P = 5 | 8-bit unsigned integer plane sampling.| 475| SAMPLE_S16P = 6 | 16-bit signed integer plane sampling.| 476| SAMPLE_S24P = 7 | 24-bit signed integer plane sampling.| 477| SAMPLE_S32P = 8 | 32-bit signed integer plane sampling.| 478| SAMPLE_F32P = 9 | 32-bit floating-point plane sampling.| 479| INVALID_WIDTH = -1 | Invalid sampling format.| 480 481### OH_ColorPrimary 482 483``` 484enum OH_ColorPrimary 485``` 486 487**Description** 488 489Enumerates the primary colors. This enum is used for both encoding and decoding. 490 491**System capability**: SystemCapability.Multimedia.Media.CodecBase 492 493**Since**: 10 494 495| Value| Description| 496| -- | -- | 497| COLOR_PRIMARY_BT709 = 1 | BT.709 color gamut.| 498| COLOR_PRIMARY_UNSPECIFIED = 2 | Unspecified color gamut.| 499| COLOR_PRIMARY_BT470_M = 4 | BT.470 System M color gamut.| 500| COLOR_PRIMARY_BT601_625 = 5 | BT.601 625 color gamut.| 501| COLOR_PRIMARY_BT601_525 = 6 | BT.601 525 color gamut.| 502| COLOR_PRIMARY_SMPTE_ST240 = 7 | SMPTE ST 240 color gamut.| 503| COLOR_PRIMARY_GENERIC_FILM = 8 | Generic film color gamut.| 504| COLOR_PRIMARY_BT2020 = 9 | BT.2020 color gamut.| 505| COLOR_PRIMARY_SMPTE_ST428 = 10 | SMPTE ST 428 color gamut.| 506| COLOR_PRIMARY_P3DCI = 11 | DCI-P3 color gamut.| 507| COLOR_PRIMARY_P3D65 = 12 | P3-D65 color gamut.| 508 509### OH_TransferCharacteristic 510 511``` 512enum OH_TransferCharacteristic 513``` 514 515**Description** 516 517Enumerates the transfer characteristics. This enum is used for both encoding and decoding. 518 519**System capability**: SystemCapability.Multimedia.Media.CodecBase 520 521**Since**: 10 522 523| Value| Description| 524| -- | -- | 525| TRANSFER_CHARACTERISTIC_BT709 = 1 | BT.709 transfer function.| 526| TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2 | Unspecified transfer function.| 527| TRANSFER_CHARACTERISTIC_GAMMA_2_2 = 4 | Gamma 2-2 transfer function.| 528| TRANSFER_CHARACTERISTIC_GAMMA_2_8 = 5 | Gamma 2-8 transfer function.| 529| TRANSFER_CHARACTERISTIC_BT601 = 6 | BT.601 transfer function.| 530| TRANSFER_CHARACTERISTIC_SMPTE_ST240 = 7 | SMPTE ST 240 transfer function.| 531| TRANSFER_CHARACTERISTIC_LINEAR = 8 | Linear transfer function.| 532| TRANSFER_CHARACTERISTIC_LOG = 9 | Log transfer function.| 533| TRANSFER_CHARACTERISTIC_LOG_SQRT = 10 | Log SQRT transfer function.| 534| TRANSFER_CHARACTERISTIC_IEC_61966_2_4 = 11 | IEC61966-2.4 transfer function.| 535| TRANSFER_CHARACTERISTIC_BT1361 = 12 | BT.1361 transfer function.| 536| TRANSFER_CHARACTERISTIC_IEC_61966_2_1 = 13 | IEC61966 2.1 transfer function.| 537| TRANSFER_CHARACTERISTIC_BT2020_10BIT = 14 | BT.2020 10-bit transfer function.| 538| TRANSFER_CHARACTERISTIC_BT2020_12BIT = 15 | BT.2020 12-bit transfer function.| 539| TRANSFER_CHARACTERISTIC_PQ = 16 | PQ transfer function.| 540| TRANSFER_CHARACTERISTIC_SMPTE_ST428 = 17 | SMPTE ST.428 transfer function.| 541| TRANSFER_CHARACTERISTIC_HLG = 18 | HLG transfer function.| 542 543### OH_MatrixCoefficient 544 545``` 546enum OH_MatrixCoefficient 547``` 548 549**Description** 550 551Enumerates the matrix coefficients. This enum is used for both encoding and decoding. 552 553**System capability**: SystemCapability.Multimedia.Media.CodecBase 554 555**Since**: 10 556 557| Value| Description| 558| -- | -- | 559| MATRIX_COEFFICIENT_IDENTITY = 0 | Identity matrix.| 560| MATRIX_COEFFICIENT_BT709 = 1 | BT.709 conversion matrix.| 561| MATRIX_COEFFICIENT_UNSPECIFIED = 2 | Unspecified conversion matrix.| 562| MATRIX_COEFFICIENT_FCC = 4 | FCC conversion matrix.| 563| MATRIX_COEFFICIENT_BT601_625 = 5 | BT.601 625 conversion matrix.| 564| MATRIX_COEFFICIENT_BT601_525 = 6 | BT.601 525 conversion matrix.| 565| MATRIX_COEFFICIENT_SMPTE_ST240 = 7 | SMPTE ST 240 conversion matrix.| 566| MATRIX_COEFFICIENT_YCGCO = 8 | YCgCo conversion matrix.| 567| MATRIX_COEFFICIENT_BT2020_NCL = 9 | BT.2020 NCL conversion matrix.| 568| MATRIX_COEFFICIENT_BT2020_CL = 10 | BT.2020 CL conversion matrix.| 569| MATRIX_COEFFICIENT_SMPTE_ST2085 = 11 | SMPTE ST 2085 conversion matrix.| 570| MATRIX_COEFFICIENT_CHROMATICITY_NCL = 12 | Chromaticity NCL conversion matrix.| 571| MATRIX_COEFFICIENT_CHROMATICITY_CL = 13 | Chromaticity CL conversion matrix.| 572| MATRIX_COEFFICIENT_ICTCP = 14 | ICTCP conversion matrix.| 573 574### OH_AVCLevel 575 576``` 577enum OH_AVCLevel 578``` 579 580**Description** 581 582Enumerates the AVC levels. 583 584**System capability**: SystemCapability.Multimedia.Media.CodecBase 585 586**Since**: 12 587 588| Value| Description| 589| -- | -- | 590| AVC_LEVEL_1 = 0 | Level 1.| 591| AVC_LEVEL_1b = 1 | Level 1b.| 592| AVC_LEVEL_11 = 2 | Level 1.1.| 593| AVC_LEVEL_12 = 3 | Level 1.2.| 594| AVC_LEVEL_13 = 4 | Level 1.3.| 595| AVC_LEVEL_2 = 5 | Level 2.| 596| AVC_LEVEL_21 = 6 | Level 2.1.| 597| AVC_LEVEL_22 = 7 | Level 2.2.| 598| AVC_LEVEL_3 = 8 | Level 3.| 599| AVC_LEVEL_31 = 9 | Level 3.1.| 600| AVC_LEVEL_32 = 10 | Level 3.2.| 601| AVC_LEVEL_4 = 11 | Level 4.| 602| AVC_LEVEL_41 = 12 | Level 4.1.| 603| AVC_LEVEL_42 = 13 | Level 4.2.| 604| AVC_LEVEL_5 = 14 | Level 5.| 605| AVC_LEVEL_51 = 15 | Level 5.1.| 606| AVC_LEVEL_52 = 16 | Level 5.2.| 607| AVC_LEVEL_6 = 17 | Level 6.| 608| AVC_LEVEL_61 = 18 | Level 6.1.| 609| AVC_LEVEL_62 = 19 | Level 6.2.| 610 611### OH_HEVCLevel 612 613``` 614enum OH_HEVCLevel 615``` 616 617**Description** 618 619Enumerates the HEVC levels. 620 621**System capability**: SystemCapability.Multimedia.Media.CodecBase 622 623**Since**: 12 624 625| Value| Description| 626| -- | -- | 627| HEVC_LEVEL_1 = 0 | Level 1.| 628| HEVC_LEVEL_2 = 1 | Level 2.| 629| HEVC_LEVEL_21 = 2 | Level 2.1.| 630| HEVC_LEVEL_3 = 3 | Level 3.| 631| HEVC_LEVEL_31 = 4 | Level 3.1.| 632| HEVC_LEVEL_4 = 5 | Level 4.| 633| HEVC_LEVEL_41 = 6 | Level 4.1.| 634| HEVC_LEVEL_5 = 7 | Level 5.| 635| HEVC_LEVEL_51 = 8 | Level 5.1.| 636| HEVC_LEVEL_52 = 9 | Level 5.2.| 637| HEVC_LEVEL_6 = 10 | Level 6.| 638| HEVC_LEVEL_61 = 11 | Level 6.1.| 639| HEVC_LEVEL_62 = 12 | Level 6.2.| 640 641### OH_VVCLevel 642 643``` 644enum OH_VVCLevel 645``` 646 647**Description** 648 649Enumerates the VVC levels. 650 651**System capability**: SystemCapability.Multimedia.Media.CodecBase 652 653**Since**: 15 654 655| Value| Description| 656| -- | -- | 657| VVC_LEVEL_1 = 16 | Level 1.0.| 658| VVC_LEVEL_2 = 32 | Level 2.0.| 659| VVC_LEVEL_21 = 35 | Level 2.1.| 660| VVC_LEVEL_3 = 48 | Level 3.0.| 661| VVC_LEVEL_31 = 51 | Level 3.1.| 662| VVC_LEVEL_4 = 64 | Level 4.0.| 663| VVC_LEVEL_41 = 67 | Level 4.1.| 664| VVC_LEVEL_5 = 80 | Level 5.0.| 665| VVC_LEVEL_51 = 83 | Level 5.1.| 666| VVC_LEVEL_52 = 86 | Level 5.2.| 667| VVC_LEVEL_6 = 96 | Level 6.0.| 668| VVC_LEVEL_61 = 99 | Level 6.1.| 669| VVC_LEVEL_62 = 102 | Level 6.2.| 670| VVC_LEVEL_63 = 105 | Level 6.3.| 671| VVC_LEVEL_155 = 255 | Level 15.5.| 672 673### OH_MPEG2Level 674 675``` 676enum OH_MPEG2Level 677``` 678 679**Description** 680 681Enumerates the MPEG2 levels. 682 683**System capability**: SystemCapability.Multimedia.Media.CodecBase 684 685**Since**: 17 686 687| Value| Description| 688| -- | -- | 689| MPEG2_LEVEL_LOW = 0 | Low level.| 690| MPEG2_LEVEL_MAIN = 1 | Main level.| 691| MPEG2_LEVEL_HIGH_1440 = 2 | High 1440 level.| 692| MPEG2_LEVEL_HIGH = 3 | High level.| 693 694### OH_MPEG4Level 695 696``` 697enum OH_MPEG4Level 698``` 699 700**Description** 701 702Enumerates the MPEG4 levels. 703 704**System capability**: SystemCapability.Multimedia.Media.CodecBase 705 706**Since**: 17 707 708| Value| Description| 709| -- | -- | 710| MPEG4_LEVEL_0 = 0 | Level 0.| 711| MPEG4_LEVEL_0B = 1 | Level 0B.| 712| MPEG4_LEVEL_1 = 2 | Level 1.| 713| MPEG4_LEVEL_2 = 3 | Level 2.| 714| MPEG4_LEVEL_3 = 4 | Level 3.| 715| MPEG4_LEVEL_3B = 5 | Level 3B.| 716| MPEG4_LEVEL_4 = 6 | Level 4.| 717| MPEG4_LEVEL_4A = 7 | Level 4A.| 718| MPEG4_LEVEL_5 = 8 | Level 5.| 719| MPEG4_LEVEL_6 = 9 | Level 6.| 720 721### OH_H263Level 722 723``` 724enum OH_H263Level 725``` 726 727**Description** 728 729Enumerates the H.263 levels. 730 731**System capability**: SystemCapability.Multimedia.Media.CodecBase 732 733**Since**: 17 734 735| Value| Description| 736| -- | -- | 737| H263_LEVEL_10 = 0 | Level 10.| 738| H263_LEVEL_20 = 1 | Level 20.| 739| H263_LEVEL_30 = 2 | Level 30.| 740| H263_LEVEL_40 = 3 | Level 40.| 741| H263_LEVEL_45 = 4 | Level 45.| 742| H263_LEVEL_50 = 5 | Level 50.| 743| H263_LEVEL_60 = 6 | Level 60.| 744| H263_LEVEL_70 = 7 | Level 70.| 745 746### OH_TemporalGopReferenceMode 747 748``` 749enum OH_TemporalGopReferenceMode 750``` 751 752**Description** 753 754Enumerates the reference modes of temporal image groups. 755 756**System capability**: SystemCapability.Multimedia.Media.CodecBase 757 758**Since**: 12 759 760| Value| Description| 761| -- | -- | 762| ADJACENT_REFERENCE = 0 | Refers to the nearest short-term reference frame.| 763| JUMP_REFERENCE = 1 | Refers to the latest LTR frame.| 764| UNIFORMLY_SCALED_REFERENCE = 2 | Drops video frames at the highest level, and evenly distributes the remaining frames. The number of temporal image groups must be a power of 2.| 765 766### OH_BitrateMode 767 768``` 769enum OH_BitrateMode 770``` 771 772**Description** 773 774Enumerates the bit rate modes of an encoder. 775 776**System capability**: SystemCapability.Multimedia.Media.CodecBase 777 778**Since**: 10 779 780| Value| Description| 781| -- | -- | 782| BITRATE_MODE_CBR = 0 | Constant bit rate.| 783| BITRATE_MODE_VBR = 1 | Variable bit rate.| 784| BITRATE_MODE_CQ = 2 | Constant quality.| 785| BITRATE_MODE_SQR = 3 | Stable quality. It is supported only for H.265 (HEVC).<br>**Since**: 20| 786 787 788## Function Description 789 790### OH_AVCodecOnError() 791 792``` 793typedef void (*OH_AVCodecOnError)(OH_AVCodec *codec, int32_t errorCode, void *userData) 794``` 795 796**Description** 797 798Defines the pointer to the function that is called to report error information when an error occurs during the running of an OH_AVCodec instance. 799 800| Use Case| Error Code| 801| -------- | -------- | 802| Audio encoding/decoding| **AV_ERR_DRM_DECRYPT_FAILED**: DRM decryption failed. | 803| Video encoding/decoding| **AV_ERROR_NO_MEMORY**: System resources are insufficient.<br>**AV_ERROR_UNKNOWN**: An unknown error occurs. Analyze the error based on specific logs.<br>**AV_ERR_SERVICE_DIED**: The service is dead. | 804| Video decoding| **AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION**: The current input does not support CSC. | 805<!--RP1--><!--RP1End--> 806 807**System capability**: SystemCapability.Multimedia.Media.CodecBase 808 809**Since**: 9 810 811 812**Parameters** 813 814| Name| Description| 815| -- | -- | 816| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 817| int32_t errorCode | Error code.| 818| void *userData | Pointer to the data on which the caller depends when executing the callback.| 819 820### OH_AVCodecOnStreamChanged() 821 822``` 823typedef void (*OH_AVCodecOnStreamChanged)(OH_AVCodec *codec, OH_AVFormat *format, void *userData) 824``` 825 826**Description** 827 828Defines 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.<br>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 <!--RP3--><!--RP3End-->AAC, FLAC, MP3, and VORBIS.<br>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. 829 830**System capability**: SystemCapability.Multimedia.Media.CodecBase 831 832**Since**: 9 833 834 835**Parameters** 836 837| Name| Description| 838| -- | -- | 839| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 840| [OH_AVFormat](_core.md#oh_avformat) *format | Pointer to the description information about the new output stream.| 841| void *userData | Pointer to the data on which the caller depends when executing the callback.| 842 843### OH_AVCodecOnNeedInputData() 844 845``` 846typedef void (*OH_AVCodecOnNeedInputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) 847``` 848 849**Description** 850 851Defines 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. 852 853**System capability**: SystemCapability.Multimedia.Media.CodecBase 854 855**Since**: 9 856 857**Deprecated from**: 11 858 859**Substitute**: [OH_AVCodecOnNeedInputBuffer](#oh_avcodeconneedinputbuffer) 860 861 862**Parameters** 863 864| Name| Description| 865| -- | -- | 866| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 867| uint32_t index | Index of the new input buffer.| 868| [OH_AVMemory](_core.md#oh_avmemory) *data | Pointer to the data to fill in the new input buffer.| 869| void *userData | Pointer to the data on which the caller depends when executing the callback.| 870 871### OH_AVCodecOnNewOutputData() 872 873``` 874typedef void (*OH_AVCodecOnNewOutputData)(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data,OH_AVCodecBufferAttr *attr, void *userData) 875``` 876 877**Description** 878 879Defines 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. 880 881**System capability**: SystemCapability.Multimedia.Media.CodecBase 882 883**Since**: 9 884 885**Deprecated from**: 11 886 887**Substitute**: [OH_AVCodecOnNewOutputBuffer](#oh_avcodeconnewoutputbuffer) 888 889 890**Parameters** 891 892| Name| Description| 893| -- | -- | 894| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 895| uint32_t index | Index of the new output buffer.| 896| [OH_AVMemory](_core.md#oh_avmemory) *data | Pointer to the data filled in the new output buffer.| 897| [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) *attr | Description of the new output buffer.| 898| void *userData | Pointer to the data on which the caller depends when executing the callback.| 899 900### OH_AVCodecOnNeedInputBuffer() 901 902``` 903typedef void (*OH_AVCodecOnNeedInputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData) 904``` 905 906**Description** 907 908Defines 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. 909 910**System capability**: SystemCapability.Multimedia.Media.CodecBase 911 912**Since**: 11 913 914 915**Parameters** 916 917| Name| Description| 918| -- | -- | 919| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 920| uint32_t index | Index of the new input buffer.| 921| [OH_AVBuffer](_core.md#oh_avbuffer) *buffer | Pointer to the data to fill in the new input buffer.| 922| void *userData | Pointer to the data on which the caller depends when executing the callback.| 923 924### OH_AVCodecOnNewOutputBuffer() 925 926``` 927typedef void (*OH_AVCodecOnNewOutputBuffer)(OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData) 928``` 929 930**Description** 931 932Defines 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. 933 934**System capability**: SystemCapability.Multimedia.Media.CodecBase 935 936**Since**: 11 937 938 939**Parameters** 940 941| Name| Description| 942| -- | -- | 943| [OH_AVCodec](capi-codecbase-oh-avcodec.md) *codec | Pointer to an OH_AVCodec instance.| 944| uint32_t index | Index of the new output buffer.| 945| [OH_AVBuffer](_core.md#oh_avbuffer) *buffer | Pointer to the data filled in the new output buffer.| 946| void *userData | Pointer to the data on which the caller depends when executing the callback.| 947 948### OH_AVDataSourceReadAt() 949 950``` 951typedef int32_t (*OH_AVDataSourceReadAt)(OH_AVBuffer *data, int32_t length, int64_t pos) 952``` 953 954**Description** 955 956Defines a function pointer used to provide the capability of obtaining user-defined media data. 957 958**System capability**: SystemCapability.Multimedia.Media.CodecBase 959 960**Since**: 12 961 962 963**Parameters** 964 965| Name| Description| 966| -- | -- | 967| [OH_AVBuffer](_core.md#oh_avbuffer) *data | Pointer to the buffer to be filled in.| 968| int32_t length | Length of the data to read.| 969| int64_t pos | Offset from which the data is read.| 970 971**Returns** 972 973| Type| Description| 974| -- | -- | 975| int32_t | Actual length of the data read to the buffer.| 976 977### OH_AVDataSourceReadAtExt() 978 979``` 980typedef int32_t (*OH_AVDataSourceReadAtExt)(OH_AVBuffer *data, int32_t length, int64_t pos, void *userData) 981``` 982 983**Description** 984 985Defines a function pointer used to provide the capability of obtaining user-defined media data. 986 987**System capability**: SystemCapability.Multimedia.Media.CodecBase 988 989**Since**: 20 990 991 992**Parameters** 993 994| Name| Description| 995| -- | -- | 996| [OH_AVBuffer](_core.md#oh_avbuffer) *data | Pointer to the buffer to be filled in.| 997| int32_t length | Length of the data to read.| 998| int64_t pos | Offset from which the data is read.| 999| void *userData | Pointer to user-defined data.| 1000 1001**Returns** 1002 1003| Type| Description| 1004| -- | -- | 1005| int32_t | Actual length of the data read to the buffer.| 1006 1007<!--no_check-->