Package tvi.webrtc
Class VideoFrame
- java.lang.Object
-
- tvi.webrtc.VideoFrame
-
- All Implemented Interfaces:
RefCounted
public class VideoFrame extends java.lang.Object implements RefCounted
Java version of webrtc::VideoFrame and webrtc::VideoFrameBuffer. A difference from the C++ version is that no explicit tag is used, and clients are expected to use 'instanceof' to find the right subclass of the buffer. This allows clients to create custom VideoFrame.Buffer in arbitrary format in their custom VideoSources, and then cast it back to the correct subclass in their custom VideoSinks. All implementations must also implement the toI420() function, converting from the underlying representation if necessary. I420 is the most widely accepted format and serves as a fallback for video sinks that can only handle I420, e.g. the internal WebRTC software encoders.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
VideoFrame.Buffer
Implements image storage medium.static interface
VideoFrame.I420Buffer
Interface for I420 buffers.static interface
VideoFrame.TextureBuffer
Interface for buffers that are stored as a single texture, either in OES or RGB format.
-
Constructor Summary
Constructors Constructor Description VideoFrame(VideoFrame.Buffer buffer, int rotation, long timestampNs)
Constructs a new VideoFrame backed by the givenbuffer
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VideoFrame.Buffer
getBuffer()
int
getRotatedHeight()
int
getRotatedWidth()
int
getRotation()
Rotation of the frame in degrees.long
getTimestampNs()
Timestamp of the frame in nano seconds.void
release()
Decreases ref count by one.void
retain()
Increases ref count by one.
-
-
-
Constructor Detail
-
VideoFrame
public VideoFrame(VideoFrame.Buffer buffer, int rotation, long timestampNs)
Constructs a new VideoFrame backed by the givenbuffer
. Note: Ownership of the buffer object is tranferred to the new VideoFrame.
-
-
Method Detail
-
getBuffer
public VideoFrame.Buffer getBuffer()
-
getRotation
public int getRotation()
Rotation of the frame in degrees.
-
getTimestampNs
public long getTimestampNs()
Timestamp of the frame in nano seconds.
-
getRotatedWidth
public int getRotatedWidth()
-
getRotatedHeight
public int getRotatedHeight()
-
retain
public void retain()
Description copied from interface:RefCounted
Increases ref count by one.- Specified by:
retain
in interfaceRefCounted
-
release
public 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
-
-