Agora C++ API Reference for All Platforms

Classes | Typedefs | Enumerations | Variables
agora::media::base Namespace Reference

## Classes
struct | AudioEncodedFrameInfo
struct | AudioPcmFrame
struct | CacheStatistics
struct | ColorSpace
struct | ExternalVideoFrame
struct | Hdr10MetadataInfo
class | IMediaPlayerCustomDataProvider
class | IVideoFrameMetaInfo
class | IVideoFrameObserver
class | IVideoFrameObserverEx
struct | MediaSource
struct | PacketOptions
struct | PlayerPlaybackStats
struct | PlayerStreamInfo
struct | PlayerUpdatedInfo
struct | SrcInfo
struct | VideoFrame

## Typedefs
typedef void * | view_t
typedef const char * | user_id_t

## Enumerations
enum | AUDIO_DUAL_MONO_MODE { AUDIO_DUAL_MONO_STEREO = 0, AUDIO_DUAL_MONO_L = 1, AUDIO_DUAL_MONO_R = 2, AUDIO_DUAL_MONO_MIX = 3 }
enum | VIDEO_PIXEL_FORMAT { VIDEO_PIXEL_DEFAULT = 0, VIDEO_PIXEL_I420 = 1, VIDEO_PIXEL_BGRA = 2, VIDEO_PIXEL_NV21 = 3, VIDEO_PIXEL_RGBA = 4, VIDEO_PIXEL_NV12 = 8, VIDEO_TEXTURE_2D = 10, VIDEO_TEXTURE_OES = 11, VIDEO_CVPIXEL_NV12 = 12, VIDEO_CVPIXEL_I420 = 13, VIDEO_CVPIXEL_BGRA = 14, VIDEO_CVPIXEL_P010 = 15, VIDEO_PIXEL_I422 = 16, VIDEO_TEXTURE_ID3D11TEXTURE2D = 17, VIDEO_PIXEL_I010 = 18 }
enum | RENDER_MODE_TYPE { RENDER_MODE_HIDDEN = 1, RENDER_MODE_FIT = 2, __deprecated = 3 }
enum | CAMERA_VIDEO_SOURCE_TYPE { CAMERA_SOURCE_FRONT = 0, CAMERA_SOURCE_BACK = 1, VIDEO_SOURCE_UNSPECIFIED = 2 }
enum | ALPHA_STITCH_MODE { NO_ALPHA_STITCH = 0, ALPHA_STITCH_UP = 1, ALPHA_STITCH_BELOW = 2, ALPHA_STITCH_LEFT = 3, ALPHA_STITCH_RIGHT = 4 }
enum | MEDIA_PLAYER_SOURCE_TYPE { MEDIA_PLAYER_SOURCE_DEFAULT, MEDIA_PLAYER_SOURCE_FULL_FEATURED, MEDIA_PLAYER_SOURCE_SIMPLE }
enum | VIDEO_MODULE_POSITION { POSITION_POST_CAPTURER = 1 << 0, POSITION_PRE_RENDERER = 1 << 1, POSITION_PRE_ENCODER = 1 << 2, POSITION_POST_CAPTURER_ORIGIN = 1 << 3 }
enum | MEDIA_PLAYER_STATE { PLAYER_STATE_IDLE = 0, PLAYER_STATE_OPENING, PLAYER_STATE_OPEN_COMPLETED, PLAYER_STATE_PLAYING, PLAYER_STATE_PAUSED, PLAYER_STATE_PLAYBACK_COMPLETED, PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED, PLAYER_STATE_STOPPED, PLAYER_STATE_PAUSING_INTERNAL = 50, PLAYER_STATE_STOPPING_INTERNAL, PLAYER_STATE_SEEKING_INTERNAL, PLAYER_STATE_GETTING_INTERNAL, PLAYER_STATE_NONE_INTERNAL, PLAYER_STATE_DO_NOTHING_INTERNAL, PLAYER_STATE_SET_TRACK_INTERNAL, PLAYER_STATE_FAILED = 100 }
enum | MEDIA_PLAYER_REASON { PLAYER_REASON_NONE = 0, PLAYER_REASON_INVALID_ARGUMENTS = -1, PLAYER_REASON_INTERNAL = -2, PLAYER_REASON_NO_RESOURCE = -3, PLAYER_REASON_INVALID_MEDIA_SOURCE = -4, PLAYER_REASON_UNKNOWN_STREAM_TYPE = -5, PLAYER_REASON_OBJ_NOT_INITIALIZED = -6, PLAYER_REASON_CODEC_NOT_SUPPORTED = -7, PLAYER_REASON_VIDEO_RENDER_FAILED = -8, PLAYER_REASON_INVALID_STATE = -9, PLAYER_REASON_URL_NOT_FOUND = -10, PLAYER_REASON_INVALID_CONNECTION_STATE = -11, PLAYER_REASON_SRC_BUFFER_UNDERFLOW = -12, PLAYER_REASON_INTERRUPTED = -13, PLAYER_REASON_NOT_SUPPORTED = -14, PLAYER_REASON_TOKEN_EXPIRED = -15, PLAYER_REASON_IP_EXPIRED = -16, PLAYER_REASON_UNKNOWN = -17 }
enum | MEDIA_STREAM_TYPE { STREAM_TYPE_UNKNOWN = 0, STREAM_TYPE_VIDEO = 1, STREAM_TYPE_AUDIO = 2, STREAM_TYPE_SUBTITLE = 3 }
enum | MEDIA_PLAYER_EVENT { PLAYER_EVENT_SEEK_BEGIN = 0, PLAYER_EVENT_SEEK_COMPLETE = 1, PLAYER_EVENT_SEEK_ERROR = 2, PLAYER_EVENT_AUDIO_TRACK_CHANGED = 5, PLAYER_EVENT_BUFFER_LOW = 6, PLAYER_EVENT_BUFFER_RECOVER = 7, PLAYER_EVENT_FREEZE_START = 8, PLAYER_EVENT_FREEZE_STOP = 9, PLAYER_EVENT_SWITCH_BEGIN = 10, PLAYER_EVENT_SWITCH_COMPLETE = 11, PLAYER_EVENT_SWITCH_ERROR = 12, PLAYER_EVENT_FIRST_DISPLAYED = 13, PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT = 14, PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE = 15, PLAYER_EVENT_TRY_OPEN_START = 16, PLAYER_EVENT_TRY_OPEN_SUCCEED = 17, PLAYER_EVENT_TRY_OPEN_FAILED = 18 }
enum | PLAYER_PRELOAD_EVENT { PLAYER_PRELOAD_EVENT_BEGIN = 0, PLAYER_PRELOAD_EVENT_COMPLETE = 1, PLAYER_PRELOAD_EVENT_ERROR = 2 }
enum | MEDIA_PLAYER_METADATA_TYPE { PLAYER_METADATA_TYPE_UNKNOWN = 0, PLAYER_METADATA_TYPE_SEI = 1 }

