Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.renderer.common.input.movie
Class VideoRenderer

java.lang.Object
  extended by org.web3d.vrml.renderer.common.input.movie.VideoRenderer
All Implemented Interfaces:
javax.media.Controls, javax.media.PlugIn, javax.media.Renderer, javax.media.renderer.VideoRenderer

public class VideoRenderer
extends java.lang.Object
implements 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
VideoRenderer(VideoStreamHandler videoStreamHandler)
          Create a new VideoRenderer.
 
Method Summary
 void close()
          Closes the plug-in component and releases the resources it was using.
 void enableCallbacks(boolean enabled)
          Enable or disable callbacks to the videoStreamHandler.
 java.awt.Rectangle getBounds()
          Returns the region in the component where the video will be rendered to.
 java.awt.Component getComponent()
          Returns the awt component.
 java.lang.Object getControl(java.lang.String controlType)
          Obtain the object that implements the specified Class or Interface The full class or interface name must be used.
 java.lang.Object[] getControls()
          Obtain the collection of objects that control the object that implements this interface.
 java.lang.String getName()
          Gets the name of this plug-in as a human-readable string.
 javax.media.Format[] getSupportedInputFormats()
          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 setBounds(java.awt.Rectangle rect)
          Sets the region in the component where the video is to be rendered to.
 boolean setComponent(java.awt.Component comp)
          Sets the awt component.
 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.PlugIn
close, open, reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

VideoRenderer

public VideoRenderer(VideoStreamHandler videoStreamHandler)
Create a new VideoRenderer.

Parameters:
videoStreamHandler - - will be called with each completed frame.
Method Detail

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 sideeffect of calling the start/stop methods in this class, and we do not want them propogated to the videoStreamhandler.

Parameters:
enabled - - Callbacks will be enabled if true, disabled if false.

getName

public java.lang.String getName()
Gets the name of this plug-in as a human-readable string.

Specified by:
getName in interface javax.media.PlugIn
Returns:
- A String that contains the descriptive name of the plug-in.

getComponent

public java.awt.Component getComponent()
Returns the awt component. Always returns null.

Specified by:
getComponent in interface javax.media.renderer.VideoRenderer

setComponent

public boolean setComponent(java.awt.Component comp)
Sets the awt component. Always returns false indicating that we cannot draw to that component.

Specified by:
setComponent in interface javax.media.renderer.VideoRenderer

setBounds

public void setBounds(java.awt.Rectangle rect)
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 interface javax.media.renderer.VideoRenderer
Parameters:
rect - - the rect that defines the region to be rendered to.

getBounds

public java.awt.Rectangle 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 interface javax.media.renderer.VideoRenderer

setInputFormat

public javax.media.Format setInputFormat(javax.media.Format format)
Sets the Format of the input data.

Specified by:
setInputFormat in interface javax.media.Renderer
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 interface javax.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 interface javax.media.Renderer
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 interface javax.media.Renderer

start

public void start()
Called when the video stream is about to begin.

Specified by:
start in interface javax.media.Renderer

getControls

public java.lang.Object[] 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 interface javax.media.Controls
Returns:
the collection of object controls

getControl

public java.lang.Object getControl(java.lang.String controlType)
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 interface javax.media.Controls
Returns:
the object that implements the control, or null

open

public void open()
          throws javax.media.ResourceUnavailableException
Opens 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 interface javax.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 interface javax.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 interface javax.media.PlugIn

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium