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 () |
I420Buffer | toI420 () |
void | retain () |
void | release () |
VideoFrame.Buffer | cropAndScale (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) |
VideoFrame.Buffer | mirror (int frameRotation) |
VideoFrame.Buffer | rotate (int frameRotation) |
Static Public Member Functions | |
static JavaI420Buffer | wrap (int width, int height, ByteBuffer dataY, int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV, @Nullable Runnable releaseCallback) |
static JavaI420Buffer | allocate (int width, int height) |
static VideoFrame.Buffer | cropAndScaleI420 (final I420Buffer buffer, int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) |
Implementation of VideoFrame.I420Buffer backed by Java direct byte buffers.
|
static |
Wraps existing ByteBuffers into JavaI420Buffer object without copying the contents.
width | width. |
height | height. |
dataY | direct buffer, not allowed to be null, otherwise exception will throw. |
strideY | stride y. |
dataU | direct buffer, not allowed to be null, otherwise exception will throw. |
strideU | stride u. |
dataV | direct buffer, not allowed to be null, otherwise exception will throw. |
strideV | stride v. |
releaseCallback | nullable, invoked the this buffer released. |
|
static |
Allocates an empty I420Buffer suitable for an image of the given dimensions.
width | width. |
height | height. |
int io.agora.base.JavaI420Buffer.getWidth | ( | ) |
int io.agora.base.JavaI420Buffer.getHeight | ( | ) |
ByteBuffer io.agora.base.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.base.VideoFrame.I420Buffer.
ByteBuffer io.agora.base.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.base.VideoFrame.I420Buffer.
ByteBuffer io.agora.base.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.base.VideoFrame.I420Buffer.
I420Buffer io.agora.base.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.base.VideoFrame.Buffer.
void io.agora.base.JavaI420Buffer.retain | ( | ) |
Increases ref count by one.
Implements io.agora.base.VideoFrame.Buffer.
void io.agora.base.JavaI420Buffer.release | ( | ) |
Decreases ref count by one. When the ref count reaches zero, resources related to the object will be freed.
Implements io.agora.base.VideoFrame.Buffer.
VideoFrame.Buffer io.agora.base.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.base.VideoFrame.Buffer.
VideoFrame.Buffer io.agora.base.JavaI420Buffer.mirror | ( | int | frameRotation | ) |
Apply mirror
Implements io.agora.base.VideoFrame.Buffer.
VideoFrame.Buffer io.agora.base.JavaI420Buffer.rotate | ( | int | frameRotation | ) |
Apply rotate
Implements io.agora.base.VideoFrame.Buffer.
|
static |
Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|. Scales it to size |scaleWidth| x |scaleHeight|.