Class DataSource

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

    public class DataSource
    extends AbstractPushBufferCaptureDevice
    Implements CaptureDevice and DataSource using Windows Audio Session API (WASAPI) and related Core Audio APIs such as Multimedia Device (MMDevice) API.
    Author:
    Lyubomir Marinov
    • Constructor Detail

      • DataSource

        public DataSource()
        Initializes a new DataSource instance.
      • DataSource

        public DataSource​(javax.media.MediaLocator locator)
        Initializes a new DataSource instance with a specific MediaLocator.
        Parameters:
        locator - the MediaLocator to initialize the new instance with
    • Method Detail

      • createStream

        protected WASAPIStream 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
      • doConnect

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

        protected void doDisconnect()
        Closes the connection to the media source specified by the MediaLocator of this DataSource. 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.
        Overrides:
        doDisconnect 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. The Formats supported by this CaptureDevice/DataSource are either the ones supported by the capture endpoint device or the ones supported by the voice capture DMO that implements the acoustic echo cancellation (AEC) feature depending on whether the feature in question is disabled or enabled.
        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