openharmony 鸿蒙 capi-codecbase

2026-08-25 浏览 (1)

CodecBase

Overview

The CodecBase module provides the variables, attributes, and functions for basic audio and video multiplexing, demultiplexing, encoding, and decoding.

System capability: SystemCapability.Multimedia.Media.CodecBase

Since: 9

Files

NameDescription
avcodec_audio_channel_layout.hDeclares the enums used for audio codec channel layouts.
native_avcodec_base.hDeclares the native APIs used for basic audio and video multiplexing, demultiplexing, encoding, and decoding.

Media Codec Formats

The table below lists the media codec formats. The type is a constant string.

NameDescription
OH_AVCODEC_MIMETYPE_AUDIO_AACMIME type of the AAC audio codec.
OH_AVCODEC_MIMETYPE_AUDIO_FLACMIME type of the FLAC audio codec.
OH_AVCODEC_MIMETYPE_AUDIO_OPUSMIME type of the Opus audio codec. (This specification is not available yet.)
OH_AVCODEC_MIMETYPE_AUDIO_G711MUMIME type of the G.711 mu-law audio codec.
OH_AVCODEC_MIMETYPE_AUDIO_G711AMIME type of the G.711 a-law audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_RAWMIME type of raw audio streams.
OH_AVCODEC_MIMETYPE_AUDIO_VORBISMIME type of the Vorbis audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_MPEGMIME type of the MP3 audio codec.
OH_AVCODEC_MIMETYPE_AUDIO_VIVIDMIME type of the Audio Vivid audio decoder. (This specification is not available yet.)
OH_AVCODEC_MIMETYPE_AUDIO_AMR_NBMIME type of the AMR-NB audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_AMR_WBMIME type of the AMR-WB audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_APEMIME type of the APE audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_ALACMIME type of the Apple Lossless Audio Codec (ALAC) audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_AC3MIME type of the Dolby Audio Coding 3 (AC 3) audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_EAC3MIME type of the Enhanced AC-3 (EAC3) audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_WMAV1MIME type of the Windows Media Audio (WMA) V1 audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_WMAV2MIME type of the WMA V2 audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_WMAPROMIME type of the WMA Pro audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_GSMMIME type of the Global System for Mobile Communications (GSM) audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_GSM_MSMIME type of the GSM Microsoft variant (MS) audio decoder.
OH_AVCODEC_MIMETYPE_AUDIO_TWINVQMIME type of the Transform-domain Weighted Interleave Vector Quantization (TWINVQ) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_AUDIO_ILBCMIME type of the Internet Low Bitrate Codec (ILBC) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_AUDIO_TRUEHDMIME type of the True High Definition (TRUEHD) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_AUDIO_DVAUDIOMIME type of the DVAUDIO (Digital Video Audio) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_AUDIO_DTSMIME type of the DTS (Digital Theater Systems) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_AUDIO_COOKMIME type of the Cook (RealAudio Cook) audio decoder.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_VVCMIME type of the VVC (H.266) video codec.
OH_AVCODEC_MIMETYPE_VIDEO_HEVCMIME type of the HEVC (H.265) video codec.
OH_AVCODEC_MIMETYPE_VIDEO_AVCMIME type of the AVC (H.264) video codec.
OH_AVCODEC_MIMETYPE_VIDEO_H263MIME type of the H.263 video codec.
OH_AVCODEC_MIMETYPE_VIDEO_VC1MIME type of the VC-1 video codec.
This specification is supported since API version 22.
OH_AVCODEC_MIMETYPE_VIDEO_MSVIDEO1MIME type of the Microsoft Video 1 (MSVIDEO1) video codec.
This specification is supported since API version 22.
OH_AVCODEC_MIMETYPE_VIDEO_WMV3MIME type of the WMV3 video codec.
This specification is supported since API version 22.
OH_AVCODEC_MIMETYPE_VIDEO_MJPEGMIME type of the Motion JPEG (MJPEG) video codec.
This specification is supported since API version 22.
OH_AVCODEC_MIMETYPE_VIDEO_MPEG4MIME type of the MPEG4 video encoder, which is used only for multiplexing MPEG4 video streams. (It is deprecated from API version 11.)
OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2MIME type of the MPEG4 Part 2 video codec.
OH_AVCODEC_MIMETYPE_VIDEO_MPEG2MIME type of the MPEG2 video codec.
OH_AVCODEC_MIMETYPE_VIDEO_AV1MIME type of the AV1 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_VP9MIME type of the VP9 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_VP8MIME type of the VP8 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_RV30MIME type of the RV30 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_RV40MIME type of the RV40 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_WVC1MIME type of the WVC1 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_DVVIDEOMIME type of the DVVIDEO (Digital Video) video codec. Supports DV NTSC, DV PAL, and DVCPRO HD.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_RAWVIDEOMIME type of the RAWVIDEO video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_MPEG1MIME type of the MPEG1 video codec.
This specification is supported since API version 23.
OH_AVCODEC_MIMETYPE_VIDEO_CINEPAKMIME type of the Cinepak video codec.
This key is supported since API version 24.
OH_AVCODEC_MIMETYPE_IMAGE_JPGMIME type of the JPG image encoder, which is used only for multiplexing JPG covers.
OH_AVCODEC_MIMETYPE_IMAGE_PNGMIME type of the PNG image encoder, which is used only for multiplexing PNG covers.
OH_AVCODEC_MIMETYPE_IMAGE_BMPMIME type of the BMP image encoder, which is used only for multiplexing BMP covers.
OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTTMIME type of the WEBVTT subtitle demuxer.
OH_AVCODEC_MIMETYPE_SUBTITLE_SRTMIME type of the SRT subtitle demuxer.

