Methods Summary |
---|
public void | connect()Opens a connection to the source described by
the URL.
Connect initiates communmication with the source.
// start the RTPSessionManager by calling startSession()
// this will throw an IOException if there is any problem
/*
if (mgr != null){
mgr.startSession();
}
*/
if (srcStreams != null){
for (int i = 0; i < srcStreams.length; i++){
if (srcStreams[i] != null)
((com.sun.media.rtp.RTPSourceStream)srcStreams[i]).connect();
}
}
connected = true;
|
public void | disconnect()Close the connection to the source described by the URL.
Disconnect frees resources used to maintain a connection
to the source. If no resources are in use, disconnect
is ignored.
Implies a stop, if stop hasn't already been called.
// once we have disconnected, set boolean to false
// If this datasource was created by using the RTPAPI and not
// via Manager, we dont want to disconnect this source i.e. we
// dont want to closeSession() on RTPSM. In this case, the
// datasource will not have a manager set to it. In this case,
// the datasource cannot really be disconnected until the
// session manager is closed by using the RTPAPI
if (srcStreams != null){
for (int i = 0; i < srcStreams.length; i++)
((com.sun.media.rtp.RTPSourceStream)srcStreams[i]).close();
}
/*
if (mgr != null){
// close the RTPSourceStream
mgr.removeDataSource(this);
mgr.closeSession();
mgr = null;
// to fix bug 4174773, multiple stream problem 9/18/98
started = false;
connected = false;
return;
}
*/
|
public void | flush()A method to flush the data buffers int the DataSource.
srcStreams[0].reset();
|
public java.lang.String | getCNAME()
if (mgr == null)
return null;
SSRCInfo info = mgr.getSSRCInfo(ssrc);
if (info != null)
return info.getCNAME();
return null;
|
public java.lang.Object | getControl(java.lang.String type)Returns null because no controls are implemented.
Class cls;
try {
cls = Class.forName(type);
} catch (ClassNotFoundException e) {
return null;
}
Object cs[] = getControls();
for (int i = 0; i < cs.length; i++) {
if (cls.isInstance(cs[i]))
return cs[i];
}
return null;
|
public java.lang.Object[] | getControls()Returns an zero length array because no controls
are supported.
// return a one element array of rtpcontrol object
RTPControl[] controls = new RTPControl[1];
controls[0] = rtpcontrol;
return controls;
|
public com.sun.media.rtp.RTPSessionMgr | getMgr()
return mgr;
|
public javax.media.Player | getPlayer()
return streamplayer;
|
public int | getSSRC()
return ssrc;
|
public javax.media.protocol.PushBufferStream[] | getStreams()Obtain the collection of streams that this source
manages. The collection of streams is entirely
content dependent. The mime-type of this
DataSource provides the only indication of
what streams can be available on this connection.
if (!connected)
return null;
return srcStreams;
|
public boolean | isPrefetchable()
return false;
|
public boolean | isStarted()
return started;
|
public void | prebuffer()
started = true;
srcStreams[0].prebuffer();
|
public void | setBufferListener(com.sun.media.protocol.BufferListener listener)
srcStreams[0].setBufferListener(listener);
|
public void | setBufferWhenStopped(boolean flag)
srcStreams[0].setBufferWhenStopped(flag);
|
public void | setChild(com.sun.media.protocol.rtp.DataSource source)
childsrc = source;
|
public void | setContentType(java.lang.String contentType)
this.contentType = contentType;
|
public void | setControl(java.lang.Object control)
rtpcontrol = (RTPControl)control;
|
public void | setLocator(javax.media.MediaLocator mrl)
super.setLocator(mrl);
|
public void | setMgr(com.sun.media.rtp.RTPSessionMgr mgr)
//System.out.println("manager being set to " + mgr);
this.mgr = mgr;
|
public void | setPlayer(javax.media.Player player)
streamplayer = player;
|
public void | setSSRC(int ssrc)
this.ssrc = ssrc;
|
public void | setSourceStream(com.sun.media.rtp.RTPSourceStream stream)
if (srcStreams != null)
srcStreams[0] = stream;
|
public void | start()Initiates data-transfer. Start must be called before
data is available. Connect must be called before start.
super.start();
if (childsrc != null)
childsrc.start();
if (srcStreams != null){
for (int i = 0; i < srcStreams.length; i++)
((com.sun.media.rtp.RTPSourceStream)srcStreams[i]).start();
}
|
public void | stop()Stops data-transfer.
If the source has not already been connected and started,
stop does nothing.
super.stop();
// stop your child source as well
if (childsrc != null)
childsrc.stop();
if (srcStreams != null){
for (int i = 0; i < srcStreams.length; i++)
((com.sun.media.rtp.RTPSourceStream)srcStreams[i]).stop();
}
|