native_avcodec_base.h

Overview

The native_avcodec_base.h file declares the native APIs used for basic audio and video muxing, demuxing, encoding, and decoding.

Library: libnative_media_codecbase.so

Since: 9

Related module: CodecBase

Summary

Structs

Name Description
struct  OH_AVCodecAsyncCallback Describes all the asynchronous callback function pointers of an OH_AVCodec instance.
struct  OH_AVCodecCallback Describes all the callback function pointers of an OH_AVCodec instance.

Types

Name Description
typedef void(* OH_AVCodecOnError) (OH_AVCodec *codec, int32_t errorCode, void *userData) 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.
typedef void(* OH_AVCodecOnStreamChanged) (OH_AVCodec *codec, OH_AVFormat *format, void *userData) Defines the pointer to the function that is called to report the new stream description when the output stream changes.
typedef void(* OH_AVCodecOnNeedInputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) 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.
typedef void(* OH_AVCodecOnNewOutputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData) 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.
typedef void(* OH_AVCodecOnNeedInputBuffer) (OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData) 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.
typedef void(* OH_AVCodecOnNewOutputBuffer) (OH_AVCodec *codec, uint32_t index, OH_AVBuffer *buffer, void *userData) 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.
typedef struct OH_AVCodecAsyncCallback OH_AVCodecAsyncCallback Defines a struct that describes all the asynchronous callback function pointers of an OH_AVCodec instance.
typedef struct OH_AVCodecCallback OH_AVCodecCallback Defines a struct that describes all the callback function pointers of an OH_AVCodec instance.
typedef enum OH_MediaType OH_MediaType Defines an enum for media types.
typedef enum OH_AACProfile OH_AACProfile Defines an enum for AAC profiles.
typedef enum OH_AVCProfile OH_AVCProfile Defines an enum for AVC profiles.
typedef enum OH_HEVCProfile OH_HEVCProfile Defines an enum for HEVC profiles.
typedef enum OH_AVOutputFormat OH_AVOutputFormat Defines an enum for output file formats of a muxer.
typedef enum OH_AVSeekMode OH_AVSeekMode Defines an enum for seek modes.
typedef enum OH_ScalingMode OH_ScalingMode Defines an enum for scaling modes.
typedef enum OH_BitsPerSample OH_BitsPerSample Defines an enum for the number of audio bits for each coded sample.
typedef enum OH_ColorPrimary OH_ColorPrimary Defines an enum for primary colors.
typedef enum OH_TransferCharacteristic OH_TransferCharacteristic Defines an enum for transfer characteristics.
typedef enum OH_MatrixCoefficient OH_MatrixCoefficient Defines an enum for matrix coefficients.

Enums