Media Data Key-Value Pairs

The tables below list the key-value pairs used to describe media data. The key type is a constant string, and the value type can be int32_t, int64_t, float, double, char *, or uint8_t *.

The OH_AVFormat API is used to configure or query parameters.

Key-Value Pairs Dedicated for Capability Query

NameDescription
OH_FEATURE_PROPERTY_KEY_VIDEO_ENCODER_MAX_LTR_FRAME_COUNTMaximum number of long-term reference (LTR) frames obtained during video encoding. The value type is int32_t.

Common Key-value Pairs of Audio and Video

NameDescription
OH_MD_KEY_CODEC_CONFIGCodec-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 optional. (This key is not supported yet for the video codec.)
OH_MD_MAX_INPUT_BUFFER_COUNTMaximum number of input buffers. The value type is int32_t. This key is optional.
OH_MD_MAX_OUTPUT_BUFFER_COUNTMaximum number of output buffers. The value type is int32_t. This key is optional.
OH_MD_KEY_BITRATEBit rate. The value type is int64_t. This key is used in audio and video encoding scenarios. It is optional in video encoding scenarios.
OH_MD_KEY_PROFILEEncoding grading. The value type is int32_t. For details, see OH_AVCProfile, OH_HEVCProfile, and OH_AACProfile. This key is optional.
OH_MD_KEY_MAX_INPUT_SIZEMaximum size of an input stream to decode. The value type is int32_t. This key is optional.
OH_MD_KEY_ENABLE_SYNC_MODEEnabled status of audio/video codec synchronization. The value type is int32_t. 1 if enabled, 0 otherwise. This key is optional. By default, the feature is disabled. The key is used in the configuration phase.

Key-Value Pairs Dedicated for Video

