Class VideoRenderer
java.lang.Object
org.web3d.vrml.renderer.common.input.movie.VideoRenderer
- All Implemented Interfaces:
javax.media.Controls,javax.media.PlugIn,javax.media.Renderer,javax.media.renderer.VideoRenderer
Implementation of the javax.media.renderer.VideoRenderer interface for use
within the MovieTexture node. Captures the video frames and formats them as
BufferedImages and delivers them to the VideoStreamHandler.
- Version:
- $Revision: 1.9 $
- Author:
- Guy Carpenter
-
Field Summary
Fields inherited from interface javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED -
Constructor Summary
ConstructorsConstructorDescriptionVideoRenderer(VideoStreamHandler videoStreamHandler) Create a new VideoRenderer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the plug-in component and releases the resources it was using.voidenableCallbacks(boolean enabled) Enable or disable callbacks to the videoStreamHandler.Returns the region in the component where the video will be rendered to.getControl(String controlType) Obtain the object that implements the specified Class or Interface The full class or interface name must be used.Object[]Obtain the collection of objects that control the object that implements this interface.getName()Gets the name of this plug-in as a human-readable string.javax.media.Format[]Lists the input formats supported by this Renderer.voidopen()Opens the plug-in software or hardware component and acquires the resources that the plug-in needs to operate.intprocess(javax.media.Buffer buffer) Processes the data and renders it to the output device represented by this Renderer.voidreset()Resets the state of the plug-in.voidSets the region in the component where the video is to be rendered to.booleansetComponent(Component comp) javax.media.FormatsetInputFormat(javax.media.Format format) Sets the Format of the input data.voidstart()Called when the video stream is about to begin.voidstop()Called when the video stream is stopping.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.media.Controls
getControl, getControlsMethods inherited from interface javax.media.PlugIn
close, open, reset
-
Constructor Details
-
VideoRenderer
Create a new VideoRenderer.- Parameters:
videoStreamHandler- - will be called with each completed frame.
-
-
Method Details
-
enableCallbacks
public void enableCallbacks(boolean enabled) Enable or disable callbacks to the videoStreamHandler. We allow callbacks to be disabled because certain transport operations (rewind) have the side effect of calling the start/stop methods in this class, and we do not want them propagated to the videoStreamhandler.- Parameters:
enabled- - Callbacks will be enabled if true, disabled if false.
-
getName
Gets the name of this plug-in as a human-readable string.- Specified by:
getNamein interfacejavax.media.PlugIn- Returns:
- - A String that contains the descriptive name of the plug-in.
-
getComponent
- Specified by:
getComponentin interfacejavax.media.renderer.VideoRenderer
-
setComponent
- Specified by:
setComponentin interfacejavax.media.renderer.VideoRenderer
-
setBounds
Sets the region in the component where the video is to be rendered to. Video is to be scaled if necessary. If rect is null, then the video occupies the entire component. This call is ignored in this implementation.- Specified by:
setBoundsin interfacejavax.media.renderer.VideoRenderer- Parameters:
rect- - the rect that defines the region to be rendered to.
-
getBounds
Returns the region in the component where the video will be rendered to. Returns null if the entire component is being used. (Always returns null.)- Specified by:
getBoundsin interfacejavax.media.renderer.VideoRenderer- Returns:
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format) Sets the Format of the input data.- Specified by:
setInputFormatin interfacejavax.media.Renderer- Parameters:
format-- Returns:
- The Format that was set. This is typically the supported Format that most closely matches the specified Format. If possible, the format fields that were not specified are set to the preferred values in the returned Format. Returns null if the specified Format is not supported.
-
getSupportedInputFormats
public javax.media.Format[] getSupportedInputFormats()Lists the input formats supported by this Renderer.- Specified by:
getSupportedInputFormatsin interfacejavax.media.Renderer- Returns:
- An array of Format objects that represent the input formats supported by this Renderer.
-
process
public int process(javax.media.Buffer buffer) Processes the data and renders it to the output device represented by this Renderer.- Specified by:
processin interfacejavax.media.Renderer- Parameters:
buffer-- Returns:
- BUFFER_PROCESSED_OK if the processing is successful. Other possible return codes are defined in PlugIn.
-
stop
public void stop()Called when the video stream is stopping.- Specified by:
stopin interfacejavax.media.Renderer
-
start
public void start()Called when the video stream is about to begin.- Specified by:
startin interfacejavax.media.Renderer
-
getControls
Obtain the collection of objects that control the object that implements this interface. If no controls are supported, a zero length array is returned.- Specified by:
getControlsin interfacejavax.media.Controls- Returns:
- the collection of object controls
-
getControl
Obtain the object that implements the specified Class or Interface The full class or interface name must be used. If the control is not supported then null is returned.- Specified by:
getControlin interfacejavax.media.Controls- Returns:
- the object that implements the control, or null
-
open
public void open() throws javax.media.ResourceUnavailableExceptionOpens the plug-in software or hardware component and acquires the resources that the plug-in needs to operate. All required input and/or output formats have to be set on the plug-in before open is called. Buffers should not be passed into the plug-in without first calling this method.- Specified by:
openin interfacejavax.media.PlugIn- Throws:
javax.media.ResourceUnavailableException- - If all of the required resources cannot be acquired.
-
close
public void close()Closes the plug-in component and releases the resources it was using. No more data will be accepted by the plug-in after close is called. A closed plug-in can be reinstated by calling open again.- Specified by:
closein interfacejavax.media.PlugIn
-
reset
public void reset()Resets the state of the plug-in. The reset method is typically called if the end of media is reached or the media is repositioned.- Specified by:
resetin interfacejavax.media.PlugIn
-