Package tvi.webrtc
Interface VideoFrame.Buffer
-
- All Superinterfaces:
RefCounted
- All Known Subinterfaces:
VideoFrame.I420Buffer
,VideoFrame.TextureBuffer
- All Known Implementing Classes:
JavaI420Buffer
,NV12Buffer
,NV21Buffer
,Rgba8888Buffer
,TextureBufferImpl
- Enclosing class:
- VideoFrame
public static interface VideoFrame.Buffer extends RefCounted
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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description 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`.default int
getBufferType()
Representation of the underlying buffer.int
getHeight()
int
getWidth()
Resolution of the buffer in pixels.void
release()
Decreases ref count by one.void
retain()
Increases ref count by one.VideoFrame.I420Buffer
toI420()
Returns a memory-backed frame in I420 format.
-
-
-
Method Detail
-
getBufferType
default int getBufferType()
Representation of the underlying buffer. Currently, only NATIVE and I420 are supported.
-
getWidth
int getWidth()
Resolution of the buffer in pixels.
-
getHeight
int getHeight()
-
toI420
@Nullable VideoFrame.I420Buffer 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.Conversion may fail, for example if reading the pixel data from a texture fails. If the conversion fails, null is returned.
-
retain
void retain()
Description copied from interface:RefCounted
Increases ref count by one.- Specified by:
retain
in interfaceRefCounted
-
release
void release()
Description copied from interface:RefCounted
Decreases ref count by one. When the ref count reaches zero, resources related to the object will be freed.- Specified by:
release
in interfaceRefCounted
-
cropAndScale
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`.
-
-