Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.portaudio
Class PortAudioStream

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.control.AbstractControls
      extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
          extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream
              extended by net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.portaudio.PortAudioStream
All Implemented Interfaces:
javax.media.Controls, javax.media.protocol.PullBufferStream, javax.media.protocol.SourceStream

public class PortAudioStream
extends AbstractPullBufferStream

Implements PullBufferStream for PortAudio.

Author:
Damian Minkov, Lyubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
dataSource, formatControl
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
PortAudioStream(DataSource dataSource, javax.media.control.FormatControl formatControl, boolean audioQualityImprovement)
          Initializes a new PortAudioStream instance which is to have its Format-related information abstracted by a specific FormatControl.
 
Method Summary
protected  javax.media.Format doGetFormat()
          Gets the Format of this PullBufferStream as directly known by it.
 void read(javax.media.Buffer buffer)
          Reads media data from this PullBufferStream into a specific Buffer with blocking.
(package private)  void setDeviceIndex(int deviceIndex)
          Sets the device index of the PortAudio device to be read through this PullBufferStream.
 void start()
          Starts the transfer of media data from this PullBufferStream.
 void stop()
          Stops the transfer of media data from this PullBufferStream.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractPullBufferStream
willReadBlock
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.AbstractBufferStream
close, doSetFormat, endOfStream, getContentDescriptor, getContentLength, getControls, getFormat
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.control.AbstractControls
getControl, getControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.protocol.PullBufferStream
getFormat
 
Methods inherited from interface javax.media.protocol.SourceStream
endOfStream, getContentDescriptor, getContentLength
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

PortAudioStream

public PortAudioStream(DataSource dataSource,
                       javax.media.control.FormatControl formatControl,
                       boolean audioQualityImprovement)
Initializes a new PortAudioStream instance which is to have its Format-related information abstracted by a specific FormatControl.

Parameters:
dataSource - the DataSource which is creating the new instance so that it becomes one of its streams
formatControl - the FormatControl which is to abstract the Format-related information of the new instance
audioQualityImprovement - true to enable audio quality improvement for the new instance in accord with the preferences of the user or false to completely disable audio quality improvement
Method Detail

doGetFormat

protected javax.media.Format doGetFormat()
Gets the Format of this PullBufferStream as directly known by it.

Overrides:
doGetFormat in class AbstractBufferStream
Returns:
the Format of this PullBufferStream as directly known by it or null if this PullBufferStream does not directly know its Format and it relies on the PullBufferDataSource which created it to report its Format
See Also:
AbstractBufferStream.doGetFormat()

read

public void read(javax.media.Buffer buffer)
          throws IOException
Reads media data from this PullBufferStream into a specific Buffer with blocking.

Parameters:
buffer - the Buffer in which media data is to be read from this PullBufferStream
Throws:
IOException - if anything goes wrong while reading media data from this PullBufferStream into the specified buffer

setDeviceIndex

void setDeviceIndex(int deviceIndex)
              throws IOException
Sets the device index of the PortAudio device to be read through this PullBufferStream.

Parameters:
deviceIndex - the device index of the PortAudio device to be read through this PullBufferStream
Throws:
IOException - if input/output error occurred

start

public void start()
           throws IOException
Starts the transfer of media data from this PullBufferStream.

Overrides:
start in class AbstractBufferStream
Throws:
IOException - if anything goes wrong while starting the transfer of media data from this PullBufferStream

stop

public void stop()
          throws IOException
Stops the transfer of media data from this PullBufferStream.

Overrides:
stop in class AbstractBufferStream
Throws:
IOException - if anything goes wrong while stopping the transfer of media data from this PullBufferStream

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.