org.mobicents.media.server.impl
Class AbstractSource

java.lang.Object
  extended by org.mobicents.media.server.impl.BaseComponent
      extended by org.mobicents.media.server.impl.AbstractSource
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable, org.mobicents.media.Component, org.mobicents.media.MediaSource
Direct Known Subclasses:
AbstractSourceSet, AdvancedAudioPlayerImpl, AudioPlayerImpl, EchoSource, InbandGeneratorImpl, MeanderGenerator, MixerOutput, MultiFreqToneGeneratorImpl, PhoneSignalGenerator, ReceiveStream, Rfc2833GeneratorImpl, SineGenerator, TTSEngineImpl

public abstract class AbstractSource
extends BaseComponent
implements org.mobicents.media.MediaSource, java.lang.Runnable

The base implementation of the Media source. AbstractSource and AbstractSink are implement general wirring contruct. All media components have to extend one of these classes.

Author:
Oleg Kulikov
See Also:
Serialized Form

Field Summary
protected  org.mobicents.media.MediaSink otherParty
           
 
Constructor Summary
AbstractSource(java.lang.String name)
          Creates new instance of source with specified name.
 
Method Summary
 void afterStop()
          This method is called immediately after processing termination.
protected  void beforeStart()
          This method is called just before start.
protected  void completed()
          Sends notification that signal is completed.
 void connect(org.mobicents.media.Inlet inlet)
           
 void connect(org.mobicents.media.MediaSink otherParty)
          (Non Java-doc).
 void disconnect(org.mobicents.media.Inlet inlet)
           
 void disconnect(org.mobicents.media.MediaSink otherParty)
          (Non Java-doc).
abstract  void evolve(org.mobicents.media.Buffer buffer, long sequenceNumber)
          This method must be overriden by concrete media source.
protected  void failed(int eventID, java.lang.Exception e)
          Sends failure notification.
 long getBytesTransmitted()
          (Non Java-doc).
 long getPacketsTransmitted()
          (Non Java-doc).
protected  java.lang.String getSupportedFormatList()
           
 org.mobicents.media.server.spi.Timer getSyncSource()
          (Non Java-doc).
 boolean isConnected()
          (Non Java-doc).
 boolean isMultipleConnectionsAllowed()
           
 boolean isStarted()
          (Non Java-doc).
 void resetStats()
           
 void run()
           
 void setSyncSource(org.mobicents.media.server.spi.Timer timer)
          (Non Java-doc).
 void start()
          (Non Java-doc).
protected  void started()
          Sends notification that media processing has been started.
 void stop()
          (Non Java-doc).
protected  void stopped()
          Sends notification that detection is terminated.
 
Methods inherited from class org.mobicents.media.server.impl.BaseComponent
addListener, getConnection, getEndpoint, getId, getName, getResourceType, removeListener, sendEvent, setConnection, setEndpoint, setResourceType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mobicents.media.MediaSource
getFormats
 
Methods inherited from interface org.mobicents.media.Component
addListener, getConnection, getEndpoint, getId, getName, removeListener, setConnection, setEndpoint
 

Field Detail

otherParty

protected transient org.mobicents.media.MediaSink otherParty
Constructor Detail

AbstractSource

public AbstractSource(java.lang.String name)
Creates new instance of source with specified name.

Parameters:
name - the name of the sink to be created.
Method Detail

getSyncSource

public org.mobicents.media.server.spi.Timer getSyncSource()
(Non Java-doc).

Specified by:
getSyncSource in interface org.mobicents.media.MediaSource
See Also:
MediaSource.getSyncSource()

setSyncSource

public void setSyncSource(org.mobicents.media.server.spi.Timer timer)
(Non Java-doc).

Specified by:
setSyncSource in interface org.mobicents.media.MediaSource
See Also:
MediaSource.setSyncSource(Timer)

beforeStart

protected void beforeStart()
                    throws java.lang.Exception
This method is called just before start. The descendant classes can verride this method and put additional logic

Throws:
java.lang.Exception

start

public void start()
(Non Java-doc).

Specified by:
start in interface org.mobicents.media.Component
See Also:
Component.start().

stop

public void stop()
(Non Java-doc).

Specified by:
stop in interface org.mobicents.media.Component
See Also:
Component.stop().

afterStop

public void afterStop()
This method is called immediately after processing termination.


isMultipleConnectionsAllowed

public boolean isMultipleConnectionsAllowed()
Specified by:
isMultipleConnectionsAllowed in interface org.mobicents.media.MediaSource

connect

public void connect(org.mobicents.media.MediaSink otherParty)
(Non Java-doc).

Specified by:
connect in interface org.mobicents.media.MediaSource
See Also:
MediaSource.connect(MediaSink).

disconnect

public void disconnect(org.mobicents.media.MediaSink otherParty)
(Non Java-doc).

Specified by:
disconnect in interface org.mobicents.media.MediaSource
See Also:
org.mobicents.media.MediaSource#diconnection(MediaSink).

connect

public void connect(org.mobicents.media.Inlet inlet)
Specified by:
connect in interface org.mobicents.media.MediaSource

disconnect

public void disconnect(org.mobicents.media.Inlet inlet)
Specified by:
disconnect in interface org.mobicents.media.MediaSource

isConnected

public boolean isConnected()
(Non Java-doc).

Specified by:
isConnected in interface org.mobicents.media.MediaSource
See Also:
MediaSink.isConnected().

isStarted

public boolean isStarted()
(Non Java-doc).

Specified by:
isStarted in interface org.mobicents.media.MediaSource
See Also:
MediaSink.isStarted().

evolve

public abstract void evolve(org.mobicents.media.Buffer buffer,
                            long sequenceNumber)
This method must be overriden by concrete media source. The media have to fill buffer with media data and attributes.

Parameters:
buffer - the buffer object for media.
sequenceNumber - the number of timer ticks from the begining.

getSupportedFormatList

protected java.lang.String getSupportedFormatList()

run

public void run()
Specified by:
run in interface java.lang.Runnable

started

protected void started()
Sends notification that media processing has been started.


failed

protected void failed(int eventID,
                      java.lang.Exception e)
Sends failure notification.

Parameters:
eventID - failure event identifier.
e - the exception caused failure.

completed

protected void completed()
Sends notification that signal is completed.


stopped

protected void stopped()
Sends notification that detection is terminated.


getPacketsTransmitted

public long getPacketsTransmitted()
(Non Java-doc).

Specified by:
getPacketsTransmitted in interface org.mobicents.media.MediaSource
See Also:
org.mobicents.media.MediaSource#getPacketsReceived()

getBytesTransmitted

public long getBytesTransmitted()
(Non Java-doc).

Specified by:
getBytesTransmitted in interface org.mobicents.media.MediaSource
See Also:
MediaSource.getBytesTransmitted()

resetStats

public void resetStats()
Specified by:
resetStats in interface org.mobicents.media.Component
Overrides:
resetStats in class BaseComponent


Copyright © 2009. All Rights Reserved.