ExternalVideoFrame
Represents an external video frame.
struct ExternalVideoFrame {
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;
};
Properties
- type
- Video type. See VIDEO_BUFFER_TYPE.
- format
- Pixel format. See VIDEO_PIXEL_FORMAT.
- buffer
- Video frame buffer.
- stride
- Stride of the input video frame in pixels, not bytes. For texture data, this is the width of the texture.
- height
- Height of the input video frame.
- cropLeft
- Number of pixels to crop from the left. Default is 0.
- cropTop
- Number of pixels to crop from the top. Default is 0.
- cropRight
- Number of pixels to crop from the right. Default is 0.
- cropBottom
- Number of pixels to crop from the bottom. Default is 0.
- rotation
- Clockwise rotation angle of the video frame. Can be 0, 90, 180, or 270. Default is 0.
- timestamp
- Timestamp (in milliseconds) of the input video frame. Incorrect timestamps may cause frame loss or A/V sync issues.
- eglContext
- (Texture only)
- When using the OpenGL interface defined by Khronos (javax.microedition.khronos.egl.*), set this field to
eglContext. - When using the OpenGL interface defined by Android (android.opengl.*), also set this field to
eglContext.
- When using the OpenGL interface defined by Khronos (javax.microedition.khronos.egl.*), set this field to
- eglType
- (Texture only) Type of texture context.
- textureId
- (Texture only) Texture ID of the video frame.
- fenceObject
- (Texture only) Fence object associated with the
textureIdparameter, indicating the synchronization status of the texture data. Default is 0. - matrix
- (Texture only) Input 4×4 transformation matrix. A typical value is the identity matrix.
- metadataBuffer
- (Texture only) MetaData buffer. Default is NULL.
- metadataSize
- (Texture only) MetaData size. Default is 0.
- alphaBuffer
- Output parameter, Alpha channel data generated by the portrait segmentation algorithm. The data matches the size of the video frame. Each pixel value ranges from [0, 255], where 0 indicates background and 255 indicates foreground (portrait). By setting this parameter, you can render the video background as transparent, solid color, image, video, etc.
- fillAlphaBuffer
-
Note: For BGRA or RGBA format video data, you can set Alpha channel data by either:(BGRA or RGBA only) Whether to extract Alpha channel data from the video frame and automatically fill
- Setting this parameter to true for automatic extraction.
- Manually setting it via the
alphaBufferparameter.
alphaBuffer:- true: Extract and fill Alpha channel data.
- false: Do not extract or fill Alpha channel data.
- alphaStitchMode
- When the video frame contains Alpha channel data, indicates the relative position of
alphaBufferto the video frame. See ALPHA_STITCH_MODE. - d3d11Texture2d
- (Windows Texture only) Pointer to an
ID3D11Texture2Dobject used by the video frame. - textureSliceIndex
- (Windows Texture only) Index of the texture object used by the video frame in the
ID3D11Texture2Darray. - hdr10MetadataInfo
- Metadata information of HDR video data.
- colorSpace
- Color space attributes of the video frame. Defaults to Full Range and BT.709 standard configuration. See [
VideoColorSpace](https://developer.mozilla.org/en-US/docs/Web/API/VideoColorSpace).