- java.lang.Object
-
- dev.onvoid.webrtc.internal.NativeObject
-
- dev.onvoid.webrtc.internal.RefCountedObject
-
- dev.onvoid.webrtc.media.video.NativeI420Buffer
-
- All Implemented Interfaces:
dev.onvoid.webrtc.internal.RefCounted,I420Buffer,VideoFrameBuffer
public class NativeI420Buffer extends dev.onvoid.webrtc.internal.RefCountedObject implements I420Buffer
This class wraps the native WebRTC I420BufferInterface.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NativeI420Bufferallocate(int width, int height)Allocates an empty I420Buffer suitable for an image of the given dimensions.VideoFrameBuffercropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)Crops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|.ByteBuffergetDataU()Returns a direct ByteBuffer containing U-plane data.ByteBuffergetDataV()Returns a direct ByteBuffer containing V-plane data.ByteBuffergetDataY()Returns a direct ByteBuffer containing Y-plane data.intgetHeight()intgetStrideU()intgetStrideV()intgetStrideY()intgetWidth()Resolution of the buffer in pixels.I420BuffertoI420()Returns a memory-backed frame in I420 format.StringtoString()
-
-
-
Method Detail
-
getDataY
public ByteBuffer getDataY()
Description copied from interface:I420BufferReturns 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.- Specified by:
getDataYin interfaceI420Buffer
-
getDataU
public ByteBuffer getDataU()
Description copied from interface:I420BufferReturns 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.- Specified by:
getDataUin interfaceI420Buffer
-
getDataV
public ByteBuffer getDataV()
Description copied from interface:I420BufferReturns 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.- Specified by:
getDataVin interfaceI420Buffer
-
getStrideY
public int getStrideY()
- Specified by:
getStrideYin interfaceI420Buffer
-
getStrideU
public int getStrideU()
- Specified by:
getStrideUin interfaceI420Buffer
-
getStrideV
public int getStrideV()
- Specified by:
getStrideVin interfaceI420Buffer
-
getWidth
public int getWidth()
Description copied from interface:VideoFrameBufferResolution of the buffer in pixels.- Specified by:
getWidthin interfaceVideoFrameBuffer
-
getHeight
public int getHeight()
- Specified by:
getHeightin interfaceVideoFrameBuffer
-
toI420
public I420Buffer toI420()
Description copied from interface:VideoFrameBufferReturns 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.- Specified by:
toI420in interfaceVideoFrameBuffer
-
cropAndScale
public VideoFrameBuffer cropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight)
Description copied from interface:VideoFrameBufferCrops a region defined by |cropx|, |cropY|, |cropWidth| and |cropHeight|. Scales it to size |scaleWidth| x |scaleHeight|.- Specified by:
cropAndScalein interfaceVideoFrameBuffer
-
allocate
public static NativeI420Buffer allocate(int width, int height)
Allocates an empty I420Buffer suitable for an image of the given dimensions.
-
-