AgoraVideoFrame
Used to describe external video frames.
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;
}
Note:
- The unit of
strideis pixels, not bytes. - Frame width and height can be derived as follows:
- Cropped width:
croppedWidth = strideInPixels - cropLeft - cropRight - Cropped height:
croppedHeight = height - cropTop - cropBottom
- Cropped width:
- About cropping:
- If the buffer contains redundant data, cropping can be used to remove it. For example, if the frame size is 360 × 640 but the buffer
strideis 368, the extra 8 pixels are padding. In this case, set:stride = 368,height = 640,cropRight = 8, and othercropXXXvalues default to 0.
- If the buffer contains redundant data, cropping can be used to remove it. For example, if the frame size is 360 × 640 but the buffer
Properties
- format
- Format of the video data:
- 10:
TEXTURE_2D - 11:
TEXTURE_OES, usually used for camera-captured data - 1:
I420 - 3:
NV21 - 4:
RGBA - 16:
I422
- 10:
- timeStamp
- Timestamp of the video frame in milliseconds. Incorrect settings may cause frame loss or A/V sync issues.
- stride
- Row stride of the video frame in pixels. For texture-type video data, this indicates the texture width.
- height
- Height of the video frame.
- textureID
- Texture ID. Only applicable to texture-format video data.
- syncMode
- Whether to enable sync mode. Only applicable to texture-format video data:
- true: Enable sync mode. The SDK waits for texture processing to complete.
- false: Disable sync mode.
- transform
- Additional transform parameters for texture frames. Only applicable to texture-format video data.
- eglContext10
- EGLContext10. Only applicable to texture-format video data.
- eglContext14
- EGLContext14. Only applicable to texture-format video data. See
EGLContext. - buf
- Data buffer of the video frame.
- cropLeft
- Number of pixels to crop from the left. Default is 0.
- cropTop
- Number of pixels to crop from the top. Default is 0.
- cropRight
- Number of pixels to crop from the right. Default is 0.
- cropBottom
- Number of pixels to crop from the bottom. Default is 0.
- rotation
- Clockwise rotation angle. Can be 0, 90, 180, or 270. Default is 0.
- alphaStitchMode
- When the video frame contains alpha channel data, indicates the relative position of
alphaBufferto the video frame. SeeAlphaStitchMode:ALPHA_NO_STITCH (0): Default. Only the video frame is included.alphaBufferis not stitched.ALPHA_STITCH_UP (1):alphaBufferis above the video frame.ALPHA_STITCH_BELOW (2):alphaBufferis below the video frame.ALPHA_STITCH_LEFT (3):alphaBufferis to the left of the video frame.ALPHA_STITCH_RIGHT (4):alphaBufferis to the right of the video frame.