#include <MediaSession.hh>
Inheritance diagram for MediaSession:


Public Member Functions | |
| Boolean | hasSubsessions () const |
| double & | playStartTime () |
| double & | playEndTime () |
| char * | connectionEndpointName () const |
| char const * | CNAME () const |
| in_addr const & | sourceFilterAddr () const |
| float & | scale () |
| char * | mediaSessionType () const |
| char * | sessionName () const |
| char * | sessionDescription () const |
| char const * | controlPath () const |
| Boolean | initiateByMediaType (char const *mimeType, MediaSubsession *&resultSubsession, int useSpecialRTPoffset=-1) |
| UsageEnvironment & | envir () const |
| char const * | name () const |
| virtual Boolean | isSource () const |
| virtual Boolean | isSink () const |
| virtual Boolean | isRTCPInstance () const |
| virtual Boolean | isRTSPClient () const |
| virtual Boolean | isRTSPServer () const |
| virtual Boolean | isServerMediaSession () const |
| virtual Boolean | isDarwinInjector () const |
Static Public Member Functions | |
| static MediaSession * | createNew (UsageEnvironment &env, char const *sdpDescription) |
| static Boolean | lookupByName (UsageEnvironment &env, char const *sourceName, MediaSession *&resultSession) |
| static Boolean | lookupByName (UsageEnvironment &env, char const *mediumName, Medium *&resultMedium) |
| static void | close (UsageEnvironment &env, char const *mediumName) |
| static void | close (Medium *medium) |
Protected Member Functions | |
| virtual Boolean | isMediaSession () const |
| MediaSession (UsageEnvironment &env) | |
| virtual | ~MediaSession () |
| virtual MediaSubsession * | createNewMediaSubsession () |
| Boolean | initializeWithSDP (char const *sdpDescription) |
| Boolean | parseSDPLine (char const *input, char const *&nextLine) |
| Boolean | parseSDPLine_s (char const *sdpLine) |
| Boolean | parseSDPLine_i (char const *sdpLine) |
| Boolean | parseSDPLine_c (char const *sdpLine) |
| Boolean | parseSDPAttribute_type (char const *sdpLine) |
| Boolean | parseSDPAttribute_control (char const *sdpLine) |
| Boolean | parseSDPAttribute_range (char const *sdpLine) |
| Boolean | parseSDPAttribute_source_filter (char const *sdpLine) |
| TaskToken & | nextTask () |
Static Protected Member Functions | |
| static char * | lookupPayloadFormat (unsigned char rtpPayloadType, unsigned &rtpTimestampFrequency, unsigned &numChannels) |
| static unsigned | guessRTPTimestampFrequency (char const *mediumName, char const *codecName) |
Protected Attributes | |
| char * | fCNAME |
| MediaSubsession * | fSubsessionsHead |
| MediaSubsession * | fSubsessionsTail |
| char * | fConnectionEndpointName |
| double | fMaxPlayStartTime |
| double | fMaxPlayEndTime |
| in_addr | fSourceFilterAddr |
| float | fScale |
| char * | fMediaSessionType |
| char * | fSessionName |
| char * | fSessionDescription |
| char * | fControlPath |
Friends | |
| class | MediaSubsessionIterator |
| class | MediaLookupTable |
Definition at line 55 of file MediaSession.hh.
| MediaSession::MediaSession | ( | UsageEnvironment & | env | ) | [protected] |
Definition at line 59 of file MediaSession.cpp.
References CNAME(), fCNAME, fSourceFilterAddr, our_random(), and strDup().
Referenced by createNew().
00060 : Medium(env), 00061 fSubsessionsHead(NULL), fSubsessionsTail(NULL), 00062 fConnectionEndpointName(NULL), fMaxPlayStartTime(0.0f), fMaxPlayEndTime(0.0f), 00063 fScale(1.0f), fMediaSessionType(NULL), fSessionName(NULL), fSessionDescription(NULL), 00064 fControlPath(NULL) { 00065 fSourceFilterAddr.s_addr = 0; 00066 00067 // Get our host name, and use this for the RTCP CNAME: 00068 const unsigned maxCNAMElen = 100; 00069 char CNAME[maxCNAMElen+1]; 00070 #ifndef CRIS 00071 gethostname((char*)CNAME, maxCNAMElen); 00072 #else 00073 // "gethostname()" isn't defined for this platform 00074 sprintf(CNAME, "unknown host %d", (unsigned)(our_random()*0x7FFFFFFF)); 00075 #endif 00076 CNAME[maxCNAMElen] = '\0'; // just in case 00077 fCNAME = strDup(CNAME); 00078 }
| MediaSession::~MediaSession | ( | ) | [protected, virtual] |
Definition at line 80 of file MediaSession.cpp.
References fCNAME, fConnectionEndpointName, fControlPath, fMediaSessionType, fSessionDescription, fSessionName, and fSubsessionsHead.
00080 { 00081 delete fSubsessionsHead; 00082 delete[] fCNAME; 00083 delete[] fConnectionEndpointName; 00084 delete[] fMediaSessionType; 00085 delete[] fSessionName; 00086 delete[] fSessionDescription; 00087 delete[] fControlPath; 00088 }
| MediaSession * MediaSession::createNew | ( | UsageEnvironment & | env, | |
| char const * | sdpDescription | |||
| ) | [static] |
Definition at line 29 of file MediaSession.cpp.
References env, initializeWithSDP(), MediaSession(), and NULL.
Referenced by continueAfterDESCRIBE(), and DarwinInjector::setDestination().
00030 { 00031 MediaSession* newSession = new MediaSession(env); 00032 if (newSession != NULL) { 00033 if (!newSession->initializeWithSDP(sdpDescription)) { 00034 delete newSession; 00035 return NULL; 00036 } 00037 } 00038 00039 return newSession; 00040 }
| Boolean MediaSession::lookupByName | ( | UsageEnvironment & | env, | |
| char const * | sourceName, | |||
| MediaSession *& | resultSession | |||
| ) | [static] |
Definition at line 42 of file MediaSession.cpp.
References env, False, Medium::isMediaSession(), Medium::lookupByName(), NULL, and True.
00044 { 00045 resultSession = NULL; // unless we succeed 00046 00047 Medium* medium; 00048 if (!Medium::lookupByName(env, instanceName, medium)) return False; 00049 00050 if (!medium->isMediaSession()) { 00051 env.setResultMsg(instanceName, " is not a 'MediaSession' object"); 00052 return False; 00053 } 00054 00055 resultSession = (MediaSession*)medium; 00056 return True; 00057 }
| Boolean MediaSession::hasSubsessions | ( | ) | const [inline] |
Definition at line 63 of file MediaSession.hh.
References fSubsessionsHead, and NULL.
Referenced by continueAfterDESCRIBE().
00063 { return fSubsessionsHead != NULL; }
| double& MediaSession::playStartTime | ( | ) | [inline] |
Definition at line 64 of file MediaSession.hh.
References fMaxPlayStartTime.
Referenced by continueAfterPLAY(), RTSPClient::handlePLAYResponse(), MediaSubsession::parseSDPAttribute_range(), parseSDPAttribute_range(), MediaSubsession::playStartTime(), and setupNextSubsession().
00064 { return fMaxPlayStartTime; }
| double& MediaSession::playEndTime | ( | ) | [inline] |
Definition at line 65 of file MediaSession.hh.
References fMaxPlayEndTime.
Referenced by continueAfterPLAY(), RTSPClient::handlePLAYResponse(), MediaSubsession::parseSDPAttribute_range(), parseSDPAttribute_range(), MediaSubsession::playEndTime(), setupNextSubsession(), and setupStreams().
00065 { return fMaxPlayEndTime; }
| char* MediaSession::connectionEndpointName | ( | ) | const [inline] |
Definition at line 66 of file MediaSession.hh.
References fConnectionEndpointName.
Referenced by MediaSubsession::connectionEndpointAddress(), and parseSDPLine_c().
00066 { return fConnectionEndpointName; }
| char const* MediaSession::CNAME | ( | ) | const [inline] |
Definition at line 67 of file MediaSession.hh.
References fCNAME.
Referenced by MediaSubsession::initiate(), and MediaSession().
00067 { return fCNAME; }
| struct in_addr const& MediaSession::sourceFilterAddr | ( | ) | const [inline, read] |
Definition at line 68 of file MediaSession.hh.
References fSourceFilterAddr.
00068 { return fSourceFilterAddr; }
| float& MediaSession::scale | ( | ) | [inline] |
Definition at line 69 of file MediaSession.hh.
References fScale.
Referenced by RTSPClient::handlePLAYResponse(), and RTSPClient::sendRequest().
00069 { return fScale; }
| char* MediaSession::mediaSessionType | ( | ) | const [inline] |
Definition at line 70 of file MediaSession.hh.
References fMediaSessionType.
00070 { return fMediaSessionType; }
| char* MediaSession::sessionName | ( | ) | const [inline] |
Definition at line 71 of file MediaSession.hh.
References fSessionName.
00071 { return fSessionName; }
| char* MediaSession::sessionDescription | ( | ) | const [inline] |
Definition at line 72 of file MediaSession.hh.
References fSessionDescription.
00072 { return fSessionDescription; }
| char const* MediaSession::controlPath | ( | ) | const [inline] |
Definition at line 73 of file MediaSession.hh.
References fControlPath.
Referenced by parseSDPAttribute_control(), and RTSPClient::sessionURL().
00073 { return fControlPath; }
| Boolean MediaSession::initiateByMediaType | ( | char const * | mimeType, | |
| MediaSubsession *& | resultSubsession, | |||
| int | useSpecialRTPoffset = -1 | |||
| ) |
Definition at line 472 of file MediaSession.cpp.
References MediaSubsession::deInitiate(), Medium::envir(), False, MediaSubsession::initiate(), iter, MediaSource::MIMEtype(), MediaSubsessionIterator::next(), NULL, MediaSubsession::readSource(), UsageEnvironment::setResultMsg(), subsession, and True.
00474 { 00475 // Look through this session's subsessions for media that match "mimeType" 00476 resultSubsession = NULL; 00477 MediaSubsessionIterator iter(*this); 00478 MediaSubsession* subsession; 00479 while ((subsession = iter.next()) != NULL) { 00480 Boolean wasAlreadyInitiated = subsession->readSource() != NULL; 00481 if (!wasAlreadyInitiated) { 00482 // Try to create a source for this subsession: 00483 if (!subsession->initiate(useSpecialRTPoffset)) return False; 00484 } 00485 00486 // Make sure the source's MIME type is one that we handle: 00487 if (strcmp(subsession->readSource()->MIMEtype(), mimeType) != 0) { 00488 if (!wasAlreadyInitiated) subsession->deInitiate(); 00489 continue; 00490 } 00491 00492 resultSubsession = subsession; 00493 break; // use this 00494 } 00495 00496 if (resultSubsession == NULL) { 00497 envir().setResultMsg("Session has no usable media subsession"); 00498 return False; 00499 } 00500 00501 return True; 00502 }
| Boolean MediaSession::isMediaSession | ( | ) | const [protected, virtual] |
Reimplemented from Medium.
Definition at line 90 of file MediaSession.cpp.
References True.
00090 { 00091 return True; 00092 }
| MediaSubsession * MediaSession::createNewMediaSubsession | ( | ) | [protected, virtual] |
Definition at line 94 of file MediaSession.cpp.
Referenced by initializeWithSDP().
00094 { 00095 // default implementation: 00096 return new MediaSubsession(*this); 00097 }
| Boolean MediaSession::initializeWithSDP | ( | char const * | sdpDescription | ) | [protected] |
Definition at line 99 of file MediaSession.cpp.
References createNewMediaSubsession(), Medium::envir(), False, MediaSubsession::fClientPortNum, MediaSubsession::fCodecName, MediaSubsession::fMediumName, MediaSubsession::fNumChannels, MediaSubsession::fProtocolName, MediaSubsession::fRTPPayloadFormat, MediaSubsession::fRTPTimestampFrequency, MediaSubsession::fSavedSDPLines, fSubsessionsHead, fSubsessionsTail, guessRTPTimestampFrequency(), lookupPayloadFormat(), NULL, MediaSubsession::parseSDPAttribute_control(), parseSDPAttribute_control(), MediaSubsession::parseSDPAttribute_fmtp(), MediaSubsession::parseSDPAttribute_framerate(), MediaSubsession::parseSDPAttribute_range(), parseSDPAttribute_range(), MediaSubsession::parseSDPAttribute_rtpmap(), MediaSubsession::parseSDPAttribute_source_filter(), parseSDPAttribute_source_filter(), parseSDPAttribute_type(), MediaSubsession::parseSDPAttribute_x_dimensions(), parseSDPLine(), MediaSubsession::parseSDPLine_b(), MediaSubsession::parseSDPLine_c(), parseSDPLine_c(), parseSDPLine_i(), parseSDPLine_s(), MediaSubsession::serverPortNum, MediaSubsession::setNext(), UsageEnvironment::setResultMsg(), strDup(), strDupSize(), subsession, and True.
Referenced by createNew().
00099 { 00100 if (sdpDescription == NULL) return False; 00101 00102 // Begin by processing all SDP lines until we see the first "m=" 00103 char const* sdpLine = sdpDescription; 00104 char const* nextSDPLine; 00105 while (1) { 00106 if (!parseSDPLine(sdpLine, nextSDPLine)) return False; 00107 //##### We should really check for: 00108 // - "a=control:" attributes (to set the URL for aggregate control) 00109 // - the correct SDP version (v=0) 00110 if (sdpLine[0] == 'm') break; 00111 sdpLine = nextSDPLine; 00112 if (sdpLine == NULL) break; // there are no m= lines at all 00113 00114 // Check for various special SDP lines that we understand: 00115 if (parseSDPLine_s(sdpLine)) continue; 00116 if (parseSDPLine_i(sdpLine)) continue; 00117 if (parseSDPLine_c(sdpLine)) continue; 00118 if (parseSDPAttribute_control(sdpLine)) continue; 00119 if (parseSDPAttribute_range(sdpLine)) continue; 00120 if (parseSDPAttribute_type(sdpLine)) continue; 00121 if (parseSDPAttribute_source_filter(sdpLine)) continue; 00122 } 00123 00124 while (sdpLine != NULL) { 00125 // We have a "m=" line, representing a new sub-session: 00126 MediaSubsession* subsession = createNewMediaSubsession(); 00127 if (subsession == NULL) { 00128 envir().setResultMsg("Unable to create new MediaSubsession"); 00129 return False; 00130 } 00131 00132 // Parse the line as "m=<medium_name> <client_portNum> RTP/AVP <fmt>" 00133 // or "m=<medium_name> <client_portNum>/<num_ports> RTP/AVP <fmt>" 00134 // (Should we be checking for >1 payload format number here?)##### 00135 char* mediumName = strDupSize(sdpLine); // ensures we have enough space 00136 char const* protocolName = NULL; 00137 unsigned payloadFormat; 00138 if ((sscanf(sdpLine, "m=%s %hu RTP/AVP %u", 00139 mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 || 00140 sscanf(sdpLine, "m=%s %hu/%*u RTP/AVP %u", 00141 mediumName, &subsession->fClientPortNum, &payloadFormat) == 3) 00142 && payloadFormat <= 127) { 00143 protocolName = "RTP"; 00144 } else if ((sscanf(sdpLine, "m=%s %hu UDP %u", 00145 mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 || 00146 sscanf(sdpLine, "m=%s %hu udp %u", 00147 mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 || 00148 sscanf(sdpLine, "m=%s %hu RAW/RAW/UDP %u", 00149 mediumName, &subsession->fClientPortNum, &payloadFormat) == 3) 00150 && payloadFormat <= 127) { 00151 // This is a RAW UDP source 00152 protocolName = "UDP"; 00153 } else { 00154 // This "m=" line is bad; output an error message saying so: 00155 char* sdpLineStr; 00156 if (nextSDPLine == NULL) { 00157 sdpLineStr = (char*)sdpLine; 00158 } else { 00159 sdpLineStr = strDup(sdpLine); 00160 sdpLineStr[nextSDPLine-sdpLine] = '\0'; 00161 } 00162 envir() << "Bad SDP \"m=\" line: " << sdpLineStr << "\n"; 00163 if (sdpLineStr != (char*)sdpLine) delete[] sdpLineStr; 00164 00165 delete[] mediumName; 00166 delete subsession; 00167 00168 // Skip the following SDP lines, up until the next "m=": 00169 while (1) { 00170 sdpLine = nextSDPLine; 00171 if (sdpLine == NULL) break; // we've reached the end 00172 if (!parseSDPLine(sdpLine, nextSDPLine)) return False; 00173 00174 if (sdpLine[0] == 'm') break; // we've reached the next subsession 00175 } 00176 continue; 00177 } 00178 00179 // Insert this subsession at the end of the list: 00180 if (fSubsessionsTail == NULL) { 00181 fSubsessionsHead = fSubsessionsTail = subsession; 00182 } else { 00183 fSubsessionsTail->setNext(subsession); 00184 fSubsessionsTail = subsession; 00185 } 00186 00187 subsession->serverPortNum = subsession->fClientPortNum; // by default 00188 00189 char const* mStart = sdpLine; 00190 subsession->fSavedSDPLines = strDup(mStart); 00191 00192 subsession->fMediumName = strDup(mediumName); 00193 delete[] mediumName; 00194 subsession->fProtocolName = strDup(protocolName); 00195 subsession->fRTPPayloadFormat = payloadFormat; 00196 00197 // Process the following SDP lines, up until the next "m=": 00198 while (1) { 00199 sdpLine = nextSDPLine; 00200 if (sdpLine == NULL) break; // we've reached the end 00201 if (!parseSDPLine(sdpLine, nextSDPLine)) return False; 00202 00203 if (sdpLine[0] == 'm') break; // we've reached the next subsession 00204 00205 // Check for various special SDP lines that we understand: 00206 if (subsession->parseSDPLine_c(sdpLine)) continue; 00207 if (subsession->parseSDPLine_b(sdpLine)) continue; 00208 if (subsession->parseSDPAttribute_rtpmap(sdpLine)) continue; 00209 if (subsession->parseSDPAttribute_control(sdpLine)) continue; 00210 if (subsession->parseSDPAttribute_range(sdpLine)) continue; 00211 if (subsession->parseSDPAttribute_fmtp(sdpLine)) continue; 00212 if (subsession->parseSDPAttribute_source_filter(sdpLine)) continue; 00213 if (subsession->parseSDPAttribute_x_dimensions(sdpLine)) continue; 00214 if (subsession->parseSDPAttribute_framerate(sdpLine)) continue; 00215 00216 // (Later, check for malformed lines, and other valid SDP lines#####) 00217 } 00218 if (sdpLine != NULL) subsession->fSavedSDPLines[sdpLine-mStart] = '\0'; 00219 00220 // If we don't yet know the codec name, try looking it up from the 00221 // list of static payload types: 00222 if (subsession->fCodecName == NULL) { 00223 subsession->fCodecName 00224 = lookupPayloadFormat(subsession->fRTPPayloadFormat, 00225 subsession->fRTPTimestampFrequency, 00226 subsession->fNumChannels); 00227 if (subsession->fCodecName == NULL) { 00228 char typeStr[20]; 00229 sprintf(typeStr, "%d", subsession->fRTPPayloadFormat); 00230 envir().setResultMsg("Unknown codec name for RTP payload type ", 00231 typeStr); 00232 return False; 00233 } 00234 } 00235 00236 // If we don't yet know this subsession's RTP timestamp frequency 00237 // (because it uses a dynamic payload type and the corresponding 00238 // SDP "rtpmap" attribute erroneously didn't specify it), 00239 // then guess it now: 00240 if (subsession->fRTPTimestampFrequency == 0) { 00241 subsession->fRTPTimestampFrequency 00242 = guessRTPTimestampFrequency(subsession->fMediumName, 00243 subsession->fCodecName); 00244 } 00245 } 00246 00247 return True; 00248 }
| Boolean MediaSession::parseSDPLine | ( | char const * | input, | |
| char const *& | nextLine | |||
| ) | [protected] |
Definition at line 250 of file MediaSession.cpp.
References Medium::envir(), False, NULL, and True.
Referenced by initializeWithSDP().
00251 { 00252 // Begin by finding the start of the next line (if any): 00253 nextLine = NULL; 00254 for (char const* ptr = inputLine; *ptr != '\0'; ++ptr) { 00255 if (*ptr == '\r' || *ptr == '\n') { 00256 // We found the end of the line 00257 ++ptr; 00258 while (*ptr == '\r' || *ptr == '\n') ++ptr; 00259 nextLine = ptr; 00260 if (nextLine[0] == '\0') nextLine = NULL; // special case for end 00261 break; 00262 } 00263 } 00264 00265 // Then, check that this line is a SDP line of the form <char>=<etc> 00266 // (However, we also accept blank lines in the input.) 00267 if (inputLine[0] == '\r' || inputLine[0] == '\n') return True; 00268 if (strlen(inputLine) < 2 || inputLine[1] != '=' 00269 || inputLine[0] < 'a' || inputLine[0] > 'z') { 00270 envir().setResultMsg("Invalid SDP line: ", inputLine); 00271 return False; 00272 } 00273 00274 return True; 00275 }
| Boolean MediaSession::parseSDPLine_s | ( | char const * | sdpLine | ) | [protected] |
Definition at line 289 of file MediaSession.cpp.
References False, fSessionName, strDup(), strDupSize(), and True.
Referenced by initializeWithSDP().
00289 { 00290 // Check for "s=<session name>" line 00291 char* buffer = strDupSize(sdpLine); 00292 Boolean parseSuccess = False; 00293 00294 if (sscanf(sdpLine, "s=%[^\r\n]", buffer) == 1) { 00295 delete[] fSessionName; fSessionName = strDup(buffer); 00296 parseSuccess = True; 00297 } 00298 delete[] buffer; 00299 00300 return parseSuccess; 00301 }
| Boolean MediaSession::parseSDPLine_i | ( | char const * | sdpLine | ) | [protected] |
Definition at line 303 of file MediaSession.cpp.
References False, fSessionDescription, strDup(), strDupSize(), and True.
Referenced by initializeWithSDP().
00303 { 00304 // Check for "i=<session description>" line 00305 char* buffer = strDupSize(sdpLine); 00306 Boolean parseSuccess = False; 00307 00308 if (sscanf(sdpLine, "i=%[^\r\n]", buffer) == 1) { 00309 delete[] fSessionDescription; fSessionDescription = strDup(buffer); 00310 parseSuccess = True; 00311 } 00312 delete[] buffer; 00313 00314 return parseSuccess; 00315 }
| Boolean MediaSession::parseSDPLine_c | ( | char const * | sdpLine | ) | [protected] |
Definition at line 317 of file MediaSession.cpp.
References connectionEndpointName(), False, fConnectionEndpointName, NULL, parseCLine(), and True.
Referenced by initializeWithSDP().
00317 { 00318 // Check for "c=IN IP4 <connection-endpoint>" 00319 // or "c=IN IP4 <connection-endpoint>/<ttl+numAddresses>" 00320 // (Later, do something with <ttl+numAddresses> also #####) 00321 char* connectionEndpointName = parseCLine(sdpLine); 00322 if (connectionEndpointName != NULL) { 00323 delete[] fConnectionEndpointName; 00324 fConnectionEndpointName = connectionEndpointName; 00325 return True; 00326 } 00327 00328 return False; 00329 }
| Boolean MediaSession::parseSDPAttribute_type | ( | char const * | sdpLine | ) | [protected] |
Definition at line 331 of file MediaSession.cpp.
References False, fMediaSessionType, strDup(), strDupSize(), and True.
Referenced by initializeWithSDP().
00331 { 00332 // Check for a "a=type:broadcast|meeting|moderated|test|H.332|recvonly" line: 00333 Boolean parseSuccess = False; 00334 00335 char* buffer = strDupSize(sdpLine); 00336 if (sscanf(sdpLine, "a=type: %[^ ]", buffer) == 1) { 00337 delete[] fMediaSessionType; 00338 fMediaSessionType = strDup(buffer); 00339 parseSuccess = True; 00340 } 00341 delete[] buffer; 00342 00343 return parseSuccess; 00344 }
| Boolean MediaSession::parseSDPAttribute_control | ( | char const * | sdpLine | ) | [protected] |
Definition at line 350 of file MediaSession.cpp.
References controlPath(), False, fControlPath, strDup(), strDupSize(), and True.
Referenced by initializeWithSDP().
00350 { 00351 // Check for a "a=control:<control-path>" line: 00352 Boolean parseSuccess = False; 00353 00354 char* controlPath = strDupSize(sdpLine); // ensures we have enough space 00355 if (sscanf(sdpLine, "a=control: %s", controlPath) == 1) { 00356 parseSuccess = True; 00357 delete[] fControlPath; fControlPath = strDup(controlPath); 00358 } 00359 delete[] controlPath; 00360 00361 return parseSuccess; 00362 }
| Boolean MediaSession::parseSDPAttribute_range | ( | char const * | sdpLine | ) | [protected] |
Definition at line 364 of file MediaSession.cpp.
References False, fMaxPlayEndTime, fMaxPlayStartTime, parseRangeAttribute(), playEndTime(), playStartTime(), and True.
Referenced by initializeWithSDP().
00364 { 00365 // Check for a "a=range:npt=<startTime>-<endTime>" line: 00366 // (Later handle other kinds of "a=range" attributes also???#####) 00367 Boolean parseSuccess = False; 00368 00369 double playStartTime; 00370 double playEndTime; 00371 if (parseRangeAttribute(sdpLine, playStartTime, playEndTime)) { 00372 parseSuccess = True; 00373 if (playStartTime > fMaxPlayStartTime) { 00374 fMaxPlayStartTime = playStartTime; 00375 } 00376 if (playEndTime > fMaxPlayEndTime) { 00377 fMaxPlayEndTime = playEndTime; 00378 } 00379 } 00380 00381 return parseSuccess; 00382 }
| Boolean MediaSession::parseSDPAttribute_source_filter | ( | char const * | sdpLine | ) | [protected] |
Definition at line 413 of file MediaSession.cpp.
References fSourceFilterAddr, and parseSourceFilterAttribute().
Referenced by initializeWithSDP().
00413 { 00414 return parseSourceFilterAttribute(sdpLine, fSourceFilterAddr); 00415 }
| char * MediaSession::lookupPayloadFormat | ( | unsigned char | rtpPayloadType, | |
| unsigned & | rtpTimestampFrequency, | |||
| unsigned & | numChannels | |||
| ) | [static, protected] |
Definition at line 417 of file MediaSession.cpp.
References NULL, and strDup().
Referenced by initializeWithSDP().
00418 { 00419 // Look up the codec name and timestamp frequency for known (static) 00420 // RTP payload formats. 00421 char const* temp = NULL; 00422 switch (rtpPayloadType) { 00423 case 0: {temp = "PCMU"; freq = 8000; nCh = 1; break;} 00424 case 2: {temp = "G726-32"; freq = 8000; nCh = 1; break;} 00425 case 3: {temp = "GSM"; freq = 8000; nCh = 1; break;} 00426 case 4: {temp = "G723"; freq = 8000; nCh = 1; break;} 00427 case 5: {temp = "DVI4"; freq = 8000; nCh = 1; break;} 00428 case 6: {temp = "DVI4"; freq = 16000; nCh = 1; break;} 00429 case 7: {temp = "LPC"; freq = 8000; nCh = 1; break;} 00430 case 8: {temp = "PCMA"; freq = 8000; nCh = 1; break;} 00431 case 9: {temp = "G722"; freq = 8000; nCh = 1; break;} 00432 case 10: {temp = "L16"; freq = 44100; nCh = 2; break;} 00433 case 11: {temp = "L16"; freq = 44100; nCh = 1; break;} 00434 case 12: {temp = "QCELP"; freq = 8000; nCh = 1; break;} 00435 case 14: {temp = "MPA"; freq = 90000; nCh = 1; break;} 00436 // 'number of channels' is actually encoded in the media stream 00437 case 15: {temp = "G728"; freq = 8000; nCh = 1; break;} 00438 case 16: {temp = "DVI4"; freq = 11025; nCh = 1; break;} 00439 case 17: {temp = "DVI4"; freq = 22050; nCh = 1; break;} 00440 case 18: {temp = "G729"; freq = 8000; nCh = 1; break;} 00441 case 25: {temp = "CELB"; freq = 90000; nCh = 1; break;} 00442 case 26: {temp = "JPEG"; freq = 90000; nCh = 1; break;} 00443 case 28: {temp = "NV"; freq = 90000; nCh = 1; break;} 00444 case 31: {temp = "H261"; freq = 90000; nCh = 1; break;} 00445 case 32: {temp = "MPV"; freq = 90000; nCh = 1; break;} 00446 case 33: {temp = "MP2T"; freq = 90000; nCh = 1; break;} 00447 case 34: {temp = "H263"; freq = 90000; nCh = 1; break;} 00448 }; 00449 00450 return strDup(temp); 00451 }
| unsigned MediaSession::guessRTPTimestampFrequency | ( | char const * | mediumName, | |
| char const * | codecName | |||
| ) | [static, protected] |
Definition at line 453 of file MediaSession.cpp.
Referenced by initializeWithSDP().
00454 { 00455 // By default, we assume that audio sessions use a frequency of 8000, 00456 // video sessions use a frequency of 90000, 00457 // and text sessions use a frequency of 1000. 00458 // Begin by checking for known exceptions to this rule 00459 // (where the frequency is known unambiguously (e.g., not like "DVI4")) 00460 if (strcmp(codecName, "L16") == 0) return 44100; 00461 if (strcmp(codecName, "MPA") == 0 00462 || strcmp(codecName, "MPA-ROBUST") == 0 00463 || strcmp(codecName, "X-MP3-DRAFT-00")) return 90000; 00464 00465 // Now, guess default values: 00466 if (strcmp(mediumName, "video") == 0) return 90000; 00467 else if (strcmp(mediumName, "text") == 0) return 1000; 00468 return 8000; // for "audio", and any other medium 00469 }
| Boolean Medium::lookupByName | ( | UsageEnvironment & | env, | |
| char const * | mediumName, | |||
| Medium *& | resultMedium | |||
| ) | [static, inherited] |
Definition at line 41 of file Media.cpp.
References env, False, MediaLookupTable::lookup(), NULL, MediaLookupTable::ourMedia(), UsageEnvironment::setResultMsg(), and True.
Referenced by ServerMediaSession::lookupByName(), RTSPServer::lookupByName(), RTSPClient::lookupByName(), RTCPInstance::lookupByName(), MediaSource::lookupByName(), MediaSink::lookupByName(), lookupByName(), and DarwinInjector::lookupByName().
00042 { 00043 resultMedium = MediaLookupTable::ourMedia(env)->lookup(mediumName); 00044 if (resultMedium == NULL) { 00045 env.setResultMsg("Medium ", mediumName, " does not exist"); 00046 return False; 00047 } 00048 00049 return True; 00050 }
| void Medium::close | ( | UsageEnvironment & | env, | |
| char const * | mediumName | |||
| ) | [static, inherited] |
Definition at line 52 of file Media.cpp.
References env, MediaLookupTable::ourMedia(), and MediaLookupTable::remove().
Referenced by afterPlaying(), Medium::close(), closeMediaSinks(), OnDemandServerMediaSubsession::closeStreamSource(), continueAfterTEARDOWN(), WAVAudioFileSource::createNew(), QuickTimeFileSink::createNew(), QCELPAudioRTPSource::createNew(), MP3HTTPSource::createNew(), MP3FileSource::createNew(), AVIFileSink::createNew(), AMRAudioRTPSource::createNew(), WAVAudioFileServerMediaSubsession::createNewStreamSource(), MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource(), MediaSubsession::deInitiate(), RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming::handleHTTPCmd_StreamingGET(), MediaSubsession::initiate(), MPEG1or2ProgramStreamFileDuration(), MPEG1or2Demux::noteElementaryStreamDeletion(), ByteStreamMultiFileSource::onSourceClosure1(), StreamState::reclaim(), RTSPServer::removeServerMediaSession(), OnDemandServerMediaSubsession::sdpLines(), shutdownStream(), T140TextRTPSink::stopPlaying(), H264VideoRTPSink::stopPlaying(), subsessionAfterPlaying(), ClientTrickPlayState::updateStateOnScaleChange(), AMRDeinterleaver::~AMRDeinterleaver(), ByteStreamMultiFileSource::~ByteStreamMultiFileSource(), DarwinInjector::~DarwinInjector(), FramedFilter::~FramedFilter(), InputESSourceRecord::~InputESSourceRecord(), MatroskaFileParser::~MatroskaFileParser(), MatroskaFileServerDemux::~MatroskaFileServerDemux(), MPEG1or2Demux::~MPEG1or2Demux(), MPEG1or2FileServerDemux::~MPEG1or2FileServerDemux(), MPEG2TransportFileServerMediaSubsession::~MPEG2TransportFileServerMediaSubsession(), MPEG2TransportStreamFromPESSource::~MPEG2TransportStreamFromPESSource(), RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming::~RTSPClientSessionSupportingHTTPStreaming(), ServerMediaSession::~ServerMediaSession(), ServerMediaSubsession::~ServerMediaSubsession(), StreamClientState::~StreamClientState(), and StreamReplicator::~StreamReplicator().
00052 { 00053 MediaLookupTable::ourMedia(env)->remove(name); 00054 }
| void Medium::close | ( | Medium * | medium | ) | [static, inherited] |
Definition at line 56 of file Media.cpp.
References Medium::close(), Medium::envir(), Medium::name(), and NULL.
00056 { 00057 if (medium == NULL) return; 00058 00059 close(medium->envir(), medium->name()); 00060 }
| UsageEnvironment& Medium::envir | ( | ) | const [inline, inherited] |
Definition at line 59 of file Media.hh.
References Medium::fEnviron.
Referenced by QuickTimeFileSink::addArbitraryString(), FileSink::addData(), RTCPInstance::addStreamSocket(), MPEG2IFrameIndexFromTransportStream::addToTail(), StreamParser::afterGettingBytes1(), DummySink::afterGettingFrame(), T140IdleFilter::afterGettingFrame(), MultiFramedRTPSink::afterGettingFrame1(), InputESSourceRecord::afterGettingFrame1(), MPEG2TransportStreamFramer::afterGettingFrame1(), MPEG2IFrameIndexFromTransportStream::afterGettingFrame1(), H264VideoStreamDiscreteFramer::afterGettingFrame1(), BasicUDPSink::afterGettingFrame1(), MPEG4VideoFileServerMediaSubsession::afterPlayingDummy1(), H264VideoFileServerMediaSubsession::afterPlayingDummy1(), MPEG4VideoStreamParser::analyzeVOLHeader(), announceStream(), RTSPServer::RTSPClientSession::changeClientInputSocket(), MPEG4VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H264VideoFileServerMediaSubsession::checkForAuxSDPLine1(), Medium::close(), MPEG2IFrameIndexFromTransportStream::compactParseBuffer(), RTSPClient::connectionHandler1(), RTSPClient::connectToServer(), T140TextRTPSink::continuePlaying(), QuickTimeFileSink::continuePlaying(), H264VideoRTPSink::continuePlaying(), AVIFileSink::continuePlaying(), VP8VideoMatroskaFileServerMediaSubsession::createNewRTPSink(), VorbisAudioMatroskaFileServerMediaSubsession::createNewRTPSink(), T140TextMatroskaFileServerMediaSubsession::createNewRTPSink(), MPEG4VideoFileServerMediaSubsession::createNewRTPSink(), MPEG2TransportUDPServerMediaSubsession::createNewRTPSink(), MPEG2TransportFileServerMediaSubsession::createNewRTPSink(), MPEG1or2VideoFileServerMediaSubsession::createNewRTPSink(), MPEG1or2DemuxedServerMediaSubsession::createNewRTPSink(), MP3AudioFileServerMediaSubsession::createNewRTPSink(), H264VideoFileServerMediaSubsession::createNewRTPSink(), H263plusVideoFileServerMediaSubsession::createNewRTPSink(), DVVideoFileServerMediaSubsession::createNewRTPSink(), AMRAudioFileServerMediaSubsession::createNewRTPSink(), ADTSAudioFileServerMediaSubsession::createNewRTPSink(), AC3AudioMatroskaFileServerMediaSubsession::createNewRTPSink(), AC3AudioFileServerMediaSubsession::createNewRTPSink(), AACAudioMatroskaFileServerMediaSubsession::createNewRTPSink(), MPEG4VideoFileServerMediaSubsession::createNewStreamSource(), MPEG2TransportUDPServerMediaSubsession::createNewStreamSource(), MPEG2TransportFileServerMediaSubsession::createNewStreamSource(), MPEG1or2VideoFileServerMediaSubsession::createNewStreamSource(), MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource(), MP3AudioFileServerMediaSubsession::createNewStreamSource(), H264VideoMatroskaFileServerMediaSubsession::createNewStreamSource(), H264VideoFileServerMediaSubsession::createNewStreamSource(), H263plusVideoFileServerMediaSubsession::createNewStreamSource(), DVVideoFileServerMediaSubsession::createNewStreamSource(), AMRAudioFileServerMediaSubsession::createNewStreamSource(), ADTSAudioFileServerMediaSubsession::createNewStreamSource(), AC3AudioFileServerMediaSubsession::createNewStreamSource(), AMRDeinterleavingBuffer::deliverIncomingFrame(), MPEG2IFrameIndexFromTransportStream::deliverIndexRecord(), SegmentQueue::dequeue(), DeviceSource::DeviceSource(), WAVAudioFileSource::doGetNextFrame(), T140IdleFilter::doGetNextFrame(), MPEG2IFrameIndexFromTransportStream::doGetNextFrame(), MP3FileSource::doGetNextFrame(), H264FUAFragmenter::doGetNextFrame(), ByteStreamMultiFileSource::doGetNextFrame(), ByteStreamFileSource::doGetNextFrame(), BasicUDPSource::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), MultiFramedRTPSource::doGetNextFrame1(), MP3FileSource::doGetNextFrame1(), ADUFromMP3Source::doGetNextFrame1(), SIPClient::doInviteStateMachine(), ByteStreamFileSource::doReadFromFile(), MPEG1or2VideoRTPSink::doSpecialFrameHandling(), MP3ADURTPSink::doSpecialFrameHandling(), H263plusVideoRTPSink::doSpecialFrameHandling(), T140IdleFilter::doStopGettingFrames(), ByteStreamFileSource::doStopGettingFrames(), BasicUDPSource::doStopGettingFrames(), SegmentQueue::enqueueNewSegment(), StreamParser::ensureValidBytes1(), MediaSubsession::env(), SubsessionIOState::envir(), RTSPServer::RTSPClientSession::envir(), RTPInterface::envir(), AVISubsessionIOState::envir(), ServerMediaSession::generateSDPDescription(), RTPSource::getAttributes(), MP3FileSource::getAttributes(), MP3ADUTranscoder::getAttributes(), MediaSource::getAttributes(), MPEG4VideoFileServerMediaSubsession::getAuxSDPLine(), H264VideoFileServerMediaSubsession::getAuxSDPLine(), getMPEG1or2TimeCode(), FramedSource::getNextFrame(), getOptions(), DVVideoStreamFramer::getProfile(), SIPClient::getResponse(), SIPClient::getResponseCode(), getSDPDescription(), OnDemandServerMediaSubsession::getStreamParameters(), RTSPClient::handleGET_PARAMETERResponse(), RTSPServerSupportingHTTPStreaming::RTSPClientSessionSupportingHTTPStreaming::handleHTTPCmd_StreamingGET(), RTSPClient::handleIncomingRequest(), RTSPClient::handlePLAYResponse(), RTSPClient::handleRequestError(), RTSPClient::handleResponseBytes(), RTSPClient::handleSETUPResponse(), RTSPServer::incomingConnectionHandler(), RTSPClient::incomingDataHandler1(), RTCPInstance::incomingReportHandler1(), MP3FileSource::initializeStream(), initializeWithSDP(), initiateByMediaType(), SIPClient::invite1(), DynamicRTSPServer::lookupServerMediaSession(), MatroskaDemux::MatroskaDemux(), MatroskaFile::MatroskaFile(), MPEG4GenericRTPSource::MPEG4GenericRTPSource(), MatroskaDemux::newDemuxedTrack(), MPEG1or2FileServerDemux::newElementaryStream(), MPEG1or2Demux::newElementaryStream(), MPEG4GenericBufferedPacket::nextEnclosedFrameSize(), AMRBufferedPacket::nextEnclosedFrameSize(), RTSPClient::openConnection(), MPEG2TransportStreamIndexFile::openFid(), MPEG2IFrameIndexFromTransportStream::parseFrame(), AC3AudioStreamParser::parseFrame(), MPEGProgramStreamParser::parsePackHeader(), MPEGProgramStreamParser::parsePESPacket(), SIPClient::parseResponseCode(), parseSDPLine(), MPEG1or2VideoStreamParser::parseSlice(), MatroskaFileParser::parseStartOfFile(), MPEGProgramStreamParser::parseSystemHeader(), MPEG4VideoStreamParser::parseVideoObjectLayer(), MPEG4VideoStreamParser::parseVideoObjectPlane(), MPEG4VideoStreamParser::parseVisualObject(), TCPStreamSink::processBuffer(), SIPClient::processURL(), AC3AudioStreamParser::readAndSaveAFrame(), MPEG1or2Demux::registerReadInterest(), RTCPInstance::reschedule(), RTSPClient::resendCommand(), RTSPClient::resetTCPSockets(), RTSPClient::responseHandlerForHTTP_GET1(), RTSPServer::rtspURLPrefix(), RTCPInstance::schedule(), OnDemandServerMediaSubsession::sdpLines(), SIPClient::sendACK(), SIPClient::sendBYE(), SIPClient::sendINVITE(), MultiFramedRTPSink::sendPacketIfNecessary(), SIPClient::sendRequest(), RTSPClient::sendRequest(), DarwinInjector::setDestination(), RTSPClient::setupHTTPTunneling1(), setupNextSubsession(), RTSPServer::setUpTunnelingOverHTTP(), QuickTimeFileSink::setWord(), AVIFileSink::setWord(), QuickTimeFileSink::setWord64(), shutdownStream(), SIPClient::SIPClient(), TCPStreamSink::socketWritableHandler1(), AMRAudioRTPSink::sourceIsCompatibleWithUs(), QuickTimeFileSink::startPlaying(), StreamState::startPlaying(), MediaSink::startPlaying(), AVIFileSink::startPlaying(), startPlayingSession(), PassiveServerMediaSubsession::startStream(), MediaSink::stopPlaying(), tearDownSession(), SIPClient::timerAHandler(), SIPClient::timerBHandler(), SIPClient::timerDHandler(), ClientTrickPlayState::updateStateOnScaleChange(), MPEG2TransportStreamFramer::updateTSPacketDurationEstimate(), BasicUDPSource::~BasicUDPSource(), ByteStreamFileSource::~ByteStreamFileSource(), DeviceSource::~DeviceSource(), RTSPServer::~RTSPServer(), StreamClientState::~StreamClientState(), and T140IdleFilter::~T140IdleFilter().
00059 {return fEnviron;}
| char const* Medium::name | ( | ) | const [inline, inherited] |
Definition at line 61 of file Media.hh.
References Medium::fMediumName.
Referenced by QuickTimeFileSink::addAtom_hdlr2(), Medium::close(), MP3ADUTranscoder::createNew(), MP3FromADUSource::createNew(), ADUFromMP3Source::createNew(), and MP3FileSource::initializeStream().
00061 {return fMediumName;}
| Boolean Medium::isSource | ( | ) | const [virtual, inherited] |
Reimplemented in MediaSource.
Definition at line 62 of file Media.cpp.
References False.
Referenced by MediaSource::lookupByName().
00062 { 00063 return False; // default implementation 00064 }
| Boolean Medium::isSink | ( | ) | const [virtual, inherited] |
| Boolean Medium::isRTCPInstance | ( | ) | const [virtual, inherited] |
Reimplemented in RTCPInstance.
Definition at line 70 of file Media.cpp.
References False.
Referenced by RTCPInstance::lookupByName().
00070 { 00071 return False; // default implementation 00072 }
| Boolean Medium::isRTSPClient | ( | ) | const [virtual, inherited] |
Reimplemented in RTSPClient.
Definition at line 74 of file Media.cpp.
References False.
Referenced by RTSPClient::lookupByName().
00074 { 00075 return False; // default implementation 00076 }
| Boolean Medium::isRTSPServer | ( | ) | const [virtual, inherited] |
Reimplemented in RTSPServer.
Definition at line 78 of file Media.cpp.
References False.
Referenced by RTSPServer::lookupByName().
00078 { 00079 return False; // default implementation 00080 }
| Boolean Medium::isServerMediaSession | ( | ) | const [virtual, inherited] |
Reimplemented in ServerMediaSession.
Definition at line 86 of file Media.cpp.
References False.
Referenced by ServerMediaSession::lookupByName().
00086 { 00087 return False; // default implementation 00088 }
| Boolean Medium::isDarwinInjector | ( | ) | const [virtual, inherited] |
Reimplemented in DarwinInjector.
Definition at line 90 of file Media.cpp.
References False.
Referenced by DarwinInjector::lookupByName().
00090 { 00091 return False; // default implementation 00092 }
| TaskToken& Medium::nextTask | ( | ) | [inline, protected, inherited] |
Definition at line 78 of file Media.hh.
References Medium::fNextTask.
Referenced by BasicUDPSink::afterGettingFrame1(), MPEG4VideoFileServerMediaSubsession::afterPlayingDummy1(), H264VideoFileServerMediaSubsession::afterPlayingDummy1(), MPEG4VideoFileServerMediaSubsession::checkForAuxSDPLine1(), H264VideoFileServerMediaSubsession::checkForAuxSDPLine1(), WAVAudioFileSource::doGetNextFrame(), MP3FileSource::doGetNextFrame(), AMRAudioFileSource::doGetNextFrame(), ADTSAudioFileSource::doGetNextFrame(), MultiFramedRTPSource::doGetNextFrame1(), ByteStreamFileSource::doReadFromFile(), RTCPInstance::reschedule(), RTCPInstance::schedule(), MultiFramedRTPSink::sendPacketIfNecessary(), and MediaSink::stopPlaying().
00078 { 00079 return fNextTask; 00080 }
friend class MediaSubsessionIterator [friend] |
Definition at line 108 of file MediaSession.hh.
friend class MediaLookupTable [friend, inherited] |
char* MediaSession::fCNAME [protected] |
Definition at line 109 of file MediaSession.hh.
Referenced by CNAME(), MediaSession(), and ~MediaSession().
MediaSubsession* MediaSession::fSubsessionsHead [protected] |
Definition at line 112 of file MediaSession.hh.
Referenced by hasSubsessions(), initializeWithSDP(), MediaSubsessionIterator::reset(), and ~MediaSession().
MediaSubsession* MediaSession::fSubsessionsTail [protected] |
char* MediaSession::fConnectionEndpointName [protected] |
Definition at line 116 of file MediaSession.hh.
Referenced by connectionEndpointName(), parseSDPLine_c(), and ~MediaSession().
double MediaSession::fMaxPlayStartTime [protected] |
Definition at line 117 of file MediaSession.hh.
Referenced by parseSDPAttribute_range(), and playStartTime().
double MediaSession::fMaxPlayEndTime [protected] |
Definition at line 118 of file MediaSession.hh.
Referenced by parseSDPAttribute_range(), and playEndTime().
struct in_addr MediaSession::fSourceFilterAddr [read, protected] |
Definition at line 119 of file MediaSession.hh.
Referenced by MediaSession(), parseSDPAttribute_source_filter(), and sourceFilterAddr().
float MediaSession::fScale [protected] |
char* MediaSession::fMediaSessionType [protected] |
Definition at line 121 of file MediaSession.hh.
Referenced by mediaSessionType(), parseSDPAttribute_type(), and ~MediaSession().
char* MediaSession::fSessionName [protected] |
Definition at line 122 of file MediaSession.hh.
Referenced by parseSDPLine_s(), sessionName(), and ~MediaSession().
char* MediaSession::fSessionDescription [protected] |
Definition at line 123 of file MediaSession.hh.
Referenced by parseSDPLine_i(), sessionDescription(), and ~MediaSession().
char* MediaSession::fControlPath [protected] |
Definition at line 124 of file MediaSession.hh.
Referenced by controlPath(), parseSDPAttribute_control(), and ~MediaSession().
1.5.2