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:
Serializable, Component, MediaSource
Direct Known Subclasses:
Sine

public abstract class AbstractSource
extends BaseComponent
implements MediaSource

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  long duration
           
protected  PipeImpl pipe
           
 
Constructor Summary
AbstractSource(String name, Scheduler scheduler)
          Creates new instance of source with specified name.
 
Method Summary
protected  void completed()
          Sends notification that signal is completed.
 void connect(Pipe pipe)
          (Non Java-doc).
 void disconnect(Pipe pipe)
          (Non Java-doc).
abstract  Frame evolve(long timestamp)
          This method must be overriden by concrete media source.
protected  void failed(Exception e)
          Sends failure notification.
 long getBytesTransmitted()
          (Non Java-doc).
 Processor getDsp()
          Gets the digital signalling processor associated with this media source
 long getDuration()
          (Non Java-doc).
 Formats getFormats()
          (Non Java-doc.)
<T> T
getInterface(Class<T> interfaceType)
           
 long getMediaTime()
          (Non Java-doc).
abstract  Formats getNativeFormats()
          Gets the list of formats supported by this component without possible transcoding.
 long getPacketsTransmitted()
          (Non Java-doc).
 boolean isConnected()
          (Non Java-doc).
 boolean isStarted()
          (Non Java-doc).
protected  void rebuildFormats()
          Rebuilds the list of supported formats.
 String report()
           
 void reset()
          (Non Java-doc.)
 void setDsp(Processor dsp)
          Assigns the digital signaling processor of this component.
 void setDuration(long duration)
          (Non Java-doc).
 void setFormats(Formats formats)
          (Non Java-doc.)
 void setInitialDelay(long initialDelay)
          (Non Java-doc.)
 void setMediaTime(long timestamp)
          (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()
          Called when source is stopped by request
 void wakeup()
          Restores synchronization
 
Methods inherited from class org.mobicents.media.server.impl.BaseComponent
getId, getName, inc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mobicents.media.Component
getId, getName
 

Field Detail

duration

protected long duration

pipe

protected PipeImpl pipe
Constructor Detail

AbstractSource

public AbstractSource(String name,
                      Scheduler scheduler)
Creates new instance of source with specified name.

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

setInitialDelay

public void setInitialDelay(long initialDelay)
(Non Java-doc.)

Specified by:
setInitialDelay in interface MediaSource
See Also:
setInitialDelay(long)

getMediaTime

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

Specified by:
getMediaTime in interface MediaSource
See Also:
MediaSource.getMediaTime();

setMediaTime

public void setMediaTime(long timestamp)
(Non Java-doc).

Specified by:
setMediaTime in interface MediaSource
See Also:
MediaSource.setMediaTime(long timestamp);

getDuration

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

Specified by:
getDuration in interface MediaSource
See Also:
org.mobicents.media.MediaSource#getDuration(long duration);

setDuration

public void setDuration(long duration)
(Non Java-doc).

Specified by:
setDuration in interface MediaSource
See Also:
MediaSource.setDuration(long duration);

setDsp

public void setDsp(Processor dsp)
Assigns the digital signaling processor of this component. The DSP allows to get more output formats.

Specified by:
setDsp in interface MediaSource
Parameters:
dsp - the dsp instance

rebuildFormats

protected void rebuildFormats()
Rebuilds the list of supported formats.


getDsp

public Processor getDsp()
Gets the digital signalling processor associated with this media source

Returns:
DSP instance.

setFormats

public void setFormats(Formats formats)
                throws FormatNotSupportedException
(Non Java-doc.)

Specified by:
setFormats in interface MediaSource
Throws:
FormatNotSupportedException
See Also:
MediaSource.setFormats(org.mobicents.media.server.spi.format.Formats)

getFormats

public Formats getFormats()
(Non Java-doc.)

Specified by:
getFormats in interface MediaSource
See Also:
MediaSource.getFormats()

start

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

Specified by:
start in interface MediaSource
See Also:
MediaSource.start().

wakeup

public void wakeup()
Restores synchronization


stop

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

Specified by:
stop in interface MediaSource
See Also:
MediaSource.stop().

connect

public void connect(Pipe pipe)
(Non Java-doc).

Specified by:
connect in interface MediaSource
See Also:
MediaSource.connect(org.mobicents.media.server.spi.io.Pipe)

disconnect

public void disconnect(Pipe pipe)
(Non Java-doc).

Specified by:
disconnect in interface MediaSource
See Also:
MediaSource.disconnect(org.mobicents.media.server.spi.io.Pipe)

isConnected

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

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

isStarted

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

Specified by:
isStarted in interface MediaSource
See Also:
MediaSource.isStarted().

evolve

public abstract Frame evolve(long timestamp)
This method must be overriden by concrete media source. T he 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.

getNativeFormats

public abstract Formats getNativeFormats()
Gets the list of formats supported by this component without possible transcoding.

Returns:
the list of format descriptors

started

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


failed

protected void failed(Exception e)
Sends failure notification.

Parameters:
e - the exception caused failure.

completed

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


stopped

protected void stopped()
Called when source is stopped by request


getPacketsTransmitted

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

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

getBytesTransmitted

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

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

reset

public void reset()
Description copied from class: BaseComponent
(Non Java-doc.)

Specified by:
reset in interface Component
Overrides:
reset in class BaseComponent
See Also:
org.mobicents.media.Component#reserStats();

report

public String report()

getInterface

public <T> T getInterface(Class<T> interfaceType)
Specified by:
getInterface in interface Component
Overrides:
getInterface in class BaseComponent


Copyright © 2011. All Rights Reserved.