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 interfaceVideoFrame.BufferImplements image storage medium.static interfaceVideoFrame.I420BufferInterface for I420 buffers.static interfaceVideoFrame.TextureBufferInterface 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.BuffergetBuffer()intgetRotatedHeight()intgetRotatedWidth()intgetRotation()Rotation of the frame in degrees.longgetTimestampNs()Timestamp of the frame in nano seconds.voidrelease()Decreases ref count by one.voidretain()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:RefCountedIncreases ref count by one.- Specified by:
retainin interfaceRefCounted
-
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
-
-