Package org.webrtc
Class NV21Buffer
java.lang.Object
org.webrtc.NV21Buffer
- All Implemented Interfaces:
RefCounted,VideoFrame.Buffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final intprivate final RefCountDelegateprivate final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) Crops a region defined by `cropx`, `cropY`, `cropWidth` and `cropHeight`.intintgetWidth()Resolution of the buffer in pixels.private static voidnativeCropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, byte[] src, int srcWidth, int srcHeight, ByteBuffer dstY, int dstStrideY, ByteBuffer dstU, int dstStrideU, ByteBuffer dstV, int dstStrideV) voidrelease()Decreases ref count by one.voidretain()Increases ref count by one.toI420()Returns a memory-backed frame in I420 format.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.webrtc.VideoFrame.Buffer
getBufferType
-
Field Details
-
data
private final byte[] data -
width
private final int width -
height
private final int height -
refCountDelegate
-
-
Constructor Details
-
NV21Buffer
-
-
Method Details
-
getWidth
public int getWidth()Description copied from interface:VideoFrame.BufferResolution of the buffer in pixels.- Specified by:
getWidthin interfaceVideoFrame.Buffer
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceVideoFrame.Buffer
-
toI420
Description copied from interface:VideoFrame.BufferReturns 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.Conversion may fail, for example if reading the pixel data from a texture fails. If the conversion fails, null is returned.
- Specified by:
toI420in interfaceVideoFrame.Buffer
-
retain
public void retain()Description copied from interface:RefCountedIncreases ref count by one.- Specified by:
retainin interfaceRefCounted- Specified by:
retainin interfaceVideoFrame.Buffer
-
release
public void release()Description copied from interface:RefCountedDecreases ref count by one. When the ref count reaches zero, resources related to the object will be freed.- Specified by:
releasein interfaceRefCounted- Specified by:
releasein interfaceVideoFrame.Buffer
-
cropAndScale
public VideoFrame.Buffer cropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) Description copied from interface:VideoFrame.BufferCrops a region defined by `cropx`, `cropY`, `cropWidth` and `cropHeight`. Scales it to size `scaleWidth` x `scaleHeight`.- Specified by:
cropAndScalein interfaceVideoFrame.Buffer
-
nativeCropAndScale
private static void nativeCropAndScale(int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight, byte[] src, int srcWidth, int srcHeight, ByteBuffer dstY, int dstStrideY, ByteBuffer dstU, int dstStrideU, ByteBuffer dstV, int dstStrideV)
-