Class 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 interface javax.media.PlugIn

        BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
    • Constructor Summary

      Constructors 
      Constructor Description
      JAWTRenderer()
      Initializes a new JAWTRenderer instance.
    • Constructor Detail

      • JAWTRenderer

        public JAWTRenderer()
        Initializes a new JAWTRenderer instance.
    • 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:
        close in interface javax.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:
        getBounds in interface javax.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:
        getComponent in interface javax.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:
        getName in interface javax.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:
        getSupportedInputFormats in interface javax.media.Renderer
        Returns:
        an array of Format elements which represent the input Formats supported by this Renderer
      • open

        public void open()
                  throws javax.media.ResourceUnavailableException
        Opens 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:
        open in interface javax.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:
        process in interface javax.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:
        setBounds in interface javax.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:
        setComponent in interface javax.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:
        setInputFormat in interface javax.media.Renderer
        Overrides:
        setInputFormat in class AbstractRenderer<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:
        start in interface javax.media.Renderer
      • stop

        public void stop()
        Stops the rendering process.
        Specified by:
        stop in interface javax.media.Renderer