CodecBase
Overview
Provides the common structs, character constants, and enums for running OH_AVCodec instances.
@syscap SystemCapability.Multimedia.Media.CodecBase
Since: 9
Summary
Files
Name | Description |
---|---|
native_avcodec_base.h | Declares the common structs, character constants, and enums for running OH_AVCodec instances. File to Include: <multimedia/player_framework/native_avcodec_base.h> |
Structs
Name | Description |
---|---|
OH_AVCodecBufferAttr | Defines the buffer attributes of an OH_AVCodec instance. |
OH_AVCodecAsyncCallback | Defines a collection of asynchronous callback functions for an OH_AVCodec instance. You must register this struct instance for an OH_AVCodec instance and process the information reported through these callbacks to ensure the normal running of the instance. |
Types
Name | Description |
---|---|
OH_AVCodecBufferFlags | Enumerates the buffer flags of an OH_AVCodec instance. |
OH_AVCodecBufferAttr | Defines the buffer attributes of an OH_AVCodec instance. |
OH_AVCodecOnError) (OH_AVCodec *codec, int32_t errorCode, void *userData) | Defines the function pointer that is called to report error information when an error occurs during the running of an OH_AVCodec instance. |
OH_AVCodecOnStreamChanged) (OH_AVCodec *codec, OH_AVFormat *format, void *userData) | Defines the function pointer that is called to report the attributes of the new stream when the output stream 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. |
OH_AVCodecOnNeedInputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) | Defines the function pointer that is called, with a new buffer to fill in new input data, when new input data is required during the running of an OH_AVCodec instance. |
OH_AVCodecOnNewOutputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData) | Defines the function pointer that is called, with a buffer containing new output data, when the new output data is generated during the running of an OH_AVCodec instance. 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. |
OH_AVCodecAsyncCallback | Defines a collection of asynchronous callback functions for an OH_AVCodec instance. You must register this struct instance for an OH_AVCodec instance and process the information reported through these callbacks to ensure the normal running of the instance. |
OH_MediaType | Enumerates the media types. |
OH_AVCProfile | Enumerates the AVC profiles. |
OH_AACProfile | Enumerates the AAC profiles. |
Enums
Name | Description |
---|---|
OH_AVCodecBufferFlags { AVCODEC_BUFFER_FLAGS_NONE = 0, AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1, AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2, AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3 } |
Enumerates the buffer flags of an OH_AVCodec instance. |
OH_MediaType { MEDIA_TYPE_AUD = 0, MEDIA_TYPE_VID = 1 } | Enumerates the media types. |
OH_AVCProfile { AVC_PROFILE_BASELINE = 0, AVC_PROFILE_HIGH = 4, AVC_PROFILE_MAIN = 8 } | Enumerates the AVC profiles. |
OH_AACProfile { AAC_PROFILE_LC = 0 } | Enumerates the AAC profiles. |
Variables
Name | Description |
---|---|
OH_AVCodecBufferAttr::pts | Presentation timestamp of the buffer, in microseconds. |
OH_AVCodecBufferAttr::size | Size of the data contained in the buffer, in bytes. |
OH_AVCodecBufferAttr::offset | Start offset of valid data in the buffer. |
OH_AVCodecBufferAttr::flags | Buffer flag, which is a combination of multiple OH_AVCodecBufferFlags. |
OH_AVCODEC_MIMETYPE_VIDEO_AVC | Defines the Multipurpose Internet Mail Extension (MIME) type for Advanced Video Coding (AVC). |
OH_AVCODEC_MIMETYPE_AUDIO_AAC | Defines the MIME type for Advanced Audio Coding (AAC). |
OH_ED_KEY_TIME_STAMP | Provides unified character descriptors for the auxiliary data of the surface buffer. |
OH_ED_KEY_EOS | Character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool. |
OH_MD_KEY_TRACK_TYPE | Provides unified character descriptors for the media playback framework. |
OH_MD_KEY_CODEC_MIME | Character descriptor of the MIME type. The value type is string. |
OH_MD_KEY_DURATION | Character descriptor of duration. The value type is int64_t. |
OH_MD_KEY_BITRATE | Character descriptor of the bit rate. The value type is uint32_t. |
OH_MD_KEY_MAX_INPUT_SIZE | Character descriptor of the maximum input size. The value type is uint32_t. |
OH_MD_KEY_WIDTH | Character descriptor of the video width. The value type is uint32_t. |
OH_MD_KEY_HEIGHT | Character descriptor of the video height. The value type is uint32_t. |
OH_MD_KEY_PIXEL_FORMAT | Character descriptor of the video pixel format. The value type is int32_t. For details, see OH_AVPixelFormat. |
OH_MD_KEY_AUDIO_SAMPLE_FORMAT | Character descriptor of the audio sample format. The value type is uint32_t. |
OH_MD_KEY_FRAME_RATE | Character descriptor of the video frame rate. The value type is double. |
OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE | Character descriptor of the video encoding bit rate mode. The value type is int32_t. For details, see OH_VideoEncodeBitrateMode. |
OH_MD_KEY_PROFILE | Character descriptor of the audio/video encoding capability. The value type is int32_t. For details, see OH_AVCProfile or OH_AACProfile. |
OH_MD_KEY_AUD_CHANNEL_COUNT | Character descriptor of the number of audio channels. The value type is uint32_t. |
OH_MD_KEY_AUD_SAMPLE_RATE | Character descriptor of the audio sampling rate. The value type is uint32_t. |
OH_MD_KEY_I_FRAME_INTERVAL | Character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms. |
OH_MD_KEY_ROTATION | Character descriptor of the surface rotation angle. The value type is int32_t. The value range is {0, 90, 180, 270}. The default value is 0. |
Type Description
OH_AACProfile
typedef enum OH_AACProfileOH_AACProfile
Description
Enumerates the AAC profiles.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_AVCodecAsyncCallback
typedef struct OH_AVCodecAsyncCallbackOH_AVCodecAsyncCallback
Description
Defines a collection of asynchronous callback functions for an OH_AVCodec instance. You must register this struct instance for an OH_AVCodec instance and process the information reported through these callbacks to ensure the normal running of the instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
Parameters
Name | Description |
---|---|
onError | Indicates the callback used to report errors occurred during the running of the instance. For details, see OH_AVCodecOnError. |
onStreamChanged | Indicates the callback used to report stream information. For details, see OH_AVCodecOnStreamChanged. |
onNeedInputData | Indicates the callback used to report input data needed. For details, see OH_AVCodecOnNeedInputData. |
onNeedInputData | Indicates the callback used to report output data needed. For details, see OH_AVCodecOnNewOutputData. |
OH_AVCodecBufferAttr
typedef struct OH_AVCodecBufferAttrOH_AVCodecBufferAttr
Description
Defines the buffer attributes of an OH_AVCodec instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_AVCodecBufferFlags
typedef enum OH_AVCodecBufferFlagsOH_AVCodecBufferFlags
Description
Enumerates the buffer flags of an OH_AVCodec instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_AVCodecOnError
typedef void(* OH_AVCodecOnError) (OH_AVCodec *codec, int32_t errorCode, void *userData)
Description
Defines the function pointer that is called to report error information when an error occurs during the running of an OH_AVCodec instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
Parameters
Name | Description |
---|---|
codec | Indicates the pointer to an OH_AVCodec instance. |
errorCode | Indicates an error code. |
userData | Indicates the pointer to user-specific data. |
OH_AVCodecOnNeedInputData
typedef void(* OH_AVCodecOnNeedInputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData)
Description
Defines the function pointer that is called, with a new buffer to fill in new input data, when new input data is required during the running of an OH_AVCodec instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
Parameters
Name | Description |
---|---|
codec | Indicates the pointer to an OH_AVCodec instance. |
index | Indicates the index of an input buffer. |
data | Indicates the pointer to the new input data. |
userData | Indicates the pointer to user-specific data. |
OH_AVCodecOnNewOutputData
typedef void(* OH_AVCodecOnNewOutputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData)
Description
Defines the function pointer that is called, with a buffer containing new output data, when the new output data is generated during the running of an OH_AVCodec instance. 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.
@syscap SystemCapability.Multimedia.Media.CodecBase
Parameters
Name | Description |
---|---|
codec | Indicates the pointer to an OH_AVCodec instance. |
index | Indicates the index of a new output buffer. |
data | Indicates the pointer to the new output data. |
attr | Indicates the pointer to the attributes of the new output buffer. For details, see OH_AVCodecBufferAttr. |
userData | Indicates the pointer to user-specific data. |
userData | specified data |
OH_AVCodecOnStreamChanged
typedef void(* OH_AVCodecOnStreamChanged) (OH_AVCodec *codec, OH_AVFormat *format, void *userData)
Description
Defines the function pointer that is called to report the attributes of the new stream when the output stream 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.
@syscap SystemCapability.Multimedia.Media.CodecBase
Parameters
Name | Description |
---|---|
codec | Indicates the pointer to an OH_AVCodec instance. |
format | Indicates the handle to the attributes of the new output stream. |
userData | Indicates the pointer to user-specific data. |
OH_AVCProfile
typedef enum OH_AVCProfileOH_AVCProfile
Description
Enumerates the AVC profiles.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_MediaType
typedef enum OH_MediaTypeOH_MediaType
Description
Enumerates the media types.
@syscap SystemCapability.Multimedia.Media.CodecBase
Enum Description
OH_AACProfile
enum OH_AACProfile
Description
Enumerates the AAC profiles.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_AVCodecBufferFlags
enum OH_AVCodecBufferFlags
Description
Enumerates the buffer flags of an OH_AVCodec instance.
@syscap SystemCapability.Multimedia.Media.CodecBase
Name | Description |
---|---|
AVCODEC_BUFFER_FLAGS_EOS | The buffer contains an end-of-stream frame. |
AVCODEC_BUFFER_FLAGS_SYNC_FRAME | The buffer contains a sync frame. |
AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME | The buffer contains part of a frame. |
AVCODEC_BUFFER_FLAGS_CODEC_DATA | The buffer contains codec-specific data. |
OH_AVCProfile
enum OH_AVCProfile
Description
Enumerates the AVC profiles.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_MediaType
enum OH_MediaType
Description
Enumerates the media types.
@syscap SystemCapability.Multimedia.Media.CodecBase
Name | Description |
---|---|
MEDIA_TYPE_AUD | Audio track. |
MEDIA_TYPE_VID | Video track. |
Variable Description
flags
uint32_t OH_AVCodecBufferAttr::flags
Description
Buffer flag, which is a combination of multiple OH_AVCodecBufferFlags.
offset
int32_t OH_AVCodecBufferAttr::offset
Description
Start offset of valid data in the buffer.
OH_AVCODEC_MIMETYPE_AUDIO_AAC
const char* OH_AVCODEC_MIMETYPE_AUDIO_AAC
Description
Defines the MIME type for Advanced Audio Coding (AAC).
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_AVCODEC_MIMETYPE_VIDEO_AVC
const char* OH_AVCODEC_MIMETYPE_VIDEO_AVC
Description
Defines the Multipurpose Internet Mail Extension (MIME) type for Advanced Video Coding (AVC).
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_ED_KEY_EOS
const char* OH_ED_KEY_EOS
Description
Character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool.
OH_ED_KEY_TIME_STAMP
const char* OH_ED_KEY_TIME_STAMP
Description
Provides unified character descriptors for the auxiliary data of the surface buffer.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_MD_KEY_AUD_CHANNEL_COUNT
const char* OH_MD_KEY_AUD_CHANNEL_COUNT
Description
Character descriptor of the number of audio channels. The value type is uint32_t.
OH_MD_KEY_AUD_SAMPLE_RATE
const char* OH_MD_KEY_AUD_SAMPLE_RATE
Description
Character descriptor of the audio sampling rate. The value type is uint32_t.
OH_MD_KEY_AUDIO_SAMPLE_FORMAT
const char* OH_MD_KEY_AUDIO_SAMPLE_FORMAT
Description
Character descriptor of the audio sample format. The value type is uint32_t.
OH_MD_KEY_BITRATE
const char* OH_MD_KEY_BITRATE
Description
Character descriptor of the bit rate. The value type is uint32_t.
OH_MD_KEY_CODEC_MIME
const char* OH_MD_KEY_CODEC_MIME
Description
Character descriptor of the MIME type. The value type is string.
OH_MD_KEY_DURATION
const char* OH_MD_KEY_DURATION
Description
Character descriptor of duration. The value type is int64_t.
OH_MD_KEY_FRAME_RATE
const char* OH_MD_KEY_FRAME_RATE
Description
Character descriptor of the video frame rate. The value type is double.
OH_MD_KEY_HEIGHT
const char* OH_MD_KEY_HEIGHT
Description
Character descriptor of the video height. The value type is uint32_t.
OH_MD_KEY_I_FRAME_INTERVAL
const char* OH_MD_KEY_I_FRAME_INTERVAL
Description
Character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms.
OH_MD_KEY_MAX_INPUT_SIZE
const char* OH_MD_KEY_MAX_INPUT_SIZE
Description
Character descriptor of the maximum input size. The value type is uint32_t.
OH_MD_KEY_PIXEL_FORMAT
const char* OH_MD_KEY_PIXEL_FORMAT
Description
Character descriptor of the video pixel format. The value type is int32_t. For details, see OH_AVPixelFormat.
OH_MD_KEY_PROFILE
const char* OH_MD_KEY_PROFILE
Description
Character descriptor of the audio/video encoding capability. The value type is int32_t. For details, see OH_AVCProfile or OH_AACProfile.
OH_MD_KEY_ROTATION
const char* OH_MD_KEY_ROTATION
Description
Character descriptor of the surface rotation angle. The value type is int32_t. The value range is {0, 90, 180, 270}. The default value is 0.
OH_MD_KEY_TRACK_TYPE
const char* OH_MD_KEY_TRACK_TYPE
Description
Provides unified character descriptors for the media playback framework.
@syscap SystemCapability.Multimedia.Media.CodecBase
OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
const char* OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
Description
Character descriptor of the video encoding bit rate mode. The value type is int32_t. For details, see OH_VideoEncodeBitrateMode.
OH_MD_KEY_WIDTH
const char* OH_MD_KEY_WIDTH
Description
Character descriptor of the video width. The value type is uint32_t.
pts
int64_t OH_AVCodecBufferAttr::pts
Description
Presentation timestamp of the buffer, in microseconds.
size
int32_t OH_AVCodecBufferAttr::size
Description
Size of the data contained in the buffer, in bytes.