ExternalVideoFrame

The external video frame.

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class ExternalVideoFrame {
  const ExternalVideoFrame(
      {this.type,
      this.format,
      this.buffer,
      this.stride,
      this.height,
      this.cropLeft,
      this.cropTop,
      this.cropRight,
      this.cropBottom,
      this.rotation,
      this.timestamp,
      this.eglType,
      this.textureId,
      this.matrix,
      this.metadataBuffer,
      this.metadataSize,
      this.alphaBuffer,
      this.textureSliceIndex});

  @JsonKey(name: 'type')
  final VideoBufferType? type;

  @JsonKey(name: 'format')
  final VideoPixelFormat? format;

  @JsonKey(name: 'buffer', ignore: true)
  final Uint8List? buffer;

  @JsonKey(name: 'stride')
  final int? stride;

  @JsonKey(name: 'height')
  final int? height;

  @JsonKey(name: 'cropLeft')
  final int? cropLeft;

  @JsonKey(name: 'cropTop')
  final int? cropTop;

  @JsonKey(name: 'cropRight')
  final int? cropRight;

  @JsonKey(name: 'cropBottom')
  final int? cropBottom;

  @JsonKey(name: 'rotation')
  final int? rotation;

  @JsonKey(name: 'timestamp')
  final int? timestamp;

  @JsonKey(name: 'eglType')
  final EglContextType? eglType;

  @JsonKey(name: 'textureId')
  final int? textureId;

  @JsonKey(name: 'matrix')
  final List<double>? matrix;

  @JsonKey(name: 'metadata_buffer', ignore: true)
  final Uint8List? metadataBuffer;

  @JsonKey(name: 'metadata_size')
  final int? metadataSize;

  @JsonKey(name: 'alphaBuffer', ignore: true)
  final Uint8List? alphaBuffer;

  @JsonKey(name: 'texture_slice_index')
  final int? textureSliceIndex;

  factory ExternalVideoFrame.fromJson(Map<String, dynamic> json) =>
      _$ExternalVideoFrameFromJson(json);

  Map<String, dynamic> toJson() => _$ExternalVideoFrameToJson(this);
}

Attributes

type

The video type. See VideoBufferType.

format
The pixel format. See VideoPixelFormat.
buffer
Video frame buffer.
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
Height of the incoming video frame.
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
This parameter only applies to video data in Texture format. Texture ID of the video frame.
textureId
This parameter only applies to video data in Texture format. Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.
matrix
This parameter only applies to video data in Texture format. Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.
metadataBuffer
This parameter only applies to video data in Texture format. The MetaData buffer. The default value is NULL.
metadataSize
This parameter only applies to video data in Texture format. The MetaData size. The default value is 0.
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.
cropLeft
Raw data related parameter. The number of pixels trimmed from the left. The default value is 0.
This parameter only applies to raw video data.
cropTop
Raw data related parameter. The number of pixels trimmed from the top. The default value is 0.
This parameter only applies to raw video data.
cropRight
Raw data related parameter. The number of pixels trimmed from the right. The default value is 0.
This parameter only applies to raw video data.
cropBottom
Raw data related parameter. The number of pixels trimmed from the bottom. The default value is 0.
This parameter only applies to raw video data.
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
Timestamp (ms) of the incoming video frame. An incorrect timestamp results in frame loss or unsynchronized audio and video.