## Variables
static const uint8_t | kMaxCodecNameLength = 50
static const uint8_t | kMaxCharBufferLength = 50

## Typedef Documentation

## ◆ view_t

typedef void* agora::media::base::view_t

## ◆ user_id_t

typedef const char* agora::media::base::user_id_t

## Enumeration Type Documentation

## ◆ AUDIO_DUAL_MONO_MODE

enum agora::media::base::AUDIO_DUAL_MONO_MODE

Audio dual-mono output mode

Enumerator
AUDIO_DUAL_MONO_STEREO | ChanLOut=ChanLin, ChanRout=ChanRin ChanLOut=ChanRout=ChanLin
AUDIO_DUAL_MONO_L | ChanLOut=ChanRout=ChanRin
AUDIO_DUAL_MONO_R | ChanLout=ChanRout=(ChanLin+ChanRin)/2
AUDIO_DUAL_MONO_MIX |

## ◆ VIDEO_PIXEL_FORMAT

enum agora::media::base::VIDEO_PIXEL_FORMAT

Video pixel formats.

Enumerator
VIDEO_PIXEL_DEFAULT | 0: Default format.
VIDEO_PIXEL_I420 | 1: I420.
VIDEO_PIXEL_BGRA | 2: BGRA.
VIDEO_PIXEL_NV21 | 3: NV21.
VIDEO_PIXEL_RGBA | 4: RGBA.
VIDEO_PIXEL_NV12 | 8: NV12.
VIDEO_TEXTURE_2D | 10: GL_TEXTURE_2D
VIDEO_TEXTURE_OES | 11: GL_TEXTURE_OES
VIDEO_CVPIXEL_NV12 |
VIDEO_CVPIXEL_I420 |
VIDEO_CVPIXEL_BGRA |
VIDEO_CVPIXEL_P010 | 15: pixel format for iOS CVPixelBuffer P010(10bit NV12)
VIDEO_PIXEL_I422 | 16: I422.
VIDEO_TEXTURE_ID3D11TEXTURE2D | 17: ID3D11Texture2D, only support DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_TYPELESS, DXGI_FORMAT_NV12 texture format
VIDEO_PIXEL_I010 | 18: I010. 10bit I420 data. @technical preview