Name Description
OH_MediaType {
MEDIA_TYPE_AUD = 0,
MEDIA_TYPE_VID = 1
}
Enumerates the media types.
OH_AACProfile { AAC_PROFILE_LC = 0 } Enumerates the AAC profiles.
OH_AVCProfile {
AVC_PROFILE_BASELINE = 0,
AVC_PROFILE_HIGH = 4,
AVC_PROFILE_MAIN = 8
}
Enumerates the AVC profiles.
OH_HEVCProfile {
HEVC_PROFILE_MAIN = 0,
HEVC_PROFILE_MAIN_10 = 1,
HEVC_PROFILE_MAIN_STILL = 2,
HEVC_PROFILE_MAIN_10_HDR10 = 3,
HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4
}
Enumerates the HEVC profiles.
OH_AVOutputFormat {
AV_OUTPUT_FORMAT_DEFAULT = 0,
AV_OUTPUT_FORMAT_MPEG_4 = 2,
AV_OUTPUT_FORMAT_M4A = 6
}
Enumerates the output file formats of a muxer.
OH_AVSeekMode {
SEEK_MODE_NEXT_SYNC = 0,
SEEK_MODE_PREVIOUS_SYNC,
SEEK_MODE_CLOSEST_SYNC
}
Enumerates the seek modes.
OH_ScalingMode {
SCALING_MODE_SCALE_TO_WINDOW = 1,
SCALING_MODE_SCALE_CROP = 2
}
Enumerates the scaling modes.
OH_BitsPerSample {
SAMPLE_U8 = 0, SAMPLE_S16LE = 1,
SAMPLE_S24LE = 2, SAMPLE_S32LE = 3,
SAMPLE_F32LE = 4, SAMPLE_U8P = 5,
SAMPLE_S16P = 6, SAMPLE_S24P = 7,
SAMPLE_S32P = 8, SAMPLE_F32P = 9,
INVALID_WIDTH = -1
}
Enumerates the number of audio bits for each coded sample.
OH_ColorPrimary {
COLOR_PRIMARY_BT709 = 1,
COLOR_PRIMARY_UNSPECIFIED = 2,
COLOR_PRIMARY_BT470_M = 4,
COLOR_PRIMARY_BT601_625 = 5,
COLOR_PRIMARY_BT601_525 = 6,
COLOR_PRIMARY_SMPTE_ST240 = 7,
COLOR_PRIMARY_GENERIC_FILM = 8,
COLOR_PRIMARY_BT2020 = 9,
COLOR_PRIMARY_SMPTE_ST428 = 10,
COLOR_PRIMARY_P3DCI = 11,
COLOR_PRIMARY_P3D65 = 12
}
Enumerates the primary colors.
OH_TransferCharacteristic {
TRANSFER_CHARACTERISTIC_BT709 = 1,
TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
TRANSFER_CHARACTERISTIC_GAMMA_2_2 = 4,
TRANSFER_CHARACTERISTIC_GAMMA_2_8 = 5,
TRANSFER_CHARACTERISTIC_BT601 = 6,
TRANSFER_CHARACTERISTIC_SMPTE_ST240 = 7,
TRANSFER_CHARACTERISTIC_LINEAR = 8,
TRANSFER_CHARACTERISTIC_LOG = 9,
TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,
TRANSFER_CHARACTERISTIC_IEC_61966_2_4 = 11,
TRANSFER_CHARACTERISTIC_BT1361 = 12,
TRANSFER_CHARACTERISTIC_IEC_61966_2_1 = 13,
TRANSFER_CHARACTERISTIC_BT2020_10BIT = 14,
TRANSFER_CHARACTERISTIC_BT2020_12BIT = 15,
TRANSFER_CHARACTERISTIC_PQ = 16,
TRANSFER_CHARACTERISTIC_SMPTE_ST428 = 17,
TRANSFER_CHARACTERISTIC_HLG = 18
}
Enumerates the transfer characteristics.
OH_MatrixCoefficient {
MATRIX_COEFFICIENT_IDENTITY = 0,
MATRIX_COEFFICIENT_BT709 = 1,
MATRIX_COEFFICIENT_UNSPECIFIED = 2,
MATRIX_COEFFICIENT_FCC = 4,
MATRIX_COEFFICIENT_BT601_625 = 5,
MATRIX_COEFFICIENT_BT601_525 = 6, MATRIX_COEFFICIENT_SMPTE_ST240 = 7,
MATRIX_COEFFICIENT_YCGCO = 8,
MATRIX_COEFFICIENT_BT2020_NCL = 9,
MATRIX_COEFFICIENT_BT2020_CL = 10,
MATRIX_COEFFICIENT_SMPTE_ST2085 = 11,
MATRIX_COEFFICIENT_CHROMATICITY_NCL = 12,
MATRIX_COEFFICIENT_CHROMATICITY_CL = 13,
MATRIX_COEFFICIENT_ICTCP = 14
}
Enumerates the matrix coefficients.

Variables

