Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.base.VideoFrame.Buffer Interface Reference
Inheritance diagram for io.agora.base.VideoFrame.Buffer:

## Public Member Functions
int | getWidth ()
int | getHeight ()
I420Buffer | toI420 ()
void | release ()
void | retain ()
Buffer | cropAndScale (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)
Buffer | mirror (int frameRotation)
Buffer | rotate (int frameRotation)
Buffer | transform (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, int frameRotation)

## Detailed Description

Implements image storage medium. Might be for example an OpenGL texture or a memory region containing I420-data.

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.

## Member Function Documentation

## ◆ getWidth()

int io.agora.base.VideoFrame.Buffer.getWidth | ( |  | ) |

Resolution of the buffer in pixels.

Returns
  width.

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI010Buffer, io.agora.base.JavaI420Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ getHeight()

int io.agora.base.VideoFrame.Buffer.getHeight | ( |  | ) |

Resolution of the buffer in pixels.

Returns
  height.

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ toI420()

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

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ release()

void io.agora.base.VideoFrame.Buffer.release | ( |  | ) |

Decreases ref count by one. When the ref count reaches zero, resources related to the object will be freed.

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ retain()

void io.agora.base.VideoFrame.Buffer.retain | ( |  | ) |

Increases ref count by one.

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ cropAndScale()

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

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ mirror()

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

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ rotate()

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

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.

## ◆ transform()

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

Implemented in io.agora.base.TextureBuffer, io.agora.base.JavaI420Buffer, io.agora.base.JavaI010Buffer, io.agora.base.NV21Buffer, and io.agora.base.NV12Buffer.