## ◆ RENDER_MODE_TYPE

enum agora::media::base::RENDER_MODE_TYPE

The video display mode.

Enumerator
RENDER_MODE_HIDDEN | 1: Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
RENDER_MODE_FIT | 2: Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio will be filled with black.
__deprecated | Deprecated: 3: This mode is deprecated.

## ◆ CAMERA_VIDEO_SOURCE_TYPE

enum agora::media::base::CAMERA_VIDEO_SOURCE_TYPE

The camera video source type

Enumerator
CAMERA_SOURCE_FRONT | 0: the video frame comes from the front camera
CAMERA_SOURCE_BACK | 1: the video frame comes from the back camera
VIDEO_SOURCE_UNSPECIFIED | 1: the video frame source is unsepcified

## ◆ ALPHA_STITCH_MODE

enum agora::media::base::ALPHA_STITCH_MODE

The relative position between alphabuffer and the frame.

Enumerator
NO_ALPHA_STITCH | 0: Normal frame without alphabuffer stitched
ALPHA_STITCH_UP | 1: Alphabuffer is above the frame
ALPHA_STITCH_BELOW | 2: Alphabuffer is below the frame
ALPHA_STITCH_LEFT | 3: Alphabuffer is on the left of frame
ALPHA_STITCH_RIGHT | 4: Alphabuffer is on the right of frame

## ◆ MEDIA_PLAYER_SOURCE_TYPE

enum agora::media::base::MEDIA_PLAYER_SOURCE_TYPE

Enumerator
MEDIA_PLAYER_SOURCE_DEFAULT | The real type of media player when use MEDIA_PLAYER_SOURCE_DEFAULT is decided by the type of SDK package. It is full feature media player in full-featured SDK, or simple media player in others.
MEDIA_PLAYER_SOURCE_FULL_FEATURED | Full featured media player is designed to support more codecs and media format, which requires more package size than simple player. If you need this player enabled, you might need to download a full-featured SDK.
MEDIA_PLAYER_SOURCE_SIMPLE | Simple media player with limit codec supported, which requires minimal package size requirement and is enabled by default

## ◆ VIDEO_MODULE_POSITION

enum agora::media::base::VIDEO_MODULE_POSITION

Enumerator
POSITION_POST_CAPTURER |
POSITION_PRE_RENDERER |
POSITION_PRE_ENCODER |
POSITION_POST_CAPTURER_ORIGIN |

## ◆ MEDIA_PLAYER_STATE

enum agora::media::base::MEDIA_PLAYER_STATE

The playback state.

Enumerator
PLAYER_STATE_IDLE | Default state.
PLAYER_STATE_OPENING | Opening the media file.
PLAYER_STATE_OPEN_COMPLETED | The media file is opened successfully.
PLAYER_STATE_PLAYING | Playing the media file.
PLAYER_STATE_PAUSED | The playback is paused.
PLAYER_STATE_PLAYBACK_COMPLETED | The playback is completed.
PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED | All loops are completed.
PLAYER_STATE_STOPPED | The playback is stopped.
PLAYER_STATE_PAUSING_INTERNAL | Player pausing (internal)
PLAYER_STATE_STOPPING_INTERNAL | Player stopping (internal)
PLAYER_STATE_SEEKING_INTERNAL | Player seeking state (internal)
PLAYER_STATE_GETTING_INTERNAL | Player getting state (internal)
PLAYER_STATE_NONE_INTERNAL | None state for state machine (internal)
PLAYER_STATE_DO_NOTHING_INTERNAL | Do nothing state for state machine (internal)
PLAYER_STATE_SET_TRACK_INTERNAL | Player set track state (internal)
PLAYER_STATE_FAILED | The playback fails.

## ◆ MEDIA_PLAYER_REASON

enum agora::media::base::MEDIA_PLAYER_REASON

Player error code.

