final class NativeVideoBuffer extends java.lang.Object implements VideoDataBuffer
Modifier and Type | Class and Description |
---|---|
private static class |
NativeVideoBuffer.VideoBufferDisposer |
Modifier and Type | Field and Description |
---|---|
private NativeVideoBuffer |
cachedBGRARep |
private static boolean |
DEBUG_DISPOSED_BUFFERS |
private static NativeVideoBuffer.VideoBufferDisposer |
disposer |
private java.util.concurrent.atomic.AtomicInteger |
holdCount |
private long |
nativePeer |
PACKED_FORMAT_PLANE, YCBCR_PLANE_ALPHA, YCBCR_PLANE_CB, YCBCR_PLANE_CR, YCBCR_PLANE_LUMA
Modifier | Constructor and Description |
---|---|
private |
NativeVideoBuffer(long nativePeer) |
Modifier and Type | Method and Description |
---|---|
VideoDataBuffer |
convertToFormat(VideoFormat newFormat)
Converts the video image to the specified format.
|
static NativeVideoBuffer |
createVideoBuffer(long nativePeer) |
java.nio.ByteBuffer |
getBufferForPlane(int plane)
Retrieve the data buffer for the specified plane.
|
int |
getEncodedHeight()
Gets the height of the image as created by the decoder, this may be larger
than the display height.
|
int |
getEncodedWidth()
Gets the width of the image as created by the decoder, this may be larger
than the display width.
|
VideoFormat |
getFormat() |
int |
getHeight()
Gets the height of the VideoDataBuffer
|
int |
getPlaneCount() |
int[] |
getPlaneStrides() |
int |
getStrideForPlane(int planeIndex)
Returns the number of bytes in each row of pixels for the specified plane.
|
double |
getTimestamp()
Retrieve the timestamp of the buffer.
|
int |
getWidth()
Gets the width of the VideoDataBuffer
|
boolean |
hasAlpha()
Determine if a video buffer has an alpha channel.
|
void |
holdFrame()
Place a hold on a buffer so that it cannot be reused by the buffer pool
from whence it came.
|
private long |
nativeConvertToFormat(long handle,
int formatType) |
private static void |
nativeDisposeBuffer(long handle) |
private java.nio.ByteBuffer |
nativeGetBufferForPlane(long handle,
int plane) |
private int |
nativeGetEncodedHeight(long handle) |
private int |
nativeGetEncodedWidth(long handle) |
private int |
nativeGetFormat(long handle) |
private int |
nativeGetHeight(long handle) |
private int |
nativeGetPlaneCount(long handle) |
private int[] |
nativeGetPlaneStrides(long handle) |
private double |
nativeGetTimestamp(long handle) |
private int |
nativeGetWidth(long handle) |
private boolean |
nativeHasAlpha(long handle) |
private void |
nativeSetDirty(long handle) |
void |
releaseFrame()
Releases a hold previously placed on this frame.
|
void |
setDirty()
Flags a video buffer indicating the contents of the buffer have been
updated and any cached representations need to be updated.
|
java.lang.String |
toString() |
private long nativePeer
private final java.util.concurrent.atomic.AtomicInteger holdCount
private NativeVideoBuffer cachedBGRARep
private static final boolean DEBUG_DISPOSED_BUFFERS
private static final NativeVideoBuffer.VideoBufferDisposer disposer
private static void nativeDisposeBuffer(long handle)
private double nativeGetTimestamp(long handle)
private java.nio.ByteBuffer nativeGetBufferForPlane(long handle, int plane)
private int nativeGetWidth(long handle)
private int nativeGetHeight(long handle)
private int nativeGetEncodedWidth(long handle)
private int nativeGetEncodedHeight(long handle)
private int nativeGetFormat(long handle)
private boolean nativeHasAlpha(long handle)
private int nativeGetPlaneCount(long handle)
private int[] nativeGetPlaneStrides(long handle)
private long nativeConvertToFormat(long handle, int formatType)
private void nativeSetDirty(long handle)
public static NativeVideoBuffer createVideoBuffer(long nativePeer)
public void holdFrame()
VideoDataBuffer
holdFrame
in interface VideoDataBuffer
public void releaseFrame()
VideoDataBuffer
releaseFrame
in interface VideoDataBuffer
public double getTimestamp()
VideoDataBuffer
getTimestamp
in interface VideoDataBuffer
public java.nio.ByteBuffer getBufferForPlane(int plane)
VideoDataBuffer
PACKED_FORMAT_PLANE
as the plane index. If an invalid plane
index is passed this method returns null.getBufferForPlane
in interface VideoDataBuffer
plane
- The numeric index of the planeByteBuffer
containing video data for the specified
plane or null for non-existent or invalid planespublic int getWidth()
VideoDataBuffer
getWidth
in interface VideoDataBuffer
public int getHeight()
VideoDataBuffer
getHeight
in interface VideoDataBuffer
public int getEncodedWidth()
VideoDataBuffer
getEncodedWidth
in interface VideoDataBuffer
public int getEncodedHeight()
VideoDataBuffer
getEncodedHeight
in interface VideoDataBuffer
public VideoFormat getFormat()
getFormat
in interface VideoDataBuffer
public boolean hasAlpha()
VideoDataBuffer
hasAlpha
in interface VideoDataBuffer
public int getPlaneCount()
getPlaneCount
in interface VideoDataBuffer
public int getStrideForPlane(int planeIndex)
VideoDataBuffer
getStrideForPlane
in interface VideoDataBuffer
planeIndex
- The numeric index of the plane.public int[] getPlaneStrides()
getPlaneStrides
in interface VideoDataBuffer
getStrideForPlane
public VideoDataBuffer convertToFormat(VideoFormat newFormat)
VideoDataBuffer
ARGB_PRE
or BGRA_PRE
, converting to YCbCr is not
supported here. Once a conversion is done, a reference to the converted
buffer is retained so that future conversions do not need to be performed.convertToFormat
in interface VideoDataBuffer
newFormat
- the video format to convert topublic void setDirty()
VideoDataBuffer
setDirty
in interface VideoDataBuffer
public java.lang.String toString()
toString
in class java.lang.Object