org.mobicents.media
Interface MediaSource

All Superinterfaces:
Component, java.io.Serializable, Task
All Known Subinterfaces:
DtmfGenerator

public interface MediaSource
extends Component, Task

Abstracts a read interface that pushes data in the form of Buffer objects. This interface allows a source stream to transfer data in the form of an entire media chunk to the user of this source stream.

Author:
Oleg Kulikov, baranowb

Method Summary
 void connect(Inlet inlet)
          Connects this source with specified inlet.
 void connect(MediaSink sink)
          Joins this source with media sink.
 void disconnect(Inlet inlet)
          Disconnects this source with specified inlet.
 void disconnect(MediaSink sink)
          Drops connection between this source and media sink.
 long getBytesTransmitted()
          Shows the number of bytes received by this sink since last start;
 long getDuration()
          Returns duration of the signal generated by this component if it is known.
 Format[] getFormats()
          Get possible formats in which this source can stream media.
 long getMediaTime()
          Gets the current media time position.
 long getPacketsTransmitted()
          Shows the number of packets received by this medis sink since last start.
 SyncSource getSyncSource()
          Gets the source used for synchronization of processing
 boolean isConnected()
          Gets the state of the component.
 boolean isMultipleConnectionsAllowed()
          Flags which indicates that multiple connections to this sink are allowed.
 boolean isStarted()
          Gets true if component is transmitting media.
 void setDuration(long duration)
          Sets maximum duration for the signal generated by media source
 void setMediaTime(long time)
          Assigns media time from which this component should start media data.
 void setSyncSource(SyncSource syncSource)
          Assign the source for synchronization of the processing.
 void start()
          Starts media processing.
 void stop()
          Terminates media processing.
 
Methods inherited from interface org.mobicents.media.Component
addListener, getConnection, getEndpoint, getFormat, getId, getInterface, getName, removeListener, resetStats, setConnection, setEndpoint
 
Methods inherited from interface org.mobicents.media.server.spi.clock.Task
cancel, isActive, perform
 

Method Detail

start

void start()
Starts media processing.


stop

void stop()
Terminates media processing.


getMediaTime

long getMediaTime()
Gets the current media time position.

Returns:
the current media time position in milliseconds.

setMediaTime

void setMediaTime(long time)
Assigns media time from which this component should start media data.

Parameters:
time - the value measured in millesconds.

getDuration

long getDuration()
Returns duration of the signal generated by this component if it is known.

Returns:
the duration of the signal in milliseconds or -1 if not known.

setDuration

void setDuration(long duration)
Sets maximum duration for the signal generated by media source

Parameters:
duration - the positive value in milliseconds.

getSyncSource

SyncSource getSyncSource()
Gets the source used for synchronization of processing

Returns:
timer instance.

setSyncSource

void setSyncSource(SyncSource syncSource)
Assign the source for synchronization of the processing.

Parameters:
syncSource - the source of synchronization.

connect

void connect(MediaSink sink)
Joins this source with media sink.

Parameters:
sink - the media sink to join with.

disconnect

void disconnect(MediaSink sink)
Drops connection between this source and media sink.

Parameters:
sink - the sink to disconnect.

isMultipleConnectionsAllowed

boolean isMultipleConnectionsAllowed()
Flags which indicates that multiple connections to this sink are allowed.

Returns:
true if multiple connections are allowed

connect

void connect(Inlet inlet)
Connects this source with specified inlet.

Parameters:
inlet - the inlet to connect with.

disconnect

void disconnect(Inlet inlet)
Disconnects this source with specified inlet.

Parameters:
inlet - the inlet to disconnect from.

getFormats

Format[] getFormats()
Get possible formats in which this source can stream media.

Returns:
an array of Format objects.

isConnected

boolean isConnected()
Gets the state of the component.

Returns:
true if component is connected to other component.

isStarted

boolean isStarted()
Gets true if component is transmitting media.

Returns:
true if component is transmitting media.

getPacketsTransmitted

long getPacketsTransmitted()
Shows the number of packets received by this medis sink since last start.

Returns:
the number of packets.

getBytesTransmitted

long getBytesTransmitted()
Shows the number of bytes received by this sink since last start;

Returns:
the number of bytes.


Copyright © 2010. All Rights Reserved.