Name Description
const char * OH_AVCODEC_MIMETYPE_VIDEO_AVC Defines the pointer to the Multipurpose Internet Mail Extension (MIME) type of AVC (H.264) video codec.
const char * OH_AVCODEC_MIMETYPE_AUDIO_AAC Defines the pointer to the MIME type of AAC audio codec.
const char * OH_AVCODEC_MIMETYPE_AUDIO_FLAC Defines the pointer to the MIME type of FLAC audio codec.
const char * OH_AVCODEC_MIMETYPE_AUDIO_VORBIS Defines the pointer to the MIME type of the Vorbis audio decoder.
const char * OH_AVCODEC_MIMETYPE_AUDIO_MPEG Defines the pointer to the MIME type of the MP3 audio decoder.
const char * OH_AVCODEC_MIMETYPE_VIDEO_HEVC Defines the pointer to the MIME type of HEVC (H.265) video codec.
const char * OH_AVCODEC_MIMETYPE_VIDEO_MPEG4 Defines the pointer to the MIME type of the MPEG4 video encoder, which is used only for muxing MPEG4 video streams.
const char * OH_AVCODEC_MIMETYPE_IMAGE_JPG Defines the pointer to the MIME type of the JPG image encoder, which is used only for muxing JPG covers.
const char * OH_AVCODEC_MIMETYPE_IMAGE_PNG Defines the pointer to the MIME type of the PNG image encoder, which is used only for muxing PNG covers.
const char * OH_AVCODEC_MIMETYPE_IMAGE_BMP Defines the pointer to the MIME type of the BMP image encoder, which is used only for muxing BMP covers.
const char * OH_AVCODEC_MIMETYPE_AUDIO_VIVID Defines the pointer to the MIME type of the Audio Vivid audio decoder. (This specification is not available yet.)
const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_NB Defines the pointer to the MIME type of the AMR-NB audio decoder.
const char * OH_AVCODEC_MIMETYPE_AUDIO_AMR_WB Defines the pointer to the MIME type of the AMR-WB audio decoder.
const char * OH_AVCODEC_MIMETYPE_AUDIO_OPUS Defines the pointer to the MIME type of Opus audio codec. (This specification is not available yet.)
const char * OH_AVCODEC_MIMETYPE_AUDIO_G711MU Defines the pointer to the MIME type of G.711 mu-law audio codec.
const char * OH_ED_KEY_TIME_STAMP Defines the pointer to the timestamp in the extra data of the surface. The value type is int64.
const char * OH_ED_KEY_EOS Defines the pointer to the end of stream (EOS) in the extra data of the surface. The value type is Boolean.
const char * OH_MD_KEY_TRACK_TYPE Defines the pointer to the track type. The value type is uint8_t. For details, see OH_MediaType.
const char * OH_MD_KEY_CODEC_MIME Define the pointer to the MIME type of codec. The value type is string.
const char * OH_MD_KEY_DURATION Defines the pointer to the duration. The value type is int64_t.
const char * OH_MD_KEY_BITRATE Defines the pointer to the bit rate. The value type is int64_t.
const char * OH_MD_KEY_MAX_INPUT_SIZE Defines the pointer to the maximum input size. The value type is uint32_t.
const char * OH_MD_KEY_WIDTH Defines the pointer to the video width. The value type is uint32_t.
const char * OH_MD_KEY_HEIGHT Defines the pointer to the video height. The value type is uint32_t.
const char * OH_MD_KEY_PIXEL_FORMAT Defines the pointer to the video pixel format. The value type is int32_t. For details, see OH_AVPixelFormat.
const char * OH_MD_KEY_AUDIO_SAMPLE_FORMAT Defines the pointer to the original audio format. The value type is uint32_t. For details, see OH_BitsPerSample.
const char * OH_MD_KEY_FRAME_RATE Defines the pointer to the video frame rate. The value type is double.
const char * OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE Defines the pointer to the video encoding bit rate mode. The value type is int32_t. For details, see OH_VideoEncodeBitrateMode.
const char * OH_MD_KEY_PROFILE Defines the pointer to the encoding grading. The value type is int32_t. For details, see OH_HEVCProfile and OH_AACProfile.
const char * OH_MD_KEY_AUD_CHANNEL_COUNT Defines the pointer to the number of audio channels. The value type is uint32_t.
const char * OH_MD_KEY_AUD_SAMPLE_RATE Defines the pointer to the audio sampling rate. The value type is uint32_t.
const char * OH_MD_KEY_I_FRAME_INTERVAL Defines the pointer to the key frame interval, in milliseconds. The value type is int32_t.
const char * OH_MD_KEY_ROTATION Defines the pointer to 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.
const char * OH_MD_KEY_RANGE_FLAG Defines the pointer to the video YUV value range flag. The value type is Boolean. The value true means a full range, and false means a limited range.
const char * OH_MD_KEY_COLOR_PRIMARIES Defines the pointer to the video primary color. The value type is int32_t. For details, see OH_ColorPrimary. The video primary color complies with Table 2 in the H.273 standard.
const char * OH_MD_KEY_TRANSFER_CHARACTERISTICS Defines the pointer to the video transfer characteristics. The value type is int32_t. For details, see OH_TransferCharacteristic. The video transfer characteristics comply with Table 3 in the H.273 standard.
const char * OH_MD_KEY_MATRIX_COEFFICIENTS Defines the pointer to the video matrix coefficient. The value type is int32_t. For details, see OH_MatrixCoefficient. The video matrix coefficient complies with Table 4 in the H.273 standard.
const char * OH_MD_KEY_REQUEST_I_FRAME Defines the pointer to the request for immediate encoding of I-frames. The value type is Boolean.
const char * OH_MD_KEY_QUALITY Defines the pointer to the required encoding quality. The value type is uint32_t. This key applies only to encoders configured in constant quality mode.
const char * OH_MD_KEY_CODEC_CONFIG Defines the pointer to the codec-specific data. The value type is uint8_t*.
const char * OH_MD_KEY_TITLE Defines the pointer to the title of the input media. The value type is string.
const char * OH_MD_KEY_ARTIST Defines the pointer to the artist of the input media. The value type is string.
const char * OH_MD_KEY_ALBUM Defines the pointer to the album of the input media. The value type is string.
const char * OH_MD_KEY_ALBUM_ARTIST Defines the pointer to the album artist of the input media. The value type is string.
const char * OH_MD_KEY_DATE Defines the pointer to the date of the input media. The value type is string.
const char * OH_MD_KEY_COMMENT Defines the pointer to the comment of the input media. The value type is string.
const char * OH_MD_KEY_GENRE Defines the pointer to the genre of the input media. The value type is string.
const char * OH_MD_KEY_COPYRIGHT Defines the pointer to the copyright of the input media. The value type is string.
const char * OH_MD_KEY_LANGUAGE Defines the pointer to the language of the input media. The value type is string.
const char * OH_MD_KEY_DESCRIPTION Defines the pointer to the description of the input media. The value type is string.
const char * OH_MD_KEY_LYRICS Defines the pointer to the lyrics of the input media. The value type is string.
const char * OH_MD_KEY_TRACK_COUNT Defines the pointer to the track count of the input media. The value type is uint32_t.
const char * OH_MD_KEY_CHANNEL_LAYOUT Defines the pointer to the required encoding channel layout. The value type is int64_t. This key applies only to encoders.
const char * OH_MD_KEY_BITS_PER_CODED_SAMPLE Defines the pointer to the number of bits for each coded sample. The value type is uint32_t. This key applies to FLAC encoders. For details, see OH_BitsPerSample.
const char * OH_MD_KEY_AAC_IS_ADTS Defines the pointer to the AAC format. The value type is uint32_t. This key applies to AAC decoders.
const char * OH_MD_KEY_SBR Defines the pointer to the AAC SBR format. The value type is uint32_t. This key applies to AAC encoders.
const char * OH_MD_KEY_COMPLIANCE_LEVEL Defines the pointer to the FLAC compliance level. The value type is int32_t.
const char * OH_MD_KEY_IDENTIFICATION_HEADER Defines the pointer to the VORBIS identification header. The value type is uint8_t*. This key applies only to VORBIS decoders.
const char * OH_MD_KEY_SETUP_HEADER Defines the pointer to the VORBIS setup header. The value type is uint8_t*. This key applies only to VORBIS decoders.
const char * OH_MD_KEY_SCALING_MODE Defines the pointer to the video surface scale mode. The value type is int32_t. For details, see OH_ScalingMode.
const char * OH_MD_MAX_INPUT_BUFFER_COUNT Defines the pointer to the maximum number of input buffers. The value type is int32_t.
const char * OH_MD_MAX_OUTPUT_BUFFER_COUNT Defines the pointer to the maximum number of output buffers. The value type is int32_t.
const char * OH_MD_KEY_AUDIO_COMPRESSION_LEVEL Defines the pointer to the audio codec compression level. The value type is uint32_t.
const char * OH_MD_KEY_VIDEO_IS_HDR_VIVID Defines the pointer to indicate whether it is HDR Vivid. The value type is Boolean.
const char * OH_MD_KEY_AUDIO_OBJECT_NUMBER Defines the pointer to the number of audio objects. The value type is int32_t.
const char * OH_MD_KEY_AUDIO_VIVID_METADATA Defines the pointer to the Audio Vivid metadata. The value type is uint8_t.