org.mobicents.media.server.impl
Class AbstractSink

java.lang.Object
  extended by org.mobicents.media.server.impl.BaseComponent
      extended by org.mobicents.media.server.impl.AbstractSink
All Implemented Interfaces:
Serializable, Component, MediaSink
Direct Known Subclasses:
SoundCard, SpectraAnalyzer

public abstract class AbstractSink
extends BaseComponent
implements MediaSink

The base implementation of the media sink. AbstractSource and AbstractSink are implement general wiring construct. All media components have to extend one of these classes.

Author:
Oleg Kulikov
See Also:
Serialized Form

Constructor Summary
AbstractSink(String name, Scheduler scheduler)
          Creates new instance of sink with specified name.
 
Method Summary
 void connect(Pipe pipe)
          (Non Java-doc.)
 void disconnect(Pipe pipe)
          (Non Java-doc.)
protected  void failed(Exception e)
          Sends failure notification.
 long getBytesReceived()
          (Non Java-doc).
 Processor getDsp()
          Gets the digital signaling processor associated with this media source
 Formats getFormats()
          (Non Java-doc.)
<T> T
getInterface(Class<T> interfaceType)
           
abstract  Formats getNativeFormats()
          Gets the list of formats supported by this component without possible transcoding.
 long getPacketsReceived()
          (Non Java-doc).
 boolean isConnected()
          (Non Java-doc).
 boolean isStarted()
          (Non Java-doc).
abstract  void onMediaTransfer(Frame frame)
          This methos is called when new portion of media arrives.
protected  void rebuildFormats()
          Rebuilds list of supported formats
 String report()
           
 void reset()
          (Non Java-doc.)
 void setDsp(Processor dsp)
          Assigns the digital signaling processor of this component.
 void setFormats(Formats formats)
          (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.
protected  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
 

Constructor Detail

AbstractSink

public AbstractSink(String name,
                    Scheduler scheduler)
Creates new instance of sink with specified name.

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

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 MediaSink
Parameters:
dsp - the dsp instance

rebuildFormats

protected void rebuildFormats()
Rebuilds list of supported formats


getDsp

public Processor getDsp()
Gets the digital signaling 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 MediaSink
Throws:
FormatNotSupportedException
See Also:
MediaSink.setFormats(org.mobicents.media.server.spi.format.Formats)

getFormats

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

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

connect

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

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

disconnect

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

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

isConnected

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

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

isStarted

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

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

onMediaTransfer

public abstract void onMediaTransfer(Frame frame)
                              throws IOException
This methos is called when new portion of media arrives.

Parameters:
buffer - the new portion of media data.
Throws:
IOException

getNativeFormats

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

Returns:
the list of format descriptors

start

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

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

wakeup

protected void wakeup()
Restores synchronization


stop

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

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

failed

protected void failed(Exception e)
Sends failure notification.

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

getPacketsReceived

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

Specified by:
getPacketsReceived in interface MediaSink
See Also:
MediaSink.getPacketsReceived().

getBytesReceived

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

Specified by:
getBytesReceived in interface MediaSink
See Also:
MediaSink.getBytesReceived()

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();

started

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


stopped

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


getInterface

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

report

public String report()


Copyright © 2011. All Rights Reserved.