Agora Java API Reference for Android
|
Public Member Functions | |
int | getWidth () |
int | getHeight () |
ByteBuffer | getDataY () |
ByteBuffer | getDataU () |
ByteBuffer | getDataV () |
int | getStrideY () |
int | getStrideU () |
int | getStrideV () |
VideoFrame.I420Buffer | toI420 () |
void | retain () |
void | release () |
VideoFrame.Buffer | cropAndScale (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) |
Static Public Member Functions | |
static JavaI420Buffer | wrap (int width, int height, ByteBuffer dataY, int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV, Runnable releaseCallback) |
static JavaI420Buffer | createYUV (byte[] data, int width, int height) |
static JavaI420Buffer | allocate (int width, int height) |
Implementation of VideoFrame.I420Buffer backed by Java direct byte buffers.
|
static |
Wraps existing ByteBuffers into JavaI420Buffer object without copying the contents.
|
static |
Allocates an empty I420Buffer suitable for an image of the given dimensions.
int io.agora.rtc.gl.JavaI420Buffer.getWidth | ( | ) |
Resolution of the buffer in pixels.
Implements io.agora.rtc.gl.VideoFrame.Buffer.
ByteBuffer io.agora.rtc.gl.JavaI420Buffer.getDataY | ( | ) |
Returns a direct ByteBuffer containing Y-plane data. The buffer capacity is at least getStrideY() * getHeight() bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
Implements io.agora.rtc.gl.VideoFrame.I420Buffer.
ByteBuffer io.agora.rtc.gl.JavaI420Buffer.getDataU | ( | ) |
Returns a direct ByteBuffer containing U-plane data. The buffer capacity is at least getStrideU() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
Implements io.agora.rtc.gl.VideoFrame.I420Buffer.
ByteBuffer io.agora.rtc.gl.JavaI420Buffer.getDataV | ( | ) |
Returns a direct ByteBuffer containing V-plane data. The buffer capacity is at least getStrideV() * ((getHeight() + 1) / 2) bytes. The position of the returned buffer is ignored and must be 0. Callers may mutate the ByteBuffer (eg. through relative-read operations), so implementations must return a new ByteBuffer or slice for each call.
Implements io.agora.rtc.gl.VideoFrame.I420Buffer.
VideoFrame.I420Buffer io.agora.rtc.gl.JavaI420Buffer.toI420 | ( | ) |
Returns a memory-backed frame in I420 format. If the pixel data is in another format, a conversion will take place. All implementations must provide a fallback to I420 for compatibility with e.g. the internal WebRTC software encoders.
Implements io.agora.rtc.gl.VideoFrame.Buffer.
void io.agora.rtc.gl.JavaI420Buffer.retain | ( | ) |
Reference counting is needed since a video buffer can be shared between multiple VideoSinks, and the buffer needs to be returned to the VideoSource as soon as all references are gone.
Implements io.agora.rtc.gl.VideoFrame.Buffer.
VideoFrame.Buffer io.agora.rtc.gl.JavaI420Buffer.cropAndScale | ( | int | cropX, |
int | cropY, | ||
int | cropWidth, | ||
int | cropHeight, | ||
int | scaleWidth, | ||
int | scaleHeight | ||
) |
Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|. Scales it to size |scaleWidth| x |scaleHeight|.
Implements io.agora.rtc.gl.VideoFrame.Buffer.