VideoFrame

Configurations of the video frame.

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class VideoFrame {
  const VideoFrame(
      {this.type,
      this.width,
      this.height,
      this.yStride,
      this.uStride,
      this.vStride,
      this.yBuffer,
      this.uBuffer,
      this.vBuffer,
      this.rotation,
      this.renderTimeMs,
      this.avsyncType,
      this.metadataBuffer,
      this.metadataSize,
      this.textureId,
      this.matrix,
      this.pixelBuffer});

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

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

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

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

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

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

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

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

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

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

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

  @JsonKey(name: 'avsync_type')
  final int? avsyncType;

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

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

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

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

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

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

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

Note that the buffer provides a pointer to a pointer. This interface cannot modify the pointer of the buffer, but it can modify the content of the buffer.

Attributes

type
The pixel format. See VideoPixelFormat.
width
The width of the video, in pixels.
height
The height of the video, in pixels.
yStride
For YUV data, the line span of the Y buffer; for RGBA data, the total data length.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
uStride
For YUV data, the line span of the U buffer; for RGBA data, the value is 0.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
vStride
For YUV data, the line span of the V buffer; for RGBA data, the value is 0.
Attention: When dealing with video data, it is necessary to process the offset between each line of pixel data based on this parameter, otherwise it may result in image distortion.
yBuffer
For YUV data, the pointer to the Y buffer; for RGBA data, the data buffer.
uBuffer
For YUV data, the pointer to the U buffer; for RGBA data, the value is 0.
vBuffer
For YUV data, the pointer to the V buffer; for RGBA data, the value is 0.
rotation
The clockwise rotation of the video frame before rendering. Supported values include 0, 90, 180, and 270 degrees.
renderTimeMs
The Unix timestamp (ms) when the video frame is rendered. This timestamp can be used to guide the rendering of the video frame. This parameter is required.
avsyncType
Reserved for future use.
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.
textureId
This parameter only applies to video data in Texture format. Texture ID.
matrix
This parameter only applies to video data in Texture format. Incoming 4 × 4 transformational matrix. The typical value is a unit matrix.
metaInfo

The meta information in the video frame. To use this parameter, please technical support.