Agora Java API Reference for Android
Public Member Functions | List of all members
io.agora.base.NV21Buffer Class Reference
Inheritance diagram for io.agora.base.NV21Buffer:
io.agora.base.VideoFrame.Buffer

Public Member Functions

 NV21Buffer (byte[] data, int width, int height, @Nullable Runnable releaseCallback)
 
int getWidth ()
 
int getHeight ()
 
VideoFrame.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)
 

Constructor & Destructor Documentation

◆ NV21Buffer()

io.agora.base.NV21Buffer.NV21Buffer ( byte[]  data,
int  width,
int  height,
@Nullable Runnable  releaseCallback 
)

Constructs a new TextureBuffer backed by the given data.

Parameters
databuffer data
widthwidth
heightheight
releaseCallbacknullable, invoked the this buffer released.

Member Function Documentation

◆ getWidth()

int io.agora.base.NV21Buffer.getWidth ( )

Resolution of the buffer in pixels.

Returns
width.

Implements io.agora.base.VideoFrame.Buffer.

◆ getHeight()

int io.agora.base.NV21Buffer.getHeight ( )

Resolution of the buffer in pixels.

Returns
height.

Implements io.agora.base.VideoFrame.Buffer.

◆ toI420()

VideoFrame.I420Buffer io.agora.base.NV21Buffer.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.

Note
invoke release() to release the memory or decreases ref count by one, otherwise memory may be leaked.

Implements io.agora.base.VideoFrame.Buffer.

◆ retain()

void io.agora.base.NV21Buffer.retain ( )

Increases ref count by one.

Implements io.agora.base.VideoFrame.Buffer.

◆ release()

void io.agora.base.NV21Buffer.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.

◆ cropAndScale()

VideoFrame.Buffer io.agora.base.NV21Buffer.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|.

Returns
a new buffer which match the request, null if not supported.
Note
invoke release() to release the memory or decreases ref count by one, otherwise memory may be leaked.

Implements io.agora.base.VideoFrame.Buffer.

◆ mirror()

VideoFrame.Buffer io.agora.base.NV21Buffer.mirror ( int  frameRotation)

Apply mirror

Returns
a new buffer which match the request, null if not supported.
Note
invoke release() to release the memory or decreases ref count by one, otherwise memory may be leaked.

Implements io.agora.base.VideoFrame.Buffer.

◆ rotate()

VideoFrame.Buffer io.agora.base.NV21Buffer.rotate ( int  frameRotation)

Apply rotate

Returns
a new buffer which match the request, null if not supported.
Note
invoke release() to release the memory or decreases ref count by one, otherwise memory may be leaked.

Implements io.agora.base.VideoFrame.Buffer.