SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media.protocol.portaudio
Class DSAudioStream

java.lang.Object
  extended by net.java.sip.communicator.impl.media.protocol.portaudio.DSAudioStream
All Implemented Interfaces:
javax.media.Controls, javax.media.protocol.PullBufferStream, javax.media.protocol.SourceStream

public class DSAudioStream
extends Object
implements javax.media.protocol.PullBufferStream

The stream used by jmf, wraps our InputPortAudioStream, which wraps the actual PortAudio stream.

Author:
Damian Minkov, Lubomir Marinov

Field Summary
 
Fields inherited from interface javax.media.protocol.SourceStream
LENGTH_UNKNOWN
 
Constructor Summary
DSAudioStream(javax.media.MediaLocator locator)
          Creates new stream.
 
Method Summary
 boolean endOfStream()
          The stream never ends.
 javax.media.protocol.ContentDescriptor getContentDescriptor()
          We are providing access to raw data
 long getContentLength()
          We are streaming.
 Object getControl(String controlType)
          Return required control from the Control[] array if exists
 Object[] getControls()
          Gives control information to the caller
 javax.media.Format getFormat()
          Returns the supported format by this stream.
 void read(javax.media.Buffer buffer)
          Block and read a buffer from the stream.
(package private)  void start()
          Starts the stream operation
(package private)  void stop()
          Stops the stream operation.
 boolean willReadBlock()
          Query if the next read will block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSAudioStream

public DSAudioStream(javax.media.MediaLocator locator)
Creates new stream.

Parameters:
locator - the locator to extract the device index from it.
Method Detail

start

void start()
     throws PortAudioException
Starts the stream operation

Throws:
PortAudioException - if fail to start.

stop

void stop()
    throws PortAudioException
Stops the stream operation.

Throws:
PortAudioException - if fail to stop.

willReadBlock

public boolean willReadBlock()
Query if the next read will block.

Specified by:
willReadBlock in interface javax.media.protocol.PullBufferStream
Returns:
true if a read will block.

read

public void read(javax.media.Buffer buffer)
          throws IOException
Block and read a buffer from the stream.

Specified by:
read in interface javax.media.protocol.PullBufferStream
Parameters:
buffer - the Buffer to read captured media into
Throws:
IOException - if an error occurs while reading.

getFormat

public javax.media.Format getFormat()
Returns the supported format by this stream.

Specified by:
getFormat in interface javax.media.protocol.PullBufferStream
Returns:
supported formats

getContentDescriptor

public javax.media.protocol.ContentDescriptor getContentDescriptor()
We are providing access to raw data

Specified by:
getContentDescriptor in interface javax.media.protocol.SourceStream
Returns:
RAW content descriptor.

getContentLength

public long getContentLength()
We are streaming.

Specified by:
getContentLength in interface javax.media.protocol.SourceStream
Returns:
unknown content length.

endOfStream

public boolean endOfStream()
The stream never ends.

Specified by:
endOfStream in interface javax.media.protocol.SourceStream
Returns:
true if the end of the stream has been reached.

getControls

public Object[] getControls()
Gives control information to the caller

Specified by:
getControls in interface javax.media.Controls
Returns:
no controls currently supported.

getControl

public Object getControl(String controlType)
Return required control from the Control[] array if exists

Specified by:
getControl in interface javax.media.Controls
Parameters:
controlType - the control class name.
Returns:
the object that implements the control, or null.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

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