Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.base.NV12Buffer Class Reference
Inheritance diagram for io.agora.base.NV12Buffer:

## Public Member Functions
| NV12Buffer (int width, int height, int stride, int sliceHeight, ByteBuffer buffer, @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)
VideoFrame.Buffer | transform (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, int rotation)

## Member Function Documentation

## ◆ getWidth()

int io.agora.base.NV12Buffer.getWidth | ( |  | ) |

Resolution of the buffer in pixels.

Returns
  width.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ getHeight()

int io.agora.base.NV12Buffer.getHeight | ( |  | ) |

Resolution of the buffer in pixels.

Returns
  height.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ toI420()

VideoFrame.I420Buffer io.agora.base.NV12Buffer.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.NV12Buffer.retain | ( |  | ) |

Increases ref count by one.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ release()

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

## ◆ transform()

VideoFrame.Buffer io.agora.base.NV12Buffer.transform | ( | int | cropX,
|  | int | cropY,
|  | int | cropWidth,
|  | int | cropHeight,
|  | int | scaleWidth,
|  | int | scaleHeight,
|  | int | frameRotation
| ) |  |

Apply crop/scale/mirror/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.