de.humatic.dsj.sink.sa
Class StreamAnnouncement

java.lang.Object
  extended by de.humatic.dsj.sink.sa.StreamAnnouncement

public class StreamAnnouncement
extends java.lang.Object

Baseclass for stream announcements as used with the RTPSink class. dsj contains implementations that directly output .sdp files, announce a stream via SAP or initiate pushing a stream to a Darwin or QTSS server, see createForType(..) for details.


Field Summary
static int DARWIN_PUSH
           
static int SAP
           
static int SDP
           
 
Method Summary
 void close()
          Called by the RTPSink on shutdown to make StreamAnnouncements free all resources they have instantiated.
 void createAnnouncement(java.lang.String sdpInfo)
           
 void createAnnouncement(java.lang.String sdpInfo, int[] params)
          Called by the RTPSink to trigger the announcement process.
static StreamAnnouncement createForType(int type, java.lang.String target)
          Returns a dedicated subclass according to the type parameter, announcing a stream to %target:
To create an .sdp file use createForType(StreamAnnouncement.SDP, sdp_filepath), where filepath can be absolute or relative to the cwd.
SAP announcements (see rfc 2974) are created using createForType(StreamAnnouncement.SAP, null), where the target parameter can optionally take an other than the default SAP (224.2.127.254:9875) IP and port combination.
 java.lang.String getKeyValue(java.lang.String key)
           
 int getServerPort(int index)
          Returns server picked RTP and RTCP ports for DARWIN_PUSH announcemnets set up without port preferences.
 java.lang.String getTarget()
           
 int getType()
           
 void setParameter(java.lang.String key, java.lang.String value)
          Used to set additional parameters after construction and before passing the announcement to the sink.
 void setSocket(java.net.Socket socket)
          The sink may pass in the socket to use by the StreamAnnouncement here before calling createAnnouncement..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SDP

public static final int SDP
See Also:
Constant Field Values

SAP

public static final int SAP
See Also:
Constant Field Values

DARWIN_PUSH

public static final int DARWIN_PUSH
See Also:
Constant Field Values
Method Detail

createForType

public static StreamAnnouncement createForType(int type,
                                               java.lang.String target)
                                        throws java.lang.Exception
Returns a dedicated subclass according to the type parameter, announcing a stream to %target:
To create an .sdp file use createForType(StreamAnnouncement.SDP, sdp_filepath), where filepath can be absolute or relative to the cwd.
SAP announcements (see rfc 2974) are created using createForType(StreamAnnouncement.SAP, null), where the target parameter can optionally take an other than the default SAP (224.2.127.254:9875) IP and port combination. Please note that the new strict SAP parser in VLC versions greater than 0.9.1 will not pick up SAP announcements with more than one media line.
Pushing a stream to a Darwin or QTSS server is initiated by using createForType(StreamAnnouncement.DARWIN_PUSH, IP_of_server:port(optional, def.:554)/path_to_sdpFile_to_create). The given target address is used for initial RTSP negotiation and will later be used to replay the stream reflected by the server (i.e.: rtsp://IP_of_server:port(optional)/path_to_sdpFile.sdp)

Throws:
java.lang.Exception

getType

public int getType()

close

public void close()
Called by the RTPSink on shutdown to make StreamAnnouncements free all resources they have instantiated.


setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
Used to set additional parameters after construction and before passing the announcement to the sink. Not all subclasses make use of this, but user implementations are free to accept any number of parameters here.
A StreamAnnouncement of type DARWIN_PUSH will read the following keys (case insensitive):
"username" & "password" - if neither are given a password dialog will pop up on servers that require authorization.
Both types DARWIN_PUSH & SDP read these:
"title", "author", "info", "copyright" & "comment" - these set Quicktime annotations, no defaults.


getKeyValue

public java.lang.String getKeyValue(java.lang.String key)

getTarget

public java.lang.String getTarget()

getServerPort

public int getServerPort(int index)
Returns server picked RTP and RTCP ports for DARWIN_PUSH announcemnets set up without port preferences.


setSocket

public void setSocket(java.net.Socket socket)
The sink may pass in the socket to use by the StreamAnnouncement here before calling createAnnouncement..


createAnnouncement

public void createAnnouncement(java.lang.String sdpInfo,
                               int[] params)
                        throws java.lang.Exception
Called by the RTPSink to trigger the announcement process. Depending on implementation the operation may be asynchronous (SAP will keep posting announcements with the stream just running, ready for clients to hook in) or synchronous (DARWIN_PUSH will fail and create an exception in the RTPSink constructor, when the server does not respond or errors occur during announcement).

Throws:
java.lang.Exception

createAnnouncement

public void createAnnouncement(java.lang.String sdpInfo)
                        throws java.lang.Exception
Throws:
java.lang.Exception