public class JavaI420Buffer extends java.lang.Object implements VideoFrame.I420Buffer
| Modifier and Type | Method and Description |
|---|---|
static JavaI420Buffer |
allocate(int width,
int height)
Allocates an empty I420Buffer suitable for an image of the given dimensions.
|
VideoFrame.Buffer |
cropAndScale(int cropX,
int cropY,
int cropWidth,
int cropHeight,
int scaleWidth,
int scaleHeight)
Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|.
|
static VideoFrame.Buffer |
cropAndScaleI420(VideoFrame.I420Buffer buffer,
int cropX,
int cropY,
int cropWidth,
int cropHeight,
int scaleWidth,
int scaleHeight)
Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|.
|
java.nio.ByteBuffer |
getDataU()
Returns a direct ByteBuffer containing U-plane data.
|
java.nio.ByteBuffer |
getDataV()
Returns a direct ByteBuffer containing V-plane data.
|
java.nio.ByteBuffer |
getDataY()
Returns a direct ByteBuffer containing Y-plane data.
|
int |
getHeight()
Resolution of the buffer in pixels.
|
int |
getStrideU() |
int |
getStrideV() |
int |
getStrideY() |
int |
getWidth()
Resolution of the buffer in pixels.
|
VideoFrame.Buffer |
mirror(int frameRotation)
Apply mirror
|
void |
release()
Decreases ref count by one.
|
void |
retain()
Increases ref count by one.
|
VideoFrame.Buffer |
rotate(int frameRotation)
Apply rotate
|
VideoFrame.I420Buffer |
toI420()
Returns a memory-backed frame in I420 format.
|
VideoFrame.Buffer |
transform(int cropX,
int cropY,
int cropWidth,
int cropHeight,
int scaleWidth,
int scaleHeight,
int rotation)
Apply crop/scale/mirror/rotate
|
static JavaI420Buffer |
wrap(int width,
int height,
java.nio.ByteBuffer dataY,
int strideY,
java.nio.ByteBuffer dataU,
int strideU,
java.nio.ByteBuffer dataV,
int strideV,
java.lang.Runnable releaseCallback)
Wraps existing ByteBuffers into JavaI420Buffer object without copying the contents.
|
public static JavaI420Buffer wrap(int width, int height, java.nio.ByteBuffer dataY, int strideY, java.nio.ByteBuffer dataU, int strideU, java.nio.ByteBuffer dataV, int strideV, java.lang.Runnable releaseCallback)
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.public static JavaI420Buffer allocate(int width, int height)
width - width.height - height.public int getWidth()
VideoFrame.BuffergetWidth in interface VideoFrame.Bufferpublic int getHeight()
VideoFrame.BuffergetHeight in interface VideoFrame.Bufferpublic java.nio.ByteBuffer getDataY()
VideoFrame.I420BuffergetDataY in interface VideoFrame.I420Bufferpublic java.nio.ByteBuffer getDataU()
VideoFrame.I420BuffergetDataU in interface VideoFrame.I420Bufferpublic java.nio.ByteBuffer getDataV()
VideoFrame.I420BuffergetDataV in interface VideoFrame.I420Bufferpublic int getStrideY()
getStrideY in interface VideoFrame.I420Bufferpublic int getStrideU()
getStrideU in interface VideoFrame.I420Bufferpublic int getStrideV()
getStrideV in interface VideoFrame.I420Bufferpublic VideoFrame.I420Buffer toI420()
VideoFrame.BuffertoI420 in interface VideoFrame.Bufferpublic void retain()
VideoFrame.Bufferretain in interface VideoFrame.Bufferpublic void release()
VideoFrame.Bufferrelease in interface VideoFrame.Bufferpublic VideoFrame.Buffer cropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)
VideoFrame.BuffercropAndScale in interface VideoFrame.Bufferpublic VideoFrame.Buffer mirror(int frameRotation)
VideoFrame.Buffermirror in interface VideoFrame.Bufferpublic VideoFrame.Buffer rotate(int frameRotation)
VideoFrame.Bufferrotate in interface VideoFrame.Bufferpublic VideoFrame.Buffer transform(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, int rotation)
VideoFrame.Buffertransform in interface VideoFrame.Bufferpublic static VideoFrame.Buffer cropAndScaleI420(VideoFrame.I420Buffer buffer, int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)