Enumerator
PLAYER_REASON_NONE | No error.
PLAYER_REASON_INVALID_ARGUMENTS | The parameter is invalid.
PLAYER_REASON_INTERNAL | Internel error.
PLAYER_REASON_NO_RESOURCE | No resource.
PLAYER_REASON_INVALID_MEDIA_SOURCE | Invalid media source.
PLAYER_REASON_UNKNOWN_STREAM_TYPE | The type of the media stream is unknown.
PLAYER_REASON_OBJ_NOT_INITIALIZED | The object is not initialized.
PLAYER_REASON_CODEC_NOT_SUPPORTED | The codec is not supported.
PLAYER_REASON_VIDEO_RENDER_FAILED | Invalid renderer.
PLAYER_REASON_INVALID_STATE | An error occurs in the internal state of the player.
PLAYER_REASON_URL_NOT_FOUND | The URL of the media file cannot be found.
PLAYER_REASON_INVALID_CONNECTION_STATE | Invalid connection between the player and the Agora server.
PLAYER_REASON_SRC_BUFFER_UNDERFLOW | The playback buffer is insufficient.
PLAYER_REASON_INTERRUPTED | The audio mixing file playback is interrupted.
PLAYER_REASON_NOT_SUPPORTED | The SDK does not support this function.
PLAYER_REASON_TOKEN_EXPIRED | The token has expired.
PLAYER_REASON_IP_EXPIRED | The ip has expired.
PLAYER_REASON_UNKNOWN | An unknown error occurs.

## ◆ MEDIA_STREAM_TYPE

enum agora::media::base::MEDIA_STREAM_TYPE

The type of the media stream.

Enumerator
STREAM_TYPE_UNKNOWN | The type is unknown.
STREAM_TYPE_VIDEO | The video stream.
STREAM_TYPE_AUDIO | The audio stream.
STREAM_TYPE_SUBTITLE | The subtitle stream.

## ◆ MEDIA_PLAYER_EVENT

enum agora::media::base::MEDIA_PLAYER_EVENT

The playback event.

Enumerator
PLAYER_EVENT_SEEK_BEGIN | The player begins to seek to the new playback position.
PLAYER_EVENT_SEEK_COMPLETE | The seek operation completes.
PLAYER_EVENT_SEEK_ERROR | An error occurs during the seek operation.
PLAYER_EVENT_AUDIO_TRACK_CHANGED | The player changes the audio track for playback.
PLAYER_EVENT_BUFFER_LOW | player buffer low
PLAYER_EVENT_BUFFER_RECOVER | player buffer recover
PLAYER_EVENT_FREEZE_START | The video or audio is interrupted
PLAYER_EVENT_FREEZE_STOP | Interrupt at the end of the video or audio
PLAYER_EVENT_SWITCH_BEGIN | switch source begin
PLAYER_EVENT_SWITCH_COMPLETE | switch source complete
PLAYER_EVENT_SWITCH_ERROR | switch source error
PLAYER_EVENT_FIRST_DISPLAYED | An application can render the video to less than a second
PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT | cache resources exceed the maximum file count
PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE | cache resources exceed the maximum file size
PLAYER_EVENT_TRY_OPEN_START | Triggered when a retry is required to open the media
PLAYER_EVENT_TRY_OPEN_SUCCEED | Triggered when the retry to open the media is successful
PLAYER_EVENT_TRY_OPEN_FAILED | Triggered when retrying to open media fails

## ◆ PLAYER_PRELOAD_EVENT

enum agora::media::base::PLAYER_PRELOAD_EVENT

The play preload another source event.

Enumerator
PLAYER_PRELOAD_EVENT_BEGIN | preload source begin
PLAYER_PRELOAD_EVENT_COMPLETE | preload source complete
PLAYER_PRELOAD_EVENT_ERROR | preload source error

## ◆ MEDIA_PLAYER_METADATA_TYPE

enum agora::media::base::MEDIA_PLAYER_METADATA_TYPE

The type of the media metadata.

Enumerator
PLAYER_METADATA_TYPE_UNKNOWN | The type is unknown.
PLAYER_METADATA_TYPE_SEI | The type is SEI.

## Variable Documentation

## ◆ kMaxCodecNameLength

const uint8_t agora::media::base::kMaxCodecNameLength = 50
| static

## ◆ kMaxCharBufferLength

const uint8_t agora::media::base::kMaxCharBufferLength = 50
| static