APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.javafx.media

public Class PrismMediaFrameHandler

extends Object
implements ResourceFactoryListener
Class Inheritance
All Implemented Interfaces
com.sun.prism.ResourceFactoryListener
Imports
java.lang.ref.WeakReference, java.nio.ByteBuffer, java.util.Map, .WeakHashMap, com.sun.glass.ui.Screen, com.sun.javafx.tk.RenderJob, .Toolkit, com.sun.media.jfxmedia.control.VideoDataBuffer, .VideoFormat, com.sun.prism.Graphics, .GraphicsPipeline, .MediaFrame, .PixelFormat, .ResourceFactory, .ResourceFactoryListener, .Texture

Prism-specific subclass for handling media frames. The frames uploaded into per-Screen textures, updated on every frame.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
PrismMediaFrameHandler.PrismFrameBuffer

Bridge class to avoid having to import JFXMedia into a bunch of prism code.

private static class

Field Summary

Modifier and TypeField and Description
private static Map<Object, PrismMediaFrameHandler>
private WeakReference<ResourceFactory>
private final RenderJob
private final Map<Screen, PrismMediaFrameHandler.TextureMapEntry>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
factoryReleased()

Implements com.sun.prism.ResourceFactoryListener.factoryReleased.

Called when the factory is released.

public void
factoryReset()

Implements com.sun.prism.ResourceFactoryListener.factoryReset.

Called when the factory is lost and about to be reset.

public static synchronized PrismMediaFrameHandler
getHandler(Object provider)

public Texture

Returns:

the current media texture valid for rendering into g or null if called outside a render cycle
getTexture
(Graphics
the Graphics context about to be rendered into
g
,
VideoDataBuffer currentFrame)

This should only ever be called during a render cycle.

private void
public void
releaseTextures()

Call this when you no longer need to render movie frames, for example when playback stops.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlersback to summary
private static Map<Object, PrismMediaFrameHandler> handlers
registeredWithFactoryback to summary
private WeakReference<ResourceFactory> registeredWithFactory
releaseRenderJobback to summary
private final RenderJob releaseRenderJob
texturesback to summary
private final Map<Screen, PrismMediaFrameHandler.TextureMapEntry> textures

Constructor Detail

PrismMediaFrameHandlerback to summary
private PrismMediaFrameHandler(Object provider)

Method Detail

factoryReleasedback to summary
public void factoryReleased()

Implements com.sun.prism.ResourceFactoryListener.factoryReleased.

Doc from com.sun.prism.ResourceFactoryListener.factoryReleased.

Called when the factory is released. This may result in all resources becoming invalid. The listeners should let go of all resources created from this factory.

Annotations
@Override
factoryResetback to summary
public void factoryReset()

Implements com.sun.prism.ResourceFactoryListener.factoryReset.

Doc from com.sun.prism.ResourceFactoryListener.factoryReset.

Called when the factory is lost and about to be reset. This may result in some of the vram based resources becoming invalid. The listeners can chose which resources to let go of depending on whether they're based in vram.

Annotations
@Override
getHandlerback to summary
public static synchronized PrismMediaFrameHandler getHandler(Object provider)
getTextureback to summary
public Texture getTexture(Graphics g, VideoDataBuffer currentFrame)

This should only ever be called during a render cycle. Any other time it will return null. Note that a returned texture should be unlocked when the caller no longer needs it.

Parameters
g:Graphics

the Graphics context about to be rendered into

Returns:Texture

the current media texture valid for rendering into g or null if called outside a render cycle

releaseDataback to summary
private void releaseData()
releaseTexturesback to summary
public void releaseTextures()

Call this when you no longer need to render movie frames, for example when playback stops.

updateTextureback to summary
private void updateTexture(Graphics g, VideoDataBuffer vdb, PrismMediaFrameHandler.TextureMapEntry tme)
com.sun.javafx.media back to summary

private Class PrismMediaFrameHandler.PrismFrameBuffer

extends Object
implements MediaFrame
Class Inheritance
All Implemented Interfaces
com.sun.prism.MediaFrame

Bridge class to avoid having to import JFXMedia into a bunch of prism code.

Field Summary

Modifier and TypeField and Description
private final VideoDataBuffer
private final PixelFormat

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public MediaFrame
convertToFormat(PixelFormat fmt)

Implements com.sun.prism.MediaFrame.convertToFormat.

Converts the video frame to a different video format.

public ByteBuffer
public int
public int
public int
public PixelFormat
public int
public void
holdFrame()

Implements com.sun.prism.MediaFrame.holdFrame.

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

public int
public int[]
planeStrides()

Implements com.sun.prism.MediaFrame.planeStrides.

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

public void
releaseFrame()

Implements com.sun.prism.MediaFrame.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
strideForPlane(int planeIndex)

Implements com.sun.prism.MediaFrame.strideForPlane.

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

primaryback to summary
private final VideoDataBuffer primary
videoFormatback to summary
private final PixelFormat videoFormat

Constructor Detail

PrismFrameBufferback to summary
public PrismFrameBuffer(VideoDataBuffer sourceBuffer)

Method Detail

convertToFormatback to summary
public MediaFrame convertToFormat(PixelFormat fmt)

Implements com.sun.prism.MediaFrame.convertToFormat.

Doc from com.sun.prism.MediaFrame.convertToFormat.

Converts the video frame to a different video format.

Annotations
@Override
getBufferForPlaneback to summary
public ByteBuffer getBufferForPlane(int plane)

Implements com.sun.prism.MediaFrame.getBufferForPlane.

Annotations
@Override
getEncodedHeightback to summary
public int getEncodedHeight()

Implements com.sun.prism.MediaFrame.getEncodedHeight.

Annotations
@Override
getEncodedWidthback to summary
public int getEncodedWidth()

Implements com.sun.prism.MediaFrame.getEncodedWidth.

Annotations
@Override
getHeightback to summary
public int getHeight()

Implements com.sun.prism.MediaFrame.getHeight.

Annotations
@Override
getPixelFormatback to summary
public PixelFormat getPixelFormat()

Implements com.sun.prism.MediaFrame.getPixelFormat.

Annotations
@Override
getWidthback to summary
public int getWidth()

Implements com.sun.prism.MediaFrame.getWidth.

Annotations
@Override
holdFrameback to summary
public void holdFrame()

Implements com.sun.prism.MediaFrame.holdFrame.

Doc from com.sun.prism.MediaFrame.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.

Annotations
@Override
planeCountback to summary
public int planeCount()

Implements com.sun.prism.MediaFrame.planeCount.

Annotations
@Override
planeStridesback to summary
public int[] planeStrides()

Implements com.sun.prism.MediaFrame.planeStrides.

Doc from com.sun.prism.MediaFrame.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.

Annotations
@Override
releaseFrameback to summary
public void releaseFrame()

Implements com.sun.prism.MediaFrame.releaseFrame.

Doc from com.sun.prism.MediaFrame.releaseFrame.

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

Annotations
@Override
strideForPlaneback to summary
public int strideForPlane(int planeIndex)

Implements com.sun.prism.MediaFrame.strideForPlane.

Doc from com.sun.prism.MediaFrame.strideForPlane.

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.

Annotations
@Override
com.sun.javafx.media back to summary

private Class PrismMediaFrameHandler.TextureMapEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
public int
public double
public Texture

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encodedHeightback to summary
public int encodedHeight
encodedWidthback to summary
public int encodedWidth
lastFrameTimeback to summary
public double lastFrameTime
textureback to summary
public Texture texture

Constructor Detail

TextureMapEntryback to summary
private TextureMapEntry()