Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
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 , PLAYER_EVENT_HTTP_REDIRECT = 19 }
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

The channel mode.

Enumerator
AUDIO_DUAL_MONO_STEREO | 0: Original mode.
AUDIO_DUAL_MONO_L | 1: Left channel mode. This mode replaces the audio of the right channel with the audio of the left channel, which means the user can only hear the audio of the left channel.
AUDIO_DUAL_MONO_R | 2: Right channel mode. This mode replaces the audio of the left channel with the audio of the right channel, which means the user can only hear the audio of the right channel.
AUDIO_DUAL_MONO_MIX | 3: Mixed channel mode. This mode mixes the audio of the left channel and the right channel, which means the user can hear the audio of the left channel and the right channel at the same time.

## ◆ VIDEO_PIXEL_FORMAT

enum agora::media::base::VIDEO_PIXEL_FORMAT

The video pixel format.

Enumerator
VIDEO_PIXEL_DEFAULT | 0: Raw video pixel format.
VIDEO_PIXEL_I420 | 1: The format is I420.
VIDEO_PIXEL_BGRA | 2: BGRA.
VIDEO_PIXEL_NV21 | 3: NV21.
VIDEO_PIXEL_RGBA | 4: The format is 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: The format is I422.
VIDEO_TEXTURE_ID3D11TEXTURE2D | 17: The ID3D11TEXTURE2D format. Currently supported types are `DXGI_FORMAT_B8G8R8A8_UNORM`, `DXGI_FORMAT_B8G8R8A8_TYPELESS` and `DXGI_FORMAT_NV12`.
VIDEO_PIXEL_I010 | 18: I010. 10bit I420 data. @technical preview

## ◆ RENDER_MODE_TYPE

enum agora::media::base::RENDER_MODE_TYPE

Video display modes.

Enumerator
RENDER_MODE_HIDDEN | 1: Hidden mode. The priority is to fill the window. Any excess video that does not match the window size will be cropped.
RENDER_MODE_FIT | 2: Fit mode. The priority is to ensure that all video content is displayed. Any areas of the window that are not filled due to the mismatch between video size and window size will be filled with black.
__deprecated | 3: Adaptive mode. 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 of `alphaBuffer` and video frames.

Enumerator
NO_ALPHA_STITCH | 0: (Default) Only video frame, that is, `alphaBuffer` is not stitched with the video frame.
ALPHA_STITCH_UP | 1: `alphaBuffer` is above the video frame.
ALPHA_STITCH_BELOW | 2: `alphaBuffer` is below the video frame.
ALPHA_STITCH_LEFT | 3: `alphaBuffer` is to the left of the video frame.
ALPHA_STITCH_RIGHT | 4: `alphaBuffer` is to the right of the video 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

The frame position of the video observer.

Enumerator
POSITION_POST_CAPTURER | 1: The location of the locally collected video data after preprocessing corresponds to the `onCaptureVideoFrame` callback. The observed video here has the effect of video pre-processing, which can be verified by enabling image enhancement, virtual background, or watermark.
POSITION_PRE_RENDERER | 2: The pre-renderer position , which corresponds to the video data in the `onRenderVideoFrame` callback.
POSITION_PRE_ENCODER | 4: The pre-encoder position , which corresponds to the video data in the `onPreEncodeVideoFrame` callback. The observed video here has the effects of video pre-processing and encoding pre-processing. To verify the pre-processing effects of the video, you can enable image enhancement, virtual background, or watermark. To verify the pre-encoding processing effect, you can set a lower frame rate (for example, 5 fps).
POSITION_POST_CAPTURER_ORIGIN | 8: The position after local video capture and before pre-processing. The observed video here does not have pre-processing effects, which can be verified by enabling image enhancement, virtual background, or watermarks.

## ◆ MEDIA_PLAYER_STATE

enum agora::media::base::MEDIA_PLAYER_STATE

The playback state.

Enumerator
PLAYER_STATE_IDLE | 0: The default state. The media player returns this state code before you open the media resource or after you stop the playback.
PLAYER_STATE_OPENING | 1: Opening the media resource.
PLAYER_STATE_OPEN_COMPLETED | 2: Opens the media resource successfully.
PLAYER_STATE_PLAYING | 3: The media resource is playing.
PLAYER_STATE_PAUSED | 4: Pauses the playback.
PLAYER_STATE_PLAYBACK_COMPLETED | 5: The playback is complete.
PLAYER_STATE_PLAYBACK_ALL_LOOPS_COMPLETED | 6: The loop is complete.
PLAYER_STATE_STOPPED | 7: The playback stops.
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 | 100: The media player fails to play the media resource.

## ◆ MEDIA_PLAYER_REASON

enum agora::media::base::MEDIA_PLAYER_REASON

Reasons for the changes in the media player status.

Enumerator
PLAYER_REASON_NONE | 0: No error.
PLAYER_REASON_INVALID_ARGUMENTS | -1: Invalid arguments.
PLAYER_REASON_INTERNAL | -2: Internal error.
PLAYER_REASON_NO_RESOURCE | -3: No resource.
PLAYER_REASON_INVALID_MEDIA_SOURCE | -4: Invalid media resource.
PLAYER_REASON_UNKNOWN_STREAM_TYPE | -5: The media stream type is unknown.
PLAYER_REASON_OBJ_NOT_INITIALIZED | -6: The object is not initialized.
PLAYER_REASON_CODEC_NOT_SUPPORTED | -7: The codec is not supported.
PLAYER_REASON_VIDEO_RENDER_FAILED | -8: Invalid renderer.
PLAYER_REASON_INVALID_STATE | -9: An error with the internal state of the player occurs.
PLAYER_REASON_URL_NOT_FOUND | -10: The URL of the media resource cannot be found.
PLAYER_REASON_INVALID_CONNECTION_STATE | -11: Invalid connection between the player and the Agora Server.
PLAYER_REASON_SRC_BUFFER_UNDERFLOW | -12: The playback buffer is insufficient.
PLAYER_REASON_INTERRUPTED | -13: The playback is interrupted.
PLAYER_REASON_NOT_SUPPORTED | -14: The SDK does not support the method being called.
PLAYER_REASON_TOKEN_EXPIRED | The token has expired.
PLAYER_REASON_IP_EXPIRED | The ip has expired.
PLAYER_REASON_UNKNOWN | -17: An unknown error.

## ◆ MEDIA_STREAM_TYPE

enum agora::media::base::MEDIA_STREAM_TYPE

The type of the media stream.

Enumerator
STREAM_TYPE_UNKNOWN | 0: The type is unknown.
STREAM_TYPE_VIDEO | 1: The video stream.
STREAM_TYPE_AUDIO | 2: The audio stream.
STREAM_TYPE_SUBTITLE | 3: The subtitle stream.

## ◆ MEDIA_PLAYER_EVENT

enum agora::media::base::MEDIA_PLAYER_EVENT

Media player events.

Enumerator
PLAYER_EVENT_SEEK_BEGIN | 0: The player begins to seek to a new playback position.
PLAYER_EVENT_SEEK_COMPLETE | 1: The player finishes seeking to a new playback position.
PLAYER_EVENT_SEEK_ERROR | 2: An error occurs when seeking to a new playback position.
PLAYER_EVENT_AUDIO_TRACK_CHANGED | 5: The audio track used by the player has been changed.
PLAYER_EVENT_BUFFER_LOW | 6: The currently buffered data is not enough to support playback.
PLAYER_EVENT_BUFFER_RECOVER | 7: The currently buffered data is just enough to support playback.
PLAYER_EVENT_FREEZE_START | 8: The audio or video playback freezes.
PLAYER_EVENT_FREEZE_STOP | 9: The audio or video playback resumes without freezing.
PLAYER_EVENT_SWITCH_BEGIN | 10: The player starts switching the media resource.
PLAYER_EVENT_SWITCH_COMPLETE | 11: Media resource switching is complete.
PLAYER_EVENT_SWITCH_ERROR | 12: Media resource switching error.
PLAYER_EVENT_FIRST_DISPLAYED | 13: The first video frame is rendered.
PLAYER_EVENT_REACH_CACHE_FILE_MAX_COUNT | 14: The cached media files reach the limit in number.
PLAYER_EVENT_REACH_CACHE_FILE_MAX_SIZE | 15: The cached media files reach the limit in aggregate storage space.
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_EVENT_HTTP_REDIRECT | Triggered when an http redirect occurs @technical preview

## ◆ PLAYER_PRELOAD_EVENT

enum agora::media::base::PLAYER_PRELOAD_EVENT

Events that occur when media resources are preloaded.

Enumerator
PLAYER_PRELOAD_EVENT_BEGIN | 0: Starts preloading media resources.
PLAYER_PRELOAD_EVENT_COMPLETE | 1: Preloading media resources is complete.
PLAYER_PRELOAD_EVENT_ERROR | 2: An error occurs when preloading media resources.

## ◆ MEDIA_PLAYER_METADATA_TYPE

enum agora::media::base::MEDIA_PLAYER_METADATA_TYPE

The type of media metadata.

Enumerator
PLAYER_METADATA_TYPE_UNKNOWN | 0: The type is unknown.
PLAYER_METADATA_TYPE_SEI | 1: 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