Agora Java API Reference for Android

Public Types | Public Attributes | List of all members
agora::media::base::ExternalVideoFrame Struct Reference

The external video frame. More...

`#include <AgoraMediaBase.h>`

## Public Types
enum | EGL_CONTEXT_TYPE { EGL_CONTEXT10 = 0, EGL_CONTEXT14 = 1 }
enum | VIDEO_BUFFER_TYPE { VIDEO_BUFFER_RAW_DATA = 1, VIDEO_BUFFER_ARRAY = 2, VIDEO_BUFFER_TEXTURE = 3 }
| The video buffer type. More...

## Public Attributes
VIDEO_BUFFER_TYPE | type
VIDEO_PIXEL_FORMAT | format
void * | buffer
int | stride
int | height
int | cropLeft
int | cropTop
int | cropRight
int | cropBottom
int | rotation
long long | timestamp
void * | eglContext
EGL_CONTEXT_TYPE | eglType
int | textureId
long long | fenceObject
float | matrix [16]
uint8_t * | metadataBuffer
int | metadataSize
uint8_t * | alphaBuffer
bool | fillAlphaBuffer
ALPHA_STITCH_MODE | alphaStitchMode
void * | d3d11Texture2d
int | textureSliceIndex
Hdr10MetadataInfo | hdr10MetadataInfo
ColorSpace | colorSpace

## Detailed Description

The external video frame.

## Member Enumeration Documentation

## ◆ EGL_CONTEXT_TYPE

enum agora::media::base::ExternalVideoFrame::EGL_CONTEXT_TYPE

The EGL context type.

Enumerator
EGL_CONTEXT10 | 0: When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos
EGL_CONTEXT14 | 0: When using the OpenGL interface (android.opengl.*) defined by Android

## ◆ VIDEO_BUFFER_TYPE

enum agora::media::base::ExternalVideoFrame::VIDEO_BUFFER_TYPE

The video buffer type.

Enumerator
VIDEO_BUFFER_RAW_DATA | 1: The video buffer in the format of raw data.
VIDEO_BUFFER_ARRAY | 2: The video buffer in the format of raw data.
VIDEO_BUFFER_TEXTURE | 3: The video buffer in the format of `Texture`.

## Member Data Documentation

## ◆ type

VIDEO_BUFFER_TYPE agora::media::base::ExternalVideoFrame::type

The video type. See `VIDEO_BUFFER_TYPE`.

## ◆ format

VIDEO_PIXEL_FORMAT agora::media::base::ExternalVideoFrame::format

The pixel format. See `VIDEO_PIXEL_FORMAT`.

## ◆ buffer

void* agora::media::base::ExternalVideoFrame::buffer

Video frame buffer.

## ◆ stride

int agora::media::base::ExternalVideoFrame::stride

Line spacing of the incoming video frame, which must be in pixels instead of bytes. For textures, it is the width of the texture.

## ◆ height

int agora::media::base::ExternalVideoFrame::height

Height of the incoming video frame.

## ◆ cropLeft

int agora::media::base::ExternalVideoFrame::cropLeft

Raw data related parameter. The number of pixels trimmed from the left. The default value is 0.

## ◆ cropTop

int agora::media::base::ExternalVideoFrame::cropTop

Raw data related parameter. The number of pixels trimmed from the top. The default value is 0.

## ◆ cropRight

int agora::media::base::ExternalVideoFrame::cropRight

Raw data related parameter. The number of pixels trimmed from the right. The default value is 0.

## ◆ cropBottom

int agora::media::base::ExternalVideoFrame::cropBottom

Raw data related parameter. The number of pixels trimmed from the bottom. The default value is 0.

## ◆ rotation

int agora::media::base::ExternalVideoFrame::rotation

Raw data related parameter. The clockwise rotation of the video frame. You can set the rotation angle as 0, 90, 180, or 270. The default value is 0.

## ◆ timestamp

long long agora::media::base::ExternalVideoFrame::timestamp

Timestamp (ms) of the incoming video frame. An incorrect timestamp results in frame loss or unsynchronized audio and video.

## ◆ eglContext

void* agora::media::base::ExternalVideoFrame::eglContext

This parameter only applies to video data in Texture format.

- When using the OpenGL interface (javax.microedition.khronos.egl.*) defined by Khronos, set eglContext to this field.
- When using the OpenGL interface (android.opengl.*) defined by Android, set eglContext to this field.

## ◆ eglType

EGL_CONTEXT_TYPE agora::media::base::ExternalVideoFrame::eglType

This parameter only applies to video data in Texture format. Texture ID of the video frame.

## ◆ textureId

int agora::media::base::ExternalVideoFrame::textureId

This parameter only applies to video data in Texture format. Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.

## ◆ fenceObject

long long agora::media::base::ExternalVideoFrame::fenceObject

[Texture related parameter] The fence object related to the textureId parameter, indicating the synchronization status of the video data in Texture format. The default value is 0

## ◆ matrix

float agora::media::base::ExternalVideoFrame::matrix[16]

[Texture related parameter] Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.

## ◆ metadataBuffer

uint8_t* agora::media::base::ExternalVideoFrame::metadataBuffer

This parameter only applies to video data in Texture format. The MetaData buffer. The default value is `NULL`.

## ◆ metadataSize

int agora::media::base::ExternalVideoFrame::metadataSize

This parameter only applies to video data in Texture format. The MetaData size. The default value is `0`.

## ◆ alphaBuffer

uint8_t* agora::media::base::ExternalVideoFrame::alphaBuffer

The alpha channel data output by using portrait segmentation algorithm. This data matches the size of the video frame, with each pixel value ranging from [0,255], where 0 represents the background and 255 represents the foreground (portrait). By setting this parameter, you can render the video background into various effects, such as transparent, solid color, image, video, etc.

## ◆ fillAlphaBuffer

bool agora::media::base::ExternalVideoFrame::fillAlphaBuffer

This parameter only applies to video data in BGRA or RGBA format. Whether to extract the alpha channel data from the video frame and automatically fill it into `alphaBuffer`:

- `true：Extract and fill the alpha channel data.`
- `false`: (Default) Do not extract and fill the Alpha channel data.
  Note
    For video data in BGRA or RGBA format, you can set the Alpha channel data in either of the following ways:
- Automatically by setting this parameter to `true`.
- Manually through the `alphaBuffer` parameter.

## ◆ alphaStitchMode

ALPHA_STITCH_MODE agora::media::base::ExternalVideoFrame::alphaStitchMode

When the video frame contains alpha channel data, it represents the relative position of `alphaBuffer` and the video frame. See `ALPHA_STITCH_MODE`.

## ◆ d3d11Texture2d

void* agora::media::base::ExternalVideoFrame::d3d11Texture2d

This parameter only applies to video data in Windows Texture format. It represents a pointer to an object of type`ID3D11Texture2D`, which is used by a video frame.

## ◆ textureSliceIndex

int agora::media::base::ExternalVideoFrame::textureSliceIndex

This parameter only applies to video data in Windows Texture format. It represents an index of an `ID3D11Texture2D` texture object used by the video frame in the `ID3D11Texture2D` array.

## ◆ hdr10MetadataInfo

Hdr10MetadataInfo agora::media::base::ExternalVideoFrame::hdr10MetadataInfo

metadata info used for hdr video data

## ◆ colorSpace

ColorSpace agora::media::base::ExternalVideoFrame::colorSpace

By default, the color space properties of video frames will apply the Full Range and BT.709 standard configurations.