Class FakePushBufferDataSource

  • All Implemented Interfaces:
    javax.media.Controls, javax.media.Duration, javax.media.protocol.CaptureDevice, javax.media.protocol.Controls

    public class FakePushBufferDataSource
    extends AbstractPushBufferCaptureDevice
    Implements PushBufferDataSource for the purposes of RTPTranslator when it does not have a CaptureDevice yet RTPManager.createSendStream(DataSource, int) has to be called to have RTPTranslatorImpl send packets.
    Author:
    Lyubomir Marinov
    • Field Summary

      • Fields inherited from interface javax.media.Duration

        DURATION_UNBOUNDED, DURATION_UNKNOWN
    • Constructor Summary

      Constructors 
      Constructor Description
      FakePushBufferDataSource​(javax.media.Format... supportedFormats)
      Initializes a new FakePushBufferCaptureDevice instance which is to report a specific list of Formats as supported.
    • Constructor Detail

      • FakePushBufferDataSource

        public FakePushBufferDataSource​(javax.media.Format... supportedFormats)
        Initializes a new FakePushBufferCaptureDevice instance which is to report a specific list of Formats as supported.
        Parameters:
        supportedFormats - the list of Formats to be reported as supported by the new instance
    • Method Detail

      • connect

        public void connect()
                     throws IOException
        Opens a connection to the media source specified by the MediaLocator of this DataSource.
        Specified by:
        connect in interface javax.media.protocol.CaptureDevice
        Overrides:
        connect in class AbstractPushBufferCaptureDevice
        Throws:
        IOException - if anything goes wrong while opening the connection to the media source specified by the MediaLocator of this DataSource
      • createStream

        protected org.jitsi.impl.neomedia.protocol.FakePushBufferDataSource.FakePushBufferStream createStream​(int streamIndex,
                                                                                                              javax.media.control.FormatControl formatControl)
        Create a new PushBufferStream which is to be at a specific zero-based index in the list of streams of this PushBufferDataSource. The Format-related information of the new instance is to be abstracted by a specific FormatControl.
        Specified by:
        createStream in class AbstractPushBufferCaptureDevice
        Parameters:
        streamIndex - the zero-based index of the PushBufferStream in the list of streams of this PushBufferDataSource
        formatControl - the FormatControl which is to abstract the Format-related information of the new instance
        Returns:
        a new PushBufferStream which is to be at the specified streamIndex in the list of streams of this PushBufferDataSource 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
        Overrides:
        disconnect in class AbstractPushBufferCaptureDevice
      • getSupportedFormats

        protected javax.media.Format[] getSupportedFormats​(int streamIndex)
        Gets the Formats which are to be reported by a FormatControl as supported formats for a PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource.
        Overrides:
        getSupportedFormats in class AbstractPushBufferCaptureDevice
        Parameters:
        streamIndex - the zero-based index of the PushBufferStream 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 PushBufferStream at the specified streamIndex in the list of streams of this PushBufferDataSource
      • setFormat

        protected 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 PushBufferStream at a specific zero-based index in the list of streams of this PushBufferDataSource. The PushBufferStream 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 PushBufferStream. If setting the Format of an existing PushBufferStream is desired, AbstractPushBufferStream#doSetFormat(Format) should be overridden instead. Allows setting an arbitrary Format on this DataSource because it does not really provide any media.
        Overrides:
        setFormat in class AbstractPushBufferCaptureDevice
        Parameters:
        streamIndex - the zero-based index of the PushBufferStream the Format of which is to be set
        oldValue - the last-known Format for the PushBufferStream at the specified streamIndex
        newValue - the Format which is to be set
        Returns:
        the Format to be reported by the FormatControl of the PushBufferStream at the specified streamIndex in the list of streams of this PushBufferStream 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 DataSource.
        Specified by:
        start in interface javax.media.protocol.CaptureDevice
        Overrides:
        start in class AbstractPushBufferCaptureDevice
        Throws:
        IOException - if anything goes wrong while starting the transfer of media data from this DataSource
      • stop

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