Class JAWTRenderer
- java.lang.Object
-
- org.jitsi.impl.neomedia.control.AbstractControls
-
- org.jitsi.impl.neomedia.control.ControlsAdapter
-
- org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer<javax.media.format.VideoFormat>
-
- org.jitsi.impl.neomedia.jmfext.media.renderer.video.JAWTRenderer
-
- All Implemented Interfaces:
javax.media.Controls,javax.media.PlugIn,javax.media.Renderer,javax.media.renderer.VideoRenderer
public class JAWTRenderer extends AbstractRenderer<javax.media.format.VideoFormat> implements javax.media.renderer.VideoRenderer
Implements a VideoRenderer which uses JAWT to perform native painting in an AWT or Swing Component.- Author:
- Lyubomir Marinov
-
-
Field Summary
-
Fields inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer
inputFormat
-
Fields inherited from class org.jitsi.impl.neomedia.control.ControlsAdapter
EMPTY_CONTROLS
-
-
Constructor Summary
Constructors Constructor Description JAWTRenderer()Initializes a new JAWTRenderer instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this PlugIn and releases the resources it has retained during its execution.RectanglegetBounds()Gets the region in the component of this VideoRenderer where the video is rendered.ComponentgetComponent()Gets the AWT Component into which this VideoRenderer draws.longgetHandle()Gets the handle to the native counterpart of this JAWTRenderer.ObjectgetHandleLock()Gets the Object which synchronizes the access to the handle to the native counterpart of this JAWTRenderer.StringgetName()Gets the human-readable name of this PlugIn.javax.media.Format[]getSupportedInputFormats()Gets the list of input Formats supported by this Renderer.voidopen()Opens this PlugIn and acquires the resources that it needs to operate.intprocess(javax.media.Buffer buffer)Processes the data provided in a specific Buffer and renders it to the output device represented by this Renderer.voidsetBounds(Rectangle bounds)Sets the region in the component of this VideoRenderer where the video is to be rendered.booleansetComponent(Component component)Sets the AWT Component into which this VideoRenderer is to draw.javax.media.FormatsetInputFormat(javax.media.Format format)Sets the Format of the input to be processed by this Renderer.voidstart()Starts the rendering process.voidstop()Stops the rendering process.-
Methods inherited from class org.jitsi.impl.neomedia.jmfext.media.renderer.AbstractRenderer
reset, useThreadPriority
-
Methods inherited from class org.jitsi.impl.neomedia.control.ControlsAdapter
getControls
-
Methods inherited from class org.jitsi.impl.neomedia.control.AbstractControls
getControl, getControl, queryInterface, queryInterface
-
-
-
-
Method Detail
-
close
public void close()
Closes this PlugIn and releases the resources it has retained during its execution. No more data will be accepted by this PlugIn afterwards. A closed PlugIn can be reinstated by calling open again.- Specified by:
closein interfacejavax.media.PlugIn
-
getBounds
public Rectangle getBounds()
Gets the region in the component of this VideoRenderer where the video is rendered. JAWTRenderer always uses the entire component i.e. always returns null.- Specified by:
getBoundsin interfacejavax.media.renderer.VideoRenderer- Returns:
- the region in the component of this VideoRenderer where the video is rendered; null if the entire component is used
-
getComponent
public Component getComponent()
Gets the AWT Component into which this VideoRenderer draws.- Specified by:
getComponentin interfacejavax.media.renderer.VideoRenderer- Returns:
- the AWT Component into which this VideoRenderer draws
-
getHandle
public long getHandle()
Gets the handle to the native counterpart of this JAWTRenderer.- Returns:
- the handle to the native counterpart of this JAWTRenderer
-
getHandleLock
public Object getHandleLock()
Gets the Object which synchronizes the access to the handle to the native counterpart of this JAWTRenderer.- Returns:
- the Object which synchronizes the access to the handle to the native counterpart of this JAWTRenderer
-
getName
public String getName()
Gets the human-readable name of this PlugIn.- Specified by:
getNamein interfacejavax.media.PlugIn- Returns:
- the human-readable name of this PlugIn
-
getSupportedInputFormats
public javax.media.Format[] getSupportedInputFormats()
Gets the list of input Formats supported by this Renderer.- Specified by:
getSupportedInputFormatsin interfacejavax.media.Renderer- Returns:
- an array of Format elements which represent the input Formats supported by this Renderer
-
open
public void open() throws javax.media.ResourceUnavailableExceptionOpens this PlugIn and acquires the resources that it needs to operate. The input format of this Renderer has to be set before open is called. Buffers should not be passed into this PlugIn without first calling open.- Specified by:
openin interfacejavax.media.PlugIn- Throws:
javax.media.ResourceUnavailableException- if there is a problem during opening
-
process
public int process(javax.media.Buffer buffer)
Processes the data provided in a specific Buffer and renders it to the output device represented by this Renderer.- Specified by:
processin interfacejavax.media.Renderer- Parameters:
buffer- a Buffer containing the data to be processed and rendered- Returns:
- BUFFER_PROCESSED_OK if the processing is successful; otherwise, the other possible return codes defined in the PlugIn interface
-
setBounds
public void setBounds(Rectangle bounds)
Sets the region in the component of this VideoRenderer where the video is to be rendered. JAWTRenderer always uses the entire component and, consequently, the method does nothing.- Specified by:
setBoundsin interfacejavax.media.renderer.VideoRenderer- Parameters:
bounds- the region in the component of this VideoRenderer where the video is to be rendered; null if the entire component is to be used
-
setComponent
public boolean setComponent(Component component)
Sets the AWT Component into which this VideoRenderer is to draw. JAWTRenderer cannot draw into any other AWT Component but its own so it always returns false.- Specified by:
setComponentin interfacejavax.media.renderer.VideoRenderer- Parameters:
component- the AWT Component into which this VideoRenderer is to draw- Returns:
- true if this VideoRenderer accepted the specified component as the AWT Component into which it is to draw; false, otherwise
-
setInputFormat
public javax.media.Format setInputFormat(javax.media.Format format)
Sets the Format of the input to be processed by this Renderer.- Specified by:
setInputFormatin interfacejavax.media.Renderer- Overrides:
setInputFormatin classAbstractRenderer<javax.media.format.VideoFormat>- Parameters:
format- the Format to be set as the Format of the input to be processed by this Renderer- Returns:
- the Format of the input to be processed by this Renderer if the specified format is supported or null if the specified format is not supported by this Renderer. Typically, it is the supported input Format which most closely matches the specified Format.
-
start
public void start()
Starts the rendering process. Begins rendering any data available in the internal buffers of this Renderer.- Specified by:
startin interfacejavax.media.Renderer
-
stop
public void stop()
Stops the rendering process.- Specified by:
stopin interfacejavax.media.Renderer
-
-