ExternalVideoFrame
- Flutter
更新时间
外部视频帧。
@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.fillAlphaBuffer,
this.alphaStitchMode,
this.d3d11Texture2d,
this.textureSliceIndex,
this.colorSpace});
@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: 'metadataBuffer', ignore: true)
final Uint8List? metadataBuffer;
@JsonKey(name: 'metadataSize')
final int? metadataSize;
@JsonKey(name: 'alphaBuffer', ignore: true)
final Uint8List? alphaBuffer;
@JsonKey(name: 'fillAlphaBuffer')
final bool? fillAlphaBuffer;
@JsonKey(name: 'alphaStitchMode')
final AlphaStitchMode? alphaStitchMode;
@JsonKey(name: 'd3d11Texture2d', readValue: readIntPtr)
final int? d3d11Texture2d;
@JsonKey(name: 'textureSliceIndex')
final int? textureSliceIndex;
@JsonKey(name: 'colorSpace')
final ColorSpace? colorSpace;
factory ExternalVideoFrame.fromJson(Map<String, dynamic> json) =>
_$ExternalVideoFrameFromJson(json);
Map<String, dynamic> toJson() => _$ExternalVideoFrameToJson(this);
}属性
| 参数名 | 描述 |
|---|---|
type | 视频类型。详见 VideoBufferType。 |
format | 像素格式。详见 VideoPixelFormat。 |
buffer | 视频缓冲区。 |
stride | 传入视频帧的行间距,单位为像素而不是字节。对于 Texture,该值指的是 Texture 的宽度。 |
height | 传入视频帧的高度。 |
eglContext | 该参数仅适用于 Texture 格式的视频数据。
|
eglType | 该参数仅适用于 Texture 格式的视频数据。指该视频帧的 Texture ID。 |
textureId | 该参数仅适用于 Texture 格式的视频数据。为一个输入的 4x4 变换矩阵,典型值为一个单位矩阵。 |
matrix | 该参数仅适用于 Texture 格式的视频数据。为一个输入的 4x4 变换矩阵,典型值为一个单位矩阵。 |
metadataBuffer | 该参数仅适用于 Texture 格式的视频数据。指 MetaData 的数据缓冲区,默认值为 |
metadataSize | 该参数仅适用于 Texture 格式的视频数据。指 MetaData 的大小,默认值为 |
d3d11Texture2d | 该参数仅适用于 Windows Texture 格式的视频数据。表示一个指向 |
alphaBuffer | 采用人像分割算法输出的 Alpha 通道数据。该数据跟视频帧的尺寸一致,每个像素点的取值范围为 [0,255],其中 0 代表背景;255 代表前景(人像)。 你可以通过设置该参数,实现将视频背景自渲染为各种效果,例如:透明、纯色、图片、视频等。 注: 在自定义视频渲染场景下,需确保传入的视频帧和 |
fillAlphaBuffer | 注: 对于 BGRA 或 RGBA 格式的视频数据,你可以任选一种方式设置 Alpha 通道数据:
该参数仅适用于 BGRA 或 RGBA 格式的视频数据。设置是否提取视频帧中的 Alpha 通道数据并自动填入到
|
alphaStitchMode | 当视频帧中包含 Alpha 通道数据时,设置 |
textureSliceIndex | 该参数仅适用于 Windows Texture 格式的视频数据。表示在 |
cropLeft | 该参数仅适用于原始视频数据。 |
cropTop | 该参数仅适用于原始视频数据。 |
cropRight | 该参数仅适用于原始视频数据。 |
cropBottom | 该参数仅适用于原始视频数据。 |
rotation | 原始数据相关字段。指定是否对传入的视频组做顺时针旋转操作,可选值为 0, 90, 180, 270。默认为 0。 |
timestamp | 传入的视频帧的时间戳,以毫秒为单位。不正确的时间戳会导致丢帧或者音视频不同步。 |
colorSpace | 视频帧的色彩空间属性,默认情况下会应用 Full Range 和 BT.709 标准配置。你可以根据自定义采集、自定义渲染的业务需求进行自定义设置,详见 VideoColorSpace。 |