ExternalVideoFrame
外部视频帧。
public class ExternalVideoFrame { public ExternalVideoFrame() { this.type = VIDEO_BUFFER_TYPE.VIDEO_BUFFER_RAW_DATA; this.format = VIDEO_PIXEL_FORMAT.VIDEO_PIXEL_UNKNOWN; this.buffer = null; this.stride = 0; this.height = 0; this.cropLeft = 0; this.cropTop = 0; this.cropRight = 0; this.cropBottom = 0; this.rotation = 0; this.timestamp = 0; this.eglContext = null; this.eglType = EGL_CONTEXT_TYPE.EGL_CONTEXT10; this.textureId = 0; this.metadata_buffer = null; this.metadata_size = 0; } public ExternalVideoFrame(VIDEO_BUFFER_TYPE type, VIDEO_PIXEL_FORMAT format, byte[] buffer, int stride, int height, long timestamp, byte[] eglContext, EGL_CONTEXT_TYPE eglType, int textureId, byte[] metadata_buffer, int metadata_size, int cropLeft = 0, int cropTop = 0, int cropRight = 0, int cropBottom = 0, int rotation = 0) { this.type = type; this.format = format; this.buffer = buffer; this.stride = stride; this.height = height; this.cropLeft = cropLeft; this.cropTop = cropTop; this.cropRight = cropRight; this.cropBottom = cropBottom; this.rotation = rotation; this.timestamp = timestamp; this.eglContext = eglContext; this.eglType = eglType; this.textureId = textureId; this.metadata_buffer = metadata_buffer; this.metadata_size = metadata_size; } public VIDEO_BUFFER_TYPE type { set; get; } public VIDEO_PIXEL_FORMAT format { set; get; } public byte[] buffer { set; get; } public int stride { set; get; } public int height { set; get; } public int cropLeft { set; get; } public int cropTop { set; get; } public int cropRight { set; get; } public int cropBottom { set; get; } public int rotation { set; get; } public long timestamp { set; get; } public byte[] eglContext { set; get; } public EGL_CONTEXT_TYPE eglType { set; get; } public int textureId { set; get; } public byte[] metadata_buffer { set; get; } public int metadata_size { set; get; } }
属性
- type
-
视频类型。详见 VIDEO_BUFFER_TYPE。
- format
- 像素格式。详见 VIDEO_PIXEL_FORMAT。
- buffer
- 视频缓冲区。
- stride
- 传入视频帧的行间距,单位为像素而不是字节。对于 Texture,该值指的是 Texture 的宽度。
- height
- 传入视频帧的高度。
- eglContext
- 该参数仅适用于 Texture 格式的视频数据。
- 当使用 Khronos 定义的 OpenGL 接口 (javax.microedition.khronos.egl.*)时,需要将 eglContext 设置给这个字段。
- 当使用 Android 定义的 OpenGL 接口 (android.opengl.*)时,需要将 eglContext 设置给这个字段。
- eglType
- 该参数仅适用于 Texture 格式的视频数据。指该视频帧的 Texture ID。
- textureId
- 该参数仅适用于 Texture 格式的视频数据。为一个输入的 4x4 变换矩阵,典型值为一个单位矩阵。
- metadata_buffer
- 该参数仅适用于 Texture 格式的视频数据。指 MetaData 的数据缓冲区,默认值为
NULL
。 - metadata_size
- 该参数仅适用于 Texture 格式的视频数据。指 MetaData 的大小,默认值为
0
。 - cropLeft
- 原始数据相关字段。指定左边裁剪掉的像素数量。默认为 0。
- cropTop
- 原始数据相关字段。指定顶边裁剪掉的像素数量。默认为 0。
- cropRight
- 原始数据相关字段。指定右边裁剪掉的像素数量。默认为 0。
- cropBottom
- 原始数据相关字段。指定底边裁剪掉的像素数量。默认为 0。
- rotation
- 原始数据相关字段。指定是否对传入的视频组做顺时针旋转操作,可选值为 0, 90, 180, 270。默认为 0。
- timestamp
- 传入的视频帧的时间戳,以毫秒为单位。不正确的时间戳会导致丢帧或者音视频不同步。