AgoraVideoFrame
- Android
更新时间不可用
用于描述外部视频帧。
public class AgoraVideoFrame {
public static final int FORMAT_NONE = -1;
public static final int FORMAT_TEXTURE_2D = 10;
public static final int FORMAT_TEXTURE_OES = 11;
public static final int FORMAT_I420 = 1;
public static final int FORMAT_BGRA = 2;
public static final int FORMAT_NV21 = 3;
public static final int FORMAT_RGBA = 4;
public static final int FORMAT_I422 = 16;
public static final int BUFFER_TYPE_NONE = -1;
public static final int BUFFER_TYPE_BUFFER = 1;
public static final int BUFFER_TYPE_ARRAY = 2;
public static final int BUFFER_TYPE_TEXTURE = 3;
public int format;
public long timeStamp;
public int stride;
public int height;
public int textureID;
public boolean syncMode;
public float[] transform;
public javax.microedition.khronos.egl.EGLContext eglContext10;
public android.opengl.EGLContext eglContext14;
public byte[] buf;
public int cropLeft;
public int cropTop;
public int cropRight;
public int cropBottom;
public int rotation;
public AlphaStitchMode alphaStitchMode;
}注:
-
stride的单位为像素(pixel),而非字节(byte)。 -
帧宽和高可通过以下方式推导:
- 裁剪后宽度:
croppedWidth = strideInPixels - cropLeft - cropRight - 裁剪后高度:
croppedHeight = height - cropTop - cropBottom
- 裁剪后宽度:
-
关于裁剪:
- 如果缓冲区中存在冗余数据,可通过裁剪去除。例如帧大小为 360 × 640,但缓冲区的
stride为 368,多出的 8 像素用于填充,此时可设置:stride = 368,height = 640,cropRight = 8,其余cropXXX默认为 0。
- 如果缓冲区中存在冗余数据,可通过裁剪去除。例如帧大小为 360 × 640,但缓冲区的
属性
| 参数名 | 描述 |
|---|---|
format | |
timeStamp | |
stride | |
height | |
textureID | |
syncMode | |
transform | |
eglContext10 | |
eglContext14 | |
buf | |
cropLeft | |
cropTop | |
cropRight | |
cropBottom | |
rotation | |
alphaStitchMode |