Class AbstractBufferCaptureDevice<AbstractBufferStreamT extends org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractBufferStream<?>>

  • Type Parameters:
    AbstractBufferStreamT - the type of AbstractBufferStream through which this AbstractBufferCaptureDevice is to give access to its media data
    All Implemented Interfaces:
    javax.media.Controls, javax.media.protocol.CaptureDevice

    public abstract class AbstractBufferCaptureDevice<AbstractBufferStreamT extends org.jitsi.impl.neomedia.jmfext.media.protocol.AbstractBufferStream<?>>
    extends Object
    implements javax.media.protocol.CaptureDevice, javax.media.Controls
    Facilitates the implementations of the CaptureDevice and DataSource interfaces provided by AbstractPullBufferCaptureDevice and AbstractPushBufferCaptureDevice.
    Author:
    Lyubomir Marinov
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void connect()
      Opens a connection to the media source of this AbstractBufferCaptureDevice.
      protected javax.media.control.FormatControl createFormatControl​(int streamIndex)
      Creates a new FormatControl instance which is to be associated with a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource.
      protected javax.media.control.FormatControl[] createFormatControls()
      Creates the FormatControls of this CaptureDevice.
      protected javax.media.control.FrameRateControl createFrameRateControl()
      Creates a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractBufferCaptureDevice.
      protected net.sf.fmj.media.util.RTPInfo createRTPInfo()
      Creates a new RTPInfo instance of this AbstractBufferCaptureDevice.
      protected abstract AbstractBufferStreamT createStream​(int streamIndex, javax.media.control.FormatControl formatControl)
      Create a new AbstractBufferStream which is to be at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice.
      void disconnect()
      Closes the connection to the media source specified of this AbstractBufferCaptureDevice.
      protected abstract void doConnect()
      Opens a connection to the media source of this AbstractBufferCaptureDevice.
      protected abstract void doDisconnect()
      Closes the connection to the media source of this AbstractBufferCaptureDevice.
      protected abstract void doStart()
      Starts the transfer of media data from this AbstractBufferCaptureDevice.
      protected abstract void doStop()
      Stops the transfer of media data from this AbstractBufferCaptureDevice.
      abstract javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
      Gets the CaptureDeviceInfo of this CaptureDevice which describes it.
      static javax.media.CaptureDeviceInfo getCaptureDeviceInfo​(javax.media.protocol.DataSource captureDevice)
      Gets the CaptureDeviceInfo of a specific CaptureDevice by locating its registration in JMF using its MediaLocator.
      Object getControl​(String controlType)
      Gets the control of the specified type available for this instance.
      Object[] getControls()
      Implements Controls.getControls().
      protected abstract javax.media.Format getFormat​(int streamIndex, javax.media.Format oldValue)
      Gets the Format to be reported by the FormatControl of an AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice.
      javax.media.control.FormatControl[] getFormatControls()
      Gets an array of FormatControl instances each one of which can be used before connect() to get and set the capture Format of each one of the capture streams.
      <SourceStreamT extends javax.media.protocol.SourceStream>
      SourceStreamT[]
      getStreams​(Class<SourceStreamT> clz)
      Gets the AbstractBufferStreams through which this AbstractBufferCaptureDevice gives access to its media data.
      protected abstract javax.media.Format[] getSupportedFormats​(int streamIndex)
      Gets the Formats which are to be reported by a FormatControl as supported formats for a AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice.
      protected abstract javax.media.Format setFormat​(int streamIndex, javax.media.Format oldValue, javax.media.Format newValue)
      Attempts to set the Format to be reported by the FormatControl of a AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice.
      void start()
      Starts the transfer of media data from this AbstractBufferCaptureDevice.
      void stop()
      Stops the transfer of media data from this AbstractBufferCaptureDevice.
    • Constructor Detail

      • AbstractBufferCaptureDevice

        public AbstractBufferCaptureDevice()
    • Method Detail

      • connect

        public void connect()
                     throws IOException
        Opens a connection to the media source of this AbstractBufferCaptureDevice.
        Specified by:
        connect in interface javax.media.protocol.CaptureDevice
        Throws:
        IOException - if anything goes wrong while opening the connection to the media source of this AbstractBufferCaptureDevice
      • createFormatControl

        protected javax.media.control.FormatControl createFormatControl​(int streamIndex)
        Creates a new FormatControl instance which is to be associated with a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource. As the FormatControls of a PushBufferDataSource can be requested before connect(), its PushBufferStreams may not exist at the time of the request for the creation of the FormatControl.
        Parameters:
        streamIndex - the zero-based index of the PushBufferStream in the list of streams of this PushBufferDataSource which is to be associated with the new FormatControl instance
        Returns:
        a new FormatControl instance which is to be associated with a PushBufferStream at the specified streamIndex in the list of streams of this PushBufferDataSource
      • createFormatControls

        protected javax.media.control.FormatControl[] createFormatControls()
        Creates the FormatControls of this CaptureDevice.
        Returns:
        an array of the FormatControls of this CaptureDevice
      • createFrameRateControl

        protected javax.media.control.FrameRateControl createFrameRateControl()
        Creates a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractBufferCaptureDevice.
        Returns:
        a new FrameRateControl instance which is to allow the getting and setting of the frame rate of this AbstractBufferCaptureDevice
      • createRTPInfo

        protected net.sf.fmj.media.util.RTPInfo createRTPInfo()
        Creates a new RTPInfo instance of this AbstractBufferCaptureDevice.
        Returns:
        a new RTPInfo instance of this AbstractBufferCaptureDevice
      • createStream

        protected abstract AbstractBufferStreamT createStream​(int streamIndex,
                                                              javax.media.control.FormatControl formatControl)
        Create a new AbstractBufferStream which is to be at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice. The Format-related information of the new instance is to be abstracted by a specific FormatControl.
        Parameters:
        streamIndex - the zero-based index of the AbstractBufferStream in the list of streams of this AbstractBufferCaptureDevice
        formatControl - the FormatControl which is to abstract the Format-related information of the new instance
        Returns:
        a new AbstractBufferStream which is to be at the specified streamIndex in the list of streams of this AbstractBufferCaptureDevice and which has its Format-related information abstracted by the specified formatControl
      • disconnect

        public void disconnect()
        Closes the connection to the media source specified of this AbstractBufferCaptureDevice. If such a connection has not been opened, the call is ignored.
        Specified by:
        disconnect in interface javax.media.protocol.CaptureDevice
      • doConnect

        protected abstract void doConnect()
                                   throws IOException
        Opens a connection to the media source of this AbstractBufferCaptureDevice. Allows extenders to override and be sure that there will be no request to open a connection if the connection has already been opened.
        Throws:
        IOException - if anything goes wrong while opening the connection to the media source of this AbstractBufferCaptureDevice
      • doDisconnect

        protected abstract void doDisconnect()
        Closes the connection to the media source of this AbstractBufferCaptureDevice. Allows extenders to override and be sure that there will be no request to close a connection if the connection has not been opened yet.
      • doStart

        protected abstract void doStart()
                                 throws IOException
        Starts the transfer of media data from this AbstractBufferCaptureDevice. Allows extenders to override and be sure that there will be no request to start the transfer of media data if it has already been started.
        Throws:
        IOException - if anything goes wrong while starting the transfer of media data from this AbstractBufferCaptureDevice
      • doStop

        protected abstract void doStop()
                                throws IOException
        Stops the transfer of media data from this AbstractBufferCaptureDevice. Allows extenders to override and be sure that there will be no request to stop the transfer of media data if it has not been started yet.
        Throws:
        IOException - if anything goes wrong while stopping the transfer of media data from this AbstractBufferCaptureDevice
      • getCaptureDeviceInfo

        public abstract javax.media.CaptureDeviceInfo getCaptureDeviceInfo()
        Gets the CaptureDeviceInfo of this CaptureDevice which describes it.
        Specified by:
        getCaptureDeviceInfo in interface javax.media.protocol.CaptureDevice
        Returns:
        the CaptureDeviceInfo of this CaptureDevice which describes it
      • getCaptureDeviceInfo

        public static javax.media.CaptureDeviceInfo getCaptureDeviceInfo​(javax.media.protocol.DataSource captureDevice)
        Gets the CaptureDeviceInfo of a specific CaptureDevice by locating its registration in JMF using its MediaLocator.
        Parameters:
        captureDevice - the CaptureDevice to gets the CaptureDeviceInfo of
        Returns:
        the CaptureDeviceInfo of the specified CaptureDevice as registered in JMF
      • getControl

        public Object getControl​(String controlType)
        Gets the control of the specified type available for this instance.
        Specified by:
        getControl in interface javax.media.Controls
        Parameters:
        controlType - the type of the control available for this instance to be retrieved
        Returns:
        an Object which represents the control of the specified type available for this instance if such a control is indeed available; otherwise, null
      • getControls

        public Object[] getControls()
        Implements Controls.getControls(). Gets the controls available for this instance.
        Specified by:
        getControls in interface javax.media.Controls
        Returns:
        an array of Objects which represent the controls available for this instance
      • getFormat

        protected abstract javax.media.Format getFormat​(int streamIndex,
                                                        javax.media.Format oldValue)
        Gets the Format to be reported by the FormatControl of an AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice. The AbstractBufferStream may not exist at the time of requesting its Format. Allows extenders to override the default behavior which is to report any last-known format or the first Format from the list of supported formats as defined in the JMF registration of this CaptureDevice.
        Parameters:
        streamIndex - the zero-based index of the AbstractBufferStream the Format of which is to be retrieved
        oldValue - the last-known Format for the PushBufferStream at the specified streamIndex
        Returns:
        the Format to be reported by the FormatControl of the PushBufferStream at the specified streamIndex in the list of streams of this PushBufferDataSource.
      • getFormatControls

        public javax.media.control.FormatControl[] getFormatControls()
        Gets an array of FormatControl instances each one of which can be used before connect() to get and set the capture Format of each one of the capture streams.
        Specified by:
        getFormatControls in interface javax.media.protocol.CaptureDevice
        Returns:
        an array of FormatControl instances each one of which can be used before connect() to get and set the capture Format of each one of the capture streams
      • getStreams

        public <SourceStreamT extends javax.media.protocol.SourceStream> SourceStreamT[] getStreams​(Class<SourceStreamT> clz)
        Gets the AbstractBufferStreams through which this AbstractBufferCaptureDevice gives access to its media data.
        Type Parameters:
        SourceStreamT - the type of SourceStream which is to be the element type of the returned array
        Parameters:
        clz - the Class of SourceStream which is to be the element type of the returned array
        Returns:
        an array of the SourceStreams through which this AbstractBufferCaptureDevice gives access to its media data
      • getSupportedFormats

        protected abstract javax.media.Format[] getSupportedFormats​(int streamIndex)
        Gets the Formats which are to be reported by a FormatControl as supported formats for a AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice.
        Parameters:
        streamIndex - the zero-based index of the AbstractBufferStream for which the specified FormatControl is to report the list of supported Formats
        Returns:
        an array of Formats to be reported by a FormatControl as the supported formats for the AbstractBufferStream at the specified streamIndex in the list of streams of this AbstractBufferCaptureDevice
      • setFormat

        protected abstract javax.media.Format setFormat​(int streamIndex,
                                                        javax.media.Format oldValue,
                                                        javax.media.Format newValue)
        Attempts to set the Format to be reported by the FormatControl of a AbstractBufferStream at a specific zero-based index in the list of streams of this AbstractBufferCaptureDevice. The AbstractBufferStream does not exist at the time of the attempt to set its Format. Allows extenders to override the default behavior which is to not attempt to set the specified Format so that they can enable setting the Format prior to creating the AbstractBufferStream. If setting the Format of an existing AbstractBufferStream is desired, AbstractBufferStream#doSetFormat(Format) should be overridden instead.
        Parameters:
        streamIndex - the zero-based index of the AbstractBufferStream the Format of which is to be set
        oldValue - the last-known Format for the AbstractBufferStream at the specified streamIndex
        newValue - the Format which is to be set
        Returns:
        the Format to be reported by the FormatControl of the AbstractBufferStream at the specified streamIndex in the list of streams of this AbstractBufferStream or null if the attempt to set the Format did not success and any last-known Format is to be left in effect
      • start

        public void start()
                   throws IOException
        Starts the transfer of media data from this AbstractBufferCaptureDevice.
        Specified by:
        start in interface javax.media.protocol.CaptureDevice
        Throws:
        IOException - if anything goes wrong while starting the transfer of media data from this AbstractBufferCaptureDevice
      • stop

        public void stop()
                  throws IOException
        Stops the transfer of media data from this AbstractBufferCaptureDevice.
        Specified by:
        stop in interface javax.media.protocol.CaptureDevice
        Throws:
        IOException - if anything goes wrong while stopping the transfer of media data from this AbstractBufferCaptureDevice