org.mobicents.media
Interface MediaSource

All Superinterfaces:
Component, Serializable
All Known Subinterfaces:
DtmfGenerator, Player

public interface MediaSource
extends Component

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(Pipe pipe)
          Joins this source with pipe.
 void disconnect(Pipe pipe)
          Disconnects this source from pipe.
 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.
 Formats 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.
 boolean isConnected()
          Gets the state of the component.
 boolean isStarted()
          Gets true if component is transmitting media.
 void setDsp(Processor dsp)
          Assigns digital signaling processor.
 void setDuration(long duration)
          Sets maximum duration for the signal generated by media source
 void setFormats(Formats formats)
          Set formats for streaming.
 void setInitialDelay(long initialDelay)
          Defines the delay between start() call and actual media streaming beginning.
 void setMediaTime(long time)
          Assigns media time from which this component should start media data.
 void start()
          Starts media processing.
 void stop()
          Terminates media processing.
 
Methods inherited from interface org.mobicents.media.Component
getId, getInterface, getName, reset
 

Method Detail

setInitialDelay

void setInitialDelay(long initialDelay)
Defines the delay between start() call and actual media streaming beginning. After successful start this value will be changed to zero. The new value must be assigned before each start.

Parameters:
initialDelay - the value of delay measured in nanoseconds.

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 nanoseconds.

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 nanoseconds.

connect

void connect(Pipe pipe)
Joins this source with pipe.

Parameters:
pipe - the pipe to connect to

disconnect

void disconnect(Pipe pipe)
Disconnects this source from pipe.

Parameters:
pipe - the pipe to be disconnected.

getFormats

Formats getFormats()
Get possible formats in which this source can stream media.

Returns:
an array of Format objects.

setFormats

void setFormats(Formats formats)
                throws FormatNotSupportedException
Set formats for streaming.

Parameters:
formats - the collection of formats.
Throws:
FormatNotSupportedException

setDsp

void setDsp(Processor dsp)
Assigns digital signaling processor.

Parameters:
dsp - processor instance.

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 © 2011. All Rights Reserved.