SubstreamDescriptor Class Reference

Collaboration diagram for SubstreamDescriptor:

Collaboration graph
[legend]

Public Member Functions

 SubstreamDescriptor (RTPSink *rtpSink, RTCPInstance *rtcpInstance, unsigned trackId)
 ~SubstreamDescriptor ()
SubstreamDescriptor *& next ()
RTPSinkrtpSink () const
RTCPInstancertcpInstance () const
char const * sdpLines () const

Private Attributes

SubstreamDescriptorfNext
RTPSinkfRTPSink
RTCPInstancefRTCPInstance
char * fSDPLines

Detailed Description

Definition at line 28 of file DarwinInjector.cpp.


Constructor & Destructor Documentation

SubstreamDescriptor::SubstreamDescriptor ( RTPSink rtpSink,
RTCPInstance rtcpInstance,
unsigned  trackId 
)

Definition at line 246 of file DarwinInjector.cpp.

References RTPSink::auxSDPLine(), fRTPSink, fSDPLines, NULL, RTPSink::numChannels(), RTPSink::rtpPayloadFormatName(), RTPSink::rtpPayloadType(), RTPSink::rtpTimestampFrequency(), sdpLines(), RTPSink::sdpMediaType(), and strDup().

00248   : fNext(NULL), fRTPSink(rtpSink), fRTCPInstance(rtcpInstance) {
00249   // Create the SDP description for this substream
00250   char const* mediaType = fRTPSink->sdpMediaType();
00251   unsigned char rtpPayloadType = fRTPSink->rtpPayloadType();
00252   char const* rtpPayloadFormatName = fRTPSink->rtpPayloadFormatName();
00253   unsigned rtpTimestampFrequency = fRTPSink->rtpTimestampFrequency();
00254   unsigned numChannels = fRTPSink->numChannels();
00255   char* rtpmapLine;
00256   if (rtpPayloadType >= 96) {
00257     char* encodingParamsPart;
00258     if (numChannels != 1) {
00259       encodingParamsPart = new char[1 + 20 /* max int len */];
00260       sprintf(encodingParamsPart, "/%d", numChannels);
00261     } else {
00262       encodingParamsPart = strDup("");
00263     }
00264     char const* const rtpmapFmt = "a=rtpmap:%d %s/%d%s\r\n";
00265     unsigned rtpmapFmtSize = strlen(rtpmapFmt)
00266       + 3 /* max char len */ + strlen(rtpPayloadFormatName)
00267       + 20 /* max int len */ + strlen(encodingParamsPart);
00268     rtpmapLine = new char[rtpmapFmtSize];
00269     sprintf(rtpmapLine, rtpmapFmt,
00270             rtpPayloadType, rtpPayloadFormatName,
00271             rtpTimestampFrequency, encodingParamsPart);
00272     delete[] encodingParamsPart;
00273   } else {
00274     // Static payload type => no "a=rtpmap:" line
00275     rtpmapLine = strDup("");
00276   }
00277   unsigned rtpmapLineSize = strlen(rtpmapLine);
00278   char const* auxSDPLine = fRTPSink->auxSDPLine();
00279   if (auxSDPLine == NULL) auxSDPLine = "";
00280   unsigned auxSDPLineSize = strlen(auxSDPLine);
00281 
00282   char const* const sdpFmt =
00283     "m=%s 0 RTP/AVP %u\r\n"
00284     "%s" // "a=rtpmap:" line (if present)
00285     "%s" // auxilliary (e.g., "a=fmtp:") line (if present)
00286     "a=control:trackID=%u\r\n";
00287   unsigned sdpFmtSize = strlen(sdpFmt)
00288     + strlen(mediaType) + 3 /* max char len */
00289     + rtpmapLineSize
00290     + auxSDPLineSize
00291     + 20 /* max int len */;
00292   char* sdpLines = new char[sdpFmtSize];
00293   sprintf(sdpLines, sdpFmt,
00294           mediaType, // m= <media>
00295           rtpPayloadType, // m= <fmt list>
00296           rtpmapLine, // a=rtpmap:... (if present)
00297           auxSDPLine, // optional extra SDP line
00298           trackId); // a=control:<track-id>
00299   fSDPLines = strDup(sdpLines);
00300   delete[] sdpLines;
00301   delete[] rtpmapLine;
00302 }

SubstreamDescriptor::~SubstreamDescriptor (  ) 

Definition at line 304 of file DarwinInjector.cpp.

References fNext, and fSDPLines.

00304                                           {
00305   delete fSDPLines;
00306   delete fNext;
00307 }


Member Function Documentation

SubstreamDescriptor*& SubstreamDescriptor::next (  )  [inline]

Definition at line 33 of file DarwinInjector.cpp.

References fNext.

Referenced by DarwinInjector::addStream(), and DarwinInjector::setDestination().

00033 { return fNext; }

RTPSink* SubstreamDescriptor::rtpSink (  )  const [inline]

Definition at line 34 of file DarwinInjector.cpp.

References fRTPSink.

Referenced by DarwinInjector::setDestination().

00034 { return fRTPSink; }

RTCPInstance* SubstreamDescriptor::rtcpInstance (  )  const [inline]

Definition at line 35 of file DarwinInjector.cpp.

References fRTCPInstance.

Referenced by DarwinInjector::setDestination().

00035 { return fRTCPInstance; }

char const* SubstreamDescriptor::sdpLines (  )  const [inline]

Definition at line 36 of file DarwinInjector.cpp.

References fSDPLines.

Referenced by DarwinInjector::addStream(), DarwinInjector::setDestination(), and SubstreamDescriptor().

00036 { return fSDPLines; }


Field Documentation

SubstreamDescriptor* SubstreamDescriptor::fNext [private]

Definition at line 39 of file DarwinInjector.cpp.

Referenced by next(), and ~SubstreamDescriptor().

RTPSink* SubstreamDescriptor::fRTPSink [private]

Definition at line 40 of file DarwinInjector.cpp.

Referenced by rtpSink(), and SubstreamDescriptor().

RTCPInstance* SubstreamDescriptor::fRTCPInstance [private]

Definition at line 41 of file DarwinInjector.cpp.

Referenced by rtcpInstance().

char* SubstreamDescriptor::fSDPLines [private]

Definition at line 42 of file DarwinInjector.cpp.

Referenced by sdpLines(), SubstreamDescriptor(), and ~SubstreamDescriptor().


The documentation for this class was generated from the following file:
Generated on Tue Oct 7 15:40:13 2008 for live by  doxygen 1.5.2