APIdia Launch Partner
Top Description Methods
com.sun.prism

public Interface MediaFrame

Imports
java.nio.ByteBuffer

This interface describes a video image as received by the media stack. It is generally just a wrapper/shim for VideoDataBuffer to avoid dependency issues.

Method Summary

Modifier and TypeMethod and Description
public MediaFrame

Returns:

valid MediaFrame in the specified format, or null if it cannot be converted
convertToFormat
(PixelFormat
The new video pixel format, if the same format is specified then the same frame will be returned. If a conversion is unsupported then this will return null. The converted frame must be released when you're done with it by calling releaseFrame or it will leak.
fmt
)

Converts the video frame to a different video format.

public ByteBuffer
getBufferForPlane(int
the numeric index of the plane, for chunky formats pass zero
plane
)

Returns: the ByteBuffer for the specified plane or null for non-existent planes

public int
getEncodedHeight()

Returns: height in pixels of the video image as produced by the video decoder

public int
getEncodedWidth()

Returns: width in pixels of the video image as produced by the video decoder

public int
getHeight()

Returns: height in pixels of the video image contained in this frame

public PixelFormat
getPixelFormat()

Returns: PixelFormat describing how pixels are stored in this frame's buffer

public int
getWidth()

Returns: width in pixels of the video image contained in this frame

public void
holdFrame()

This method will prevent the frame from being deallocated or recycled.

public int
planeCount()

Returns: the number of component planes, for packed formats this will always be one

public int[]

Returns:

int array containing the line stride for each plane
planeStrides
()

The plane line stride is the number of bytes between two consecutive lines in the buffer.

public void
releaseFrame()

When you're finished with a video frame, call this to allow the media subsystem to deallocate or recycle the frame immediately.

public int

Returns:

the line stride for the specified plane
strideForPlane
(int
which plane to get the stride for, valid range is zero to planeCount() non-inclusive
planeIndex
)

The plane line stride is the number of bytes between two consecutive lines in the buffer.

Method Detail

convertToFormatback to summary
public MediaFrame convertToFormat(PixelFormat fmt)

Converts the video frame to a different video format.

Parameters
fmt:PixelFormat

The new video pixel format, if the same format is specified then the same frame will be returned. If a conversion is unsupported then this will return null. The converted frame must be released when you're done with it by calling releaseFrame or it will leak.

Returns:MediaFrame

valid MediaFrame in the specified format, or null if it cannot be converted

getBufferForPlaneback to summary
public ByteBuffer getBufferForPlane(int plane)
Parameters
plane:int

the numeric index of the plane, for chunky formats pass zero

Returns:ByteBuffer

the ByteBuffer for the specified plane or null for non-existent planes

getEncodedHeightback to summary
public int getEncodedHeight()
Returns:int

height in pixels of the video image as produced by the video decoder

getEncodedWidthback to summary
public int getEncodedWidth()
Returns:int

width in pixels of the video image as produced by the video decoder

getHeightback to summary
public int getHeight()
Returns:int

height in pixels of the video image contained in this frame

getPixelFormatback to summary
public PixelFormat getPixelFormat()
Returns:PixelFormat

PixelFormat describing how pixels are stored in this frame's buffer

getWidthback to summary
public int getWidth()
Returns:int

width in pixels of the video image contained in this frame

holdFrameback to summary
public void holdFrame()

This method will prevent the frame from being deallocated or recycled. It is very important to balance the use of this method by calling releaseFrame when you're done with it otherwise the memory occupied by the frame will never be released which could lead to out of memory conditions.

planeCountback to summary
public int planeCount()
Returns:int

the number of component planes, for packed formats this will always be one

planeStridesback to summary
public int[] planeStrides()

The plane line stride is the number of bytes between two consecutive lines in the buffer. This number will vary depending on the frame's PixelFormat and decoder output.

Returns:int[]

int array containing the line stride for each plane

releaseFrameback to summary
public void releaseFrame()

When you're finished with a video frame, call this to allow the media subsystem to deallocate or recycle the frame immediately.

strideForPlaneback to summary
public int strideForPlane(int planeIndex)

The plane line stride is the number of bytes between two consecutive lines in the buffer. This number will vary depending on the frame's PixelFormat and decoder output.

Parameters
planeIndex:int

which plane to get the stride for, valid range is zero to planeCount() non-inclusive

Returns:int

the line stride for the specified plane