Agora Java API Reference for Android

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

## Public Member Functions
| JavaI010Buffer (int width, int height, ByteBuffer dataY, int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV, @Nullable Runnable releaseCallback)
ByteBuffer | getDataY ()
ByteBuffer | getDataV ()
ByteBuffer | getDataU ()
int | getHeight ()
int | getWidth ()
int | getStrideV ()
int | getStrideY ()
int | getStrideU ()
void | release ()
I420Buffer | toI420 ()
void | retain ()
VideoFrame.Buffer | cropAndScale (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)
VideoFrame.Buffer | rotate (int frameRotation)
VideoFrame.Buffer | transform (int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, int rotation)
VideoFrame.Buffer | mirror (int frameRotation)

## Static Public Member Functions
static JavaI010Buffer | wrap (int width, int height, ByteBuffer dataY, int strideY, ByteBuffer dataU, int strideU, ByteBuffer dataV, int strideV, @Nullable Runnable releaseCallback)
static JavaI010Buffer | allocate (int width, int height)
static I420Buffer | i010BufferToI420 (JavaI010Buffer buffer)

## Detailed Description

Implementation of VideoFrame.I010Buffer backed by Java direct byte buffers.

## Constructor & Destructor Documentation

## ◆ JavaI010Buffer()

io.agora.base.JavaI010Buffer.JavaI010Buffer | ( | int | width,
|  | int | height,
|  | ByteBuffer | dataY,
|  | int | strideY,
|  | ByteBuffer | dataU,
|  | int | strideU,
|  | ByteBuffer | dataV,
|  | int | strideV,
|  | @Nullable Runnable | releaseCallback
| ) |  |

Constructs a new JavaI010Buffer backed by the given data

## Member Function Documentation

## ◆ allocate()

static JavaI010Buffer io.agora.base.JavaI010Buffer.allocate | ( | int | width,
|  | int | height
| ) |  |
| static

Allocates an empty I010Buffer suitable for an image of the given dimensions.

Parameters

  width | width.
  height | height.

Returns
  an empty I010Buffer.

## ◆ getDataY()

ByteBuffer io.agora.base.JavaI010Buffer.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.I010Buffer.

## ◆ getDataV()

ByteBuffer io.agora.base.JavaI010Buffer.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.I010Buffer.

## ◆ getDataU()

ByteBuffer io.agora.base.JavaI010Buffer.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.I010Buffer.

## ◆ getHeight()

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

Resolution of the buffer in pixels.

Returns
  height.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ getWidth()

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

Resolution of the buffer in pixels.

Returns
  width.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ release()

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

## ◆ toI420()

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

Increases ref count by one.

Implements io.agora.base.VideoFrame.Buffer.

## ◆ cropAndScale()

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

## ◆ rotate()

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

## ◆ mirror()

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