NameDescription
OH_ED_KEY_TIME_STAMPSurface buffer timestamp. The value is of the int64_t type. This key is optional. (It is deprecated from API version 14.)
OH_ED_KEY_EOSEnd of stream for the surface buffer. The value type is int32_t. This key is optional. (It is deprecated from API version 14.)
OH_MD_KEY_WIDTHVideo width. The value type is int32_t.
OH_MD_KEY_HEIGHTVideo height. The value type is int32_t.
OH_MD_KEY_PIXEL_FORMATVideo pixel format. The value type is int32_t. For details, see OH_AVPixelFormat.
OH_MD_KEY_FRAME_RATEVideo frame rate. The value type is double. This key is optional.
OH_MD_KEY_RANGE_FLAGVideo YUV value range flag. The value type is int32_t. The value 1 means a full range, and 0 means a limited range. This key is optional.
OH_MD_KEY_COLOR_PRIMARIESVideo primary colors. The value type is int32_t. For details, see OH_ColorPrimary. The value complies with Table 2 in H.273. This key is optional.
OH_MD_KEY_TRANSFER_CHARACTERISTICSVideo transfer characteristics. The value type is int32_t. For details, see OH_TransferCharacteristic. The value complies with Table 3 in H.273. This key is optional.
OH_MD_KEY_MATRIX_COEFFICIENTSVideo matrix coefficients. The value type is int32_t. For details, see OH_MatrixCoefficient. The value complies with Table 4 in H.273. This key is optional.
OH_MD_KEY_VIDEO_STRIDEStride of the video frame. The value type is int32_t. This key is optional.
OH_MD_KEY_VIDEO_SLICE_HEIGHTHeight of the video frame. The value type is int32_t. This key is optional.
OH_MD_KEY_VIDEO_PIC_WIDTHWidth of the video frame. The value type is int32_t. This key is optional.
OH_MD_KEY_VIDEO_PIC_HEIGHTHeight of the video frame. The value type is int32_t. This key is optional.
OH_MD_KEY_VIDEO_ENABLE_LOW_LATENCYEnabled status of low-latency video codec. The value type is int32_t. 1 if enabled, 0 otherwise. This key is optional. By default, the feature is disabled. The key is used in the configuration phase.
OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODEVideo encoding bit rate mode. The value type is int32_t. For details, see OH_BitrateMode. This key is optional.
OH_MD_KEY_QUALITYRequired encoding quality. The value type is int32_t. This key applies only to encoders configured in constant quality mode. This key is optional.
OH_MD_KEY_REQUEST_I_FRAMERequest for immediate encoding of I-frames. The value type is int32_t. This key is optional.
OH_MD_KEY_I_FRAME_INTERVALKey frame interval, in milliseconds. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_ENABLE_TEMPORAL_SCALABILITYEnabled status of temporal scalability. The value type is int32_t. 1 if enabled, 0 otherwise. This key is optional and used only for video encoding. By default, this feature is disabled. The key is used in the configuration phase.
OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_SIZESize 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.
OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_GOP_REFERENCE_MODEReference 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.
OH_MD_KEY_VIDEO_ENCODER_TEMPORAL_LAYER_IDTemporal layer ID in a group of pictures (GOP). The value type is int32_t.
Currently, this key is used only to query the temporal layer ID carried in AVBuffer output by the encoder.
The procedure is as follows:
1. Use OH_AVCodecOnNewOutputBuffer or OH_VideoEncoder_GetOutputBuffer to obtain the buffer instance (AVBuffer).
2. Use OH_AVBuffer_GetParameter to obtain the parameter instance (OH_AVFormat), which does not contain basic properties.
3. Use OH_AVFormat_GetIntValue and this key to obtain the temporal layer ID of the corresponding frame.
Since: 26.0.0
OH_MD_KEY_VIDEO_ENCODER_LTR_FRAME_COUNTNumber of LTR frames. The value type is int32_t. The value must be within the supported value range. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_MARK_LTRWhether the current frame is marked as an LTR frame. The value type is int32_t. 1 if marked, 0 otherwise. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_PER_FRAME_USE_LTRPOC 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.
OH_MD_KEY_VIDEO_PER_FRAME_IS_LTRWhether 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. This key is optional and used only for video encoding. The default value is 0.
OH_MD_KEY_VIDEO_PER_FRAME_POCPOC number of the frame. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_QP_MAXMaximum Quantization Parameter (QP) allowed by the video encoder. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_QP_MINMinimum QP allowed by the video encoder. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_QP_AVERAGEAverage QP of video frames. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_MSEMean Squared Error (MSE) of video frames. The value type is double. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTERDuration (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.
OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNTMaximum 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.
OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACEOutput color space of the video decoder. The value type is int32_t. The supported value is OH_COLORSPACE_BT709_LIMIT.
OH_MD_KEY_ROTATIONRotation 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 This key is optional.
OH_MD_KEY_SCALING_MODEVideo scaling mode. The value type is int32_t. For details, see OH_ScalingMode. This key is optional and is used only for video decoding in surface mode. You are advised to set the scaling mode by calling OH_NativeWindow_NativeWindowSetScalingModeV2. (It is deprecated from API version 14.)
OH_MD_KEY_VIDEO_CROP_TOPY-coordinate of the top edge of the crop rectangle. The value type is int32_t. This key is optional and is used only for video decoding.
OH_MD_KEY_VIDEO_CROP_BOTTOMY-coordinate of the bottom edge of the crop rectangle. The value type is int32_t. This key is optional and is used only for video decoding.
OH_MD_KEY_VIDEO_CROP_LEFTX-coordinate of the left edge of the crop rectangle. The value type is int32_t. This key is optional and is used only for video decoding.
OH_MD_KEY_VIDEO_CROP_RIGHTX-coordinate of the right edge of the crop rectangle. The value type is int32_t. This key is optional and is used only for video decoding.
OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRRWhether the decoder enables the video variable frame rate feature. The value type is int32_t. This key is optional and is used only for video decoding.
OH_MD_KEY_SQR_FACTORQuality 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. The value type is int32_t. This key is optional and is used only for video encoding.
OH_MD_KEY_MAX_BITRATEMaximum 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. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_ROI_PARAMSROI encoding parameters, including the ROI area and deltaQp. The value type is char *. This key is optional and is used only for video encoding.
OH_MD_KEY_VIDEO_ENCODER_ENABLE_PTS_BASED_RATECONTROLKey for enabling the PTS-based bit rate control mode. The value type is int32_t. 1 to enable, 0 otherwise. This key is optional and used only for video encoding. The default value is 0. If this feature is enabled, each video frame must contain PTS information and be sent to the encoder. It is used in the configuration phase.
OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAMEKey for enabling bidirectional predictive frame (B-frame) encoding. The value type is int32_t. 1 to enable, 0 otherwise. This key is optional and used only for video encoding. The default value is 0.
If enabled, the video encoder uses B-frame encoding, resulting in a decoding sequence different from the display sequence.
For a device that does not support B-frame encoding, the configured key does not take effect.
To check the device capability, use the OH_AVCapability_IsFeatureSupported API and the enumerated value OH_AVCapabilityFeature.VIDEO_ENCODER_B_FRAME.
This key is used only by calling OH_VideoEncoder_Configure.
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 feature is supported, 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.
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 feature is enabled, the video decoder outputs blank frames (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.
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.

Key-Value Pairs Dedicated for Audio

NameDescription
OH_MD_KEY_AUDIO_SAMPLE_FORMATOriginal audio format. The value type is int32_t. For details, see OH_BitsPerSample.
OH_MD_KEY_AUD_CHANNEL_COUNTNumber of audio channels. The value type is int32_t.
OH_MD_KEY_AUD_SAMPLE_RATEAudio sampling rate. The value type is int32_t.
OH_MD_KEY_AUDIO_COMPRESSION_LEVELAudio codec compression level. The value type is int32_t type. This key is used only for audio encoding. This key is optional.
OH_MD_KEY_CHANNEL_LAYOUTRequired encoding channel layout. The value type is int64_t. This key applies only to encoders. For details, see OH_AudioChannelLayout.
OH_MD_KEY_BITS_PER_CODED_SAMPLENumber of bits per sample. The value type is int32_t. This key is optional.
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.
OH_MD_KEY_SBRAAC SBR format. The value type is int32_t. This key applies to AAC encoders. This key is optional.
OH_MD_KEY_COMPLIANCE_LEVELFLAC compliance level. The value type is int32_t. This key is used only for audio encoding. This key is optional.
OH_MD_KEY_AAC_IS_ADTSAAC format, which can be ADTS or LATM. The value type is int32_t. This key applies to AAC decoders. This key is optional.
OH_MD_KEY_IDENTIFICATION_HEADERVorbis identification header. The value type is uint8_t*. This key applies only to Vorbis decoders. This key is optional.
OH_MD_KEY_SETUP_HEADERVorbis setup header. The value type is uint8_t*. This key applies only to Vorbis decoders. This key is optional.
OH_MD_KEY_AUDIO_OBJECT_NUMBERNumber of audio objects. The value type is int32_t. This key is used only for Audio Vivid decoding. This key is optional.
OH_MD_KEY_AUDIO_VIVID_METADATAAudio Vivid metadata. The value type is uint8_t*. This key is used only for Audio Vivid decoding. This key is optional.
OH_MD_KEY_BLOCK_ALIGNSize of the audio data block, in bytes. The value type is int32_t. This key is supported since API version 22 and must be configured only for WMAV1, WMAV2, and WMA PRO decoding.
OH_MD_KEY_ENABLE_BUFFER_SKIP_SAMPLESKey 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.
This key is supported since API version 24.

Key-Value Pairs Dedicated for Multiplexing and Demultiplexing

NameDescription
OH_MD_KEY_VIDEO_IS_HDR_VIVIDWhether 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. This key is optional.
OH_MD_KEY_START_TIMEStart time of the first frame in a media file, measured in microseconds. The value type is int64_t. This key is optional.
OH_MD_KEY_TRACK_START_TIMEStart time of the track, measured in microseconds. The value type is int64_t. This key is optional.
OH_MD_KEY_TRACK_TYPETrack type in a media file. The value type is int32_t. For details, see OH_MediaType. This key is optional.
OH_MD_KEY_DURATIONDuration in a media file. The value type is int64_t. This key is optional.
OH_MD_KEY_TITLETitle of a media file . The value type is char *. This key is optional.
OH_MD_KEY_ARTISTArtist. The value type is char *. This key is optional.
OH_MD_KEY_ALBUMAlbum media file. The value type is char *. This key is optional.
OH_MD_KEY_ALBUM_ARTISTAlbum artist. The value type is char *. This key is optional.
OH_MD_KEY_DATEDate of a media file, for example, 2024. The value type is char *. This key is optional.
OH_MD_KEY_COMMENTComment of a media file. The value type is char *. This key is optional.
OH_MD_KEY_GENREGenre in a media file. The value type is char *. This key is optional.
OH_MD_KEY_COPYRIGHTCopyright of a media file. The value type is char *. This key is optional.
OH_MD_KEY_LANGUAGELanguage of a media file. The value type is char *. This key is optional.
OH_MD_KEY_DESCRIPTIONDescription of a media file. The value type is char *. This key is optional.
OH_MD_KEY_LYRICSLyrics in a media file. The value type is char *. This key is optional.
OH_MD_KEY_TRACK_COUNTNumber of tracks in a media file. The value type is int32_t. This key is optional.
OH_MD_KEY_BUFFER_DURATIONDuration corresponding to the audio, video, or subtitle sample carried in AVBuffer, in microseconds. The value type is int64_t. This key is optional.
OH_MD_KEY_DECODING_TIMESTAMPDecoding timestamp corresponding to the audio, video, or subtitle sample carried in AVBuffer, in microseconds. The value type is int64_t. This key is optional.
OH_MD_KEY_CODEC_MIMEMIME type of the codec. The value type is char *. This key is optional.
OH_MD_KEY_VIDEO_SARAspect ratio of the sample. The value type is double.
OH_MD_KEY_CREATION_TIMEMedia file creation time metadata. The value type is char *.
OH_MD_KEY_REFERENCE_TRACK_IDSReference relationship between media file tracks. The value type is int32_t*.
OH_MD_KEY_TRACK_REFERENCE_TYPEAuxiliary track type of a media file. The value type is char *.
OH_MD_KEY_TRACK_DESCRIPTIONAuxiliary track description of a media file. The value type is char *.
OH_MD_KEY_BUFFER_SKIP_SAMPLES_INFOKey carried in the OH_AVBuffer, which is supported only by demultiplexing. This key may be carried in the start and end frames of the audio output of demultiplexing.
This key corresponds to a 10-byte uint8_t[] array, which records the number of audio samples to skip after decoding in the audio file metadata.
The structure is 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. The default output is 0.
This key is supported since API version 23.
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.
This key is supported since API version 24.
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.
This key is supported since API version 24.
OH_MD_KEY_ALTITUDEAltitude key. The value is of the float type. This key is optional. It indicates the altitude in geographic location information.
This key is supported since API version 24.

你可能感兴趣的鸿蒙文章

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