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 TypeMethodDescriptionvoid
close()
Closes the plug-in component and releases the resources it was using.void
enableCallbacks
(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.void
open()
Opens the plug-in software or hardware component and acquires the resources that the plug-in needs to operate.int
process
(javax.media.Buffer buffer) Processes the data and renders it to the output device represented by this Renderer.void
reset()
Resets the state of the plug-in.void
Sets the region in the component where the video is to be rendered to.boolean
setComponent
(Component comp) javax.media.Format
setInputFormat
(javax.media.Format format) Sets the Format of the input data.void
start()
Called when the video stream is about to begin.void
stop()
Called when the video stream is stopping.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.media.Controls
getControl, getControls
Methods 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:
getName
in interfacejavax.media.PlugIn
- Returns:
- - A String that contains the descriptive name of the plug-in.
-
getComponent
- Specified by:
getComponent
in interfacejavax.media.renderer.VideoRenderer
-
setComponent
- Specified by:
setComponent
in 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:
setBounds
in 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:
getBounds
in interfacejavax.media.renderer.VideoRenderer
- Returns:
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format) Sets the Format of the input data.- Specified by:
setInputFormat
in 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:
getSupportedInputFormats
in 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:
process
in 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:
stop
in interfacejavax.media.Renderer
-
start
public void start()Called when the video stream is about to begin.- Specified by:
start
in 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:
getControls
in 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:
getControl
in 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:
open
in 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:
close
in 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:
reset
in interfacejavax.media.PlugIn
-