de.humatic.dsj.src
Class RTPSource

java.lang.Object
  extended by de.humatic.dsj.src.Source
      extended by de.humatic.dsj.src.NetworkSource
          extended by de.humatic.dsj.src.RTPSource

public class RTPSource
extends NetworkSource

Source for raw RTPStreams. This is kind of a stripped down version of the RTSPSource, that operates without any out of band format negotiation. Because it needs to be able to determine required information from the streams alone, it depends on the information in the RTP headers, namely the payload type. It therefore can not support dynamic payload types as used for most recent mpeg4 formats, but only (some of) those defined in RFC 3551.
Using dsj internal RTP handlers it will work with the following formats / payload types:
Audio:
0 - PCMU, ulaw
8 - PCMA, alaw
5, 6, 16 and 17 - DVI4
14 - MPA
Video:
26 - JPEG
32 - MPV
34 - H263
36 - H263-1998
Both:
33 - MP2T (Transportstream may carry mpeg1, 2, or 4-10 video and mp3 or AAC audio. AAC in transport streams won't work with all AAC decoders, see HTTPStreamingSource).

Related RFCs:
RFC 1889 (RTP, RTCP)
RFC 1890 (RTP Profile for Audio and Video Conferences with Minimal Control)

dsj 0_8_63 adds an additional constructor that partly loosens the above restrictions.


Field Summary
static int FORCE_SDP_FRAMERATE
           
static int NO_RTCP
           
 
Fields inherited from class de.humatic.dsj.src.NetworkSource
BUFFER_OVERFLOW, CONNECTION_TIMEOUT, FASTSTART, H264_FASTSTART, H264_FORCE_INLINE_SPS, H264_OMMIT_SPS, H264_PASS_INLINE_SPS, IDLE_TIMEOUT, KF_NOTIFY, LIVE_SRC, MAX_BUFFER_TIME, MAX_DURATION, MAX_FRAME_TIME, NO_USER_PROMPT, READ_USER_DATA, RECEIVE_TIMEOUT, RTCP_RECEIVE_ERROR, SEEK_FAILURE, SOCKET_ERROR, STARVING, UDP_UNCONNECTED
 
Fields inherited from class de.humatic.dsj.src.Source
ASYNC, AUTO_GC, DIRECT, ES, FILTER_SETUP_ERROR, FLV, HTTP, HTTP_AUDIO, JAS, MJPG, MKV, MP4, PSNET, PULL, PUSH, RAW, RTMP, RTP, RTSP, SHOUTCAST, SS_CLOSED, SS_CONNECT, SS_CONNECTED, SS_DONE, SS_EOS, SS_FORMAT_READ, SS_RUNNING, SS_SEEKING, SS_SETUP, SS_STREAMS_READ, SS_TCP_ROLLOVER, TIMEOUT, TSFILE, TSNET, UNKNOWN
 
Constructor Summary
RTPSource(java.lang.String[] URLs, int[] localPorts, int flags, java.beans.PropertyChangeListener listener)
          Tries to connect to the rtp streams at the given URLs, which must contain ip and port numbers (example: {"230.0.0.1:40050", "230.0.0.1:40052"} or {"192.168.0.1:4050"}).
RTPSource(java.lang.String[] URLs, int[] localPorts, java.beans.PropertyChangeListener listener)
           
RTPSource(java.lang.String[] URLs, java.beans.PropertyChangeListener listener)
           
RTPSource(java.lang.String sdpPath, int flags, java.beans.PropertyChangeListener listener)
          Special case constructor for "direct RTP" connections to sources using mediatypes that are not covered by fixed payload ID mappings.
 
Method Summary
 void closeSource(boolean terminate)
          Closes down the source.
 DSGraph createGraph(int graphFlags)
          Use this to create a filtergraph from the source.
 DSGraph createGraph(int graphFlags, DSFilterInfo videoDecoder, DSFilterInfo audioDecoder)
          Creates a DSGraph object with CompressedJavaSource filters, fed from this source and the given video and audio decoders.
 CompressedJavaSource createSourceFilter(int sf, DSMediaType mediaType)
          This is called by the various source implementations once they have determined, what kind of media they deal with etc.
It basically calls through to DSGraph.insertCompressedSourceFilter(...).
 DSMediaType[] getMediaTypes()
          Returns the media types created by this source.
 int getMinBufferTime()
          Returns this Source's minimum buffer requirements in msec worth of data.
 CompressedJavaSource[] getSourceFilters()
          Returns all the CompressedJavaSource filters, that the Source created.
 int getSourceTime()
           
 void notifyChannelFailure(int severity, int chNr, int cause, java.lang.String desc)
           
static void setMinBufferTime(int time)
           
static void setReceiveBufferSize(int socketReceiveBufferSize)
           
 void setSourceRate(float rate)
          Starts and pauses the source, application code should rather not use this method directly, but stick with DSFiltergraph methods.
 void setSourceTime(int time)
          Repositions the source, application code should rather not use this method directly, but stick with DSFiltergraph methods.
 
Methods inherited from class de.humatic.dsj.src.NetworkSource
configurePasswordDialog, getDefaultInterfaceAddress, getPasswordDialogOptions, getServerInfo, getTimeConstraint, setConnectionTimeout, setHTTPConnector, setNetworkInterface, setSocketFactory, setTimeConstraint, setUserAgent
 
Methods inherited from class de.humatic.dsj.src.Source
addSourceFilter, asyncRead, canSeek, createSourceFilter_async, getAvailable, getBuffered, getGraph, getID, getMaxTimeLoaded, getNumChannels, getOffsetTime, getPath, getSourceDuration, getSourceFilter, getSourceFlags, getTransport, getType, isLive, queryParameter_int, read, sendEvent, setOffsetTime, streamSeek, syncRead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RTCP

public static final int NO_RTCP
See Also:
Constant Field Values

FORCE_SDP_FRAMERATE

public static final int FORCE_SDP_FRAMERATE
See Also:
Constant Field Values
Constructor Detail

RTPSource

public RTPSource(java.lang.String[] URLs,
                 java.beans.PropertyChangeListener listener)
          throws java.lang.Exception
Throws:
java.lang.Exception

RTPSource

public RTPSource(java.lang.String[] URLs,
                 int[] localPorts,
                 java.beans.PropertyChangeListener listener)
          throws java.lang.Exception
Throws:
java.lang.Exception

RTPSource

public RTPSource(java.lang.String[] URLs,
                 int[] localPorts,
                 int flags,
                 java.beans.PropertyChangeListener listener)
          throws java.lang.Exception
Tries to connect to the rtp streams at the given URLs, which must contain ip and port numbers (example: {"230.0.0.1:40050", "230.0.0.1:40052"} or {"192.168.0.1:4050"}).
%localPorts may be used to enforce specific local port numbers (primarily of interst for unicast conections). This parameter can be null.
Using the local host's address and identical ports in %URLs and %localPorts (example: new RTPSource(new String[]{"127.0.0.1:6000"}, new int[]{6000}, 0, this)) will set up the source for inbound connections.

Throws:
java.lang.Exception

RTPSource

public RTPSource(java.lang.String sdpPath,
                 int flags,
                 java.beans.PropertyChangeListener listener)
          throws java.lang.Exception
Special case constructor for "direct RTP" connections to sources using mediatypes that are not covered by fixed payload ID mappings. This will read server URLs, ports, mediatypes and their payload IDs from an sdp file at %sdpPath. It will only use the information in that file to basically set up RTPChannels and NOT do any rtsp style format negotiation with the source. Encodings that normally use sdp parameters for out-of-band configuration (like sprop-parameter-sets for H264) MUST carry that information inline in the stream if it is not given in the sdp.
An example sdp file for said scenario may look like this:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=LIVE STREAM
t=0 0
c=IN IP4 230.0.0.1
m=video 1234 RTP/AVP 35
a=rtpmap:35 H264/90000
Where the important information enabling a basic setup is in the last three lines: The source streams H264 under payload ID 35 at multicast address 230.0.0.1 port 1234. Sequence and picture parameter sets are then read from the stream, which logically implies that setup may fail if the stream does not carry that information or take some time if the frequency in which those NAL types are appearing in the stream is low.
Another example might look like this:
c=IN IP4 127.0.0.1 m=video 4000 RTP/AVP 96 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;sprop-parameter-sets=Z0IAIIxoBQBbv/AAEAARAAADA+kAAdTAlAAAAAAAAAA=,aM48gAAAAAA=
Which would let the source expect somebody to unicast H264 under payload ID 96 to port 4000 on the local machine.

Throws:
java.lang.Exception
Method Detail

setMinBufferTime

public static void setMinBufferTime(int time)

getMinBufferTime

public int getMinBufferTime()
Description copied from class: Source
Returns this Source's minimum buffer requirements in msec worth of data. Usually only PUSH mode network sources work with buffers.

Overrides:
getMinBufferTime in class Source

setReceiveBufferSize

public static void setReceiveBufferSize(int socketReceiveBufferSize)

closeSource

public void closeSource(boolean terminate)
Description copied from class: Source
Closes down the source. When %terminate is true, all socket and stream resources etc. will also be freed. This method is called internally when disposing off the graph that was using this source and is not normally used by application code.

Overrides:
closeSource in class Source

getSourceTime

public int getSourceTime()
Overrides:
getSourceTime in class Source

setSourceTime

public void setSourceTime(int time)
Description copied from class: Source
Repositions the source, application code should rather not use this method directly, but stick with DSFiltergraph methods. The DSGraph created by a Source knows best when and how to interfere with the javaside data reading.

Overrides:
setSourceTime in class Source

setSourceRate

public void setSourceRate(float rate)
Description copied from class: Source
Starts and pauses the source, application code should rather not use this method directly, but stick with DSFiltergraph methods. The DSGraph created by a Source knows best when to change the state of the javaside implementation.

Overrides:
setSourceRate in class Source

createGraph

public DSGraph createGraph(int graphFlags)
                    throws DSJException
Use this to create a filtergraph from the source. This is a blocking call, that will not return before the asynchronous constructor has finished setting up the rtp sessions.

Overrides:
createGraph in class Source
Throws:
DSJException

createGraph

public DSGraph createGraph(int graphFlags,
                           DSFilterInfo videoDecoder,
                           DSFilterInfo audioDecoder)
                    throws DSJException
Description copied from class: Source
Creates a DSGraph object with CompressedJavaSource filters, fed from this source and the given video and audio decoders. This is for special use cases where you know exactly what media formats to expect. Any decoder you do not want to specify may be null or DSFilterInfo.doNotRender(). Failure to put a given decoder into the graph will be announced via GRAPH_ERROR events and dsj will try to automatically pick an alternative (no exception will be thrown!).

Overrides:
createGraph in class Source
Throws:
DSJException

getMediaTypes

public DSMediaType[] getMediaTypes()
Description copied from class: Source
Returns the media types created by this source. Depending on the time of calling, this method needs to be taken with care as during format negotiation mediatype information may not yet or only be partially available.

Overrides:
getMediaTypes in class Source

createSourceFilter

public CompressedJavaSource createSourceFilter(int sf,
                                               DSMediaType mediaType)
Description copied from class: Source
This is called by the various source implementations once they have determined, what kind of media they deal with etc.
It basically calls through to DSGraph.insertCompressedSourceFilter(...). The method is public for package design reasons and usually not called by application code.

Overrides:
createSourceFilter in class Source

getSourceFilters

public CompressedJavaSource[] getSourceFilters()
Description copied from class: Source
Returns all the CompressedJavaSource filters, that the Source created.

Overrides:
getSourceFilters in class Source

notifyChannelFailure

public void notifyChannelFailure(int severity,
                                 int chNr,
                                 int cause,
                                 java.lang.String desc)
Overrides:
notifyChannelFailure in class Source