Methods Summary |
---|
public void | close()Close the connection to the source described by the locator.
The close method frees resources used to maintain a
connection to the destination described in the medialocator.
If no resources are in use, close is ignored.
If stop hasn't already been called,
calling close implies a stop.
The DataSink may no longer be used after being closed.
if (rtpmanager != null) {
rtpmanager.removeTargets("DataSink closed");
rtpmanager.dispose();
}
|
public java.lang.String | getContentType()Get a string that describes the content-type of the media
that the datasink is consuming.
return "RTP";
|
public java.lang.Object | getControl(java.lang.String controlType)
return null;
|
public java.awt.Component | getControlComponent()
return null;
|
public java.lang.Object[] | getControls()
return new Object[0];
|
public javax.media.MediaLocator | getOutputLocator()Get the output MediaLocator that describes where
the output of this DataSink goes.
return rtpmrl;
|
public void | open()Open a connection to the destination described by
the output MediaLocator.
The open method establishes a channel with the destination
as described in the medialocator.
// create, initialise and start the session manager here
if (rtpmrl == null)
throw new IOException ("No Valid RTP MediaLocator");
try {
String address = rtpmrl.getSessionAddress();
int port = rtpmrl.getSessionPort();
int ttl = rtpmrl.getTTL();
rtpmanager = RTPManager.newInstance();
// create our local Session Address
SessionAddress localaddr = new SessionAddress();
InetAddress destaddr = InetAddress.getByName(address);
SessionAddress sessaddr = new SessionAddress(destaddr, port, ttl);
rtpmanager.initialize(localaddr);
rtpmanager.addTarget(sessaddr);
rtpsendstream = rtpmanager.createSendStream(source,0);
} catch (Exception e) {
throw new IOException (e.getMessage());
}
|
public void | setOutputLocator(javax.media.MediaLocator output)Set the output MediaLocator .
This method should only be called once; an error is thrown if
the locator has already been set.
if (rtpmrl == null) {
System.out.println("sink: setOutputLocator " + output);
// need to validate the RTPMedialocator
try{
rtpmrl = new RTPMediaLocator(output.toString());
}catch (MalformedURLException e){
rtpmrl = null;
}
} else {
throw new Error("setOutputLocator cannot be called more than once");
}
|
public void | setSource(javax.media.protocol.DataSource source)
if ( ! (source instanceof PushBufferDataSource) ) {
throw new IncompatibleSourceException("Only supports PushBufferDataSource");
}
this.source = (PushBufferDataSource) source;
PushBufferStream [] streams = this.source.getStreams();
int numStreams = streams.length;
System.out.println("streams is " + streams + " : " + numStreams);
if ( (streams == null) || (numStreams <= 0) )
throw new IOException("source " + source + " doesn't have any streams");
|
public void | start()Initiate data-transfer.
You must call open before calling start
rtpsendstream.start();
|
public void | stop()Stop the data-transfer.
If the source has not been connected and started,
stop does nothing.
rtpsendstream.stop();
|