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 288 of file DarwinInjector.cpp.

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

00290   : fNext(NULL), fRTPSink(rtpSink), fRTCPInstance(rtcpInstance) {
00291   // Create the SDP description for this substream
00292   char const* mediaType = fRTPSink->sdpMediaType();
00293   unsigned char rtpPayloadType = fRTPSink->rtpPayloadType();
00294   char const* rtpPayloadFormatName = fRTPSink->rtpPayloadFormatName();
00295   unsigned rtpTimestampFrequency = fRTPSink->rtpTimestampFrequency();
00296   unsigned numChannels = fRTPSink->numChannels();
00297   char* rtpmapLine;
00298   if (rtpPayloadType >= 96) {
00299     char* encodingParamsPart;
00300     if (numChannels != 1) {
00301       encodingParamsPart = new char[1 + 20 /* max int len */];
00302       sprintf(encodingParamsPart, "/%d", numChannels);
00303     } else {
00304       encodingParamsPart = strDup("");
00305     }
00306     char const* const rtpmapFmt = "a=rtpmap:%d %s/%d%s\r\n";
00307     unsigned rtpmapFmtSize = strlen(rtpmapFmt)
00308       + 3 /* max char len */ + strlen(rtpPayloadFormatName)
00309       + 20 /* max int len */ + strlen(encodingParamsPart);
00310     rtpmapLine = new char[rtpmapFmtSize];
00311     sprintf(rtpmapLine, rtpmapFmt,
00312             rtpPayloadType, rtpPayloadFormatName,
00313             rtpTimestampFrequency, encodingParamsPart);
00314     delete[] encodingParamsPart;
00315   } else {
00316     // Static payload type => no "a=rtpmap:" line
00317     rtpmapLine = strDup("");
00318   }
00319   unsigned rtpmapLineSize = strlen(rtpmapLine);
00320   char const* auxSDPLine = fRTPSink->auxSDPLine();
00321   if (auxSDPLine == NULL) auxSDPLine = "";
00322   unsigned auxSDPLineSize = strlen(auxSDPLine);
00323 
00324   char const* const sdpFmt =
00325     "m=%s 0 RTP/AVP %u\r\n"
00326     "%s" // "a=rtpmap:" line (if present)
00327     "%s" // auxilliary (e.g., "a=fmtp:") line (if present)
00328     "a=control:trackID=%u\r\n";
00329   unsigned sdpFmtSize = strlen(sdpFmt)
00330     + strlen(mediaType) + 3 /* max char len */
00331     + rtpmapLineSize
00332     + auxSDPLineSize
00333     + 20 /* max int len */;
00334   char* sdpLines = new char[sdpFmtSize];
00335   sprintf(sdpLines, sdpFmt,
00336           mediaType, // m= <media>
00337           rtpPayloadType, // m= <fmt list>
00338           rtpmapLine, // a=rtpmap:... (if present)
00339           auxSDPLine, // optional extra SDP line
00340           trackId); // a=control:<track-id>
00341   fSDPLines = strDup(sdpLines);
00342   delete[] sdpLines;
00343   delete[] rtpmapLine;
00344 }

SubstreamDescriptor::~SubstreamDescriptor (  ) 

Definition at line 346 of file DarwinInjector.cpp.

References fNext, and fSDPLines.

00346                                           {
00347   delete fSDPLines;
00348   delete fNext;
00349 }


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 Mar 25 14:40:57 2014 for live by  doxygen 1.5.2