本文整理汇总了C++中MediaSubsession::parseSDPAttribute_source_filter方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaSubsession::parseSDPAttribute_source_filter方法的具体用法?C++ MediaSubsession::parseSDPAttribute_source_filter怎么用?C++ MediaSubsession::parseSDPAttribute_source_filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaSubsession
的用法示例。
在下文中一共展示了MediaSubsession::parseSDPAttribute_source_filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeWithSDP
Boolean MediaSession::initializeWithSDP(char const* sdpDescription) {
if (sdpDescription == NULL) return False;
// Begin by processing all SDP lines until we see the first "m="
char const* sdpLine = sdpDescription;
char const* nextSDPLine;
while (1) {
if (!parseSDPLine(sdpLine, nextSDPLine)) return False;
//##### We should really check for:
// - "a=control:" attributes (to set the URL for aggregate control)
// - the correct SDP version (v=0)
if (sdpLine[0] == 'm') break;
sdpLine = nextSDPLine;
if (sdpLine == NULL) break; // there are no m= lines at all
// Check for various special SDP lines that we understand:
if (parseSDPLine_s(sdpLine)) continue;
if (parseSDPLine_i(sdpLine)) continue;
if (parseSDPLine_c(sdpLine)) continue;
if (parseSDPAttribute_control(sdpLine)) continue;
if (parseSDPAttribute_range(sdpLine)) continue;
if (parseSDPAttribute_type(sdpLine)) continue;
if (parseSDPAttribute_source_filter(sdpLine)) continue;
#ifdef SUPPORT_REAL_RTSP
if (RealParseSDPAttributes(this, sdpLine)) continue;
#endif
}
while (sdpLine != NULL) {
// We have a "m=" line, representing a new sub-session:
MediaSubsession* subsession = new MediaSubsession(*this);
if (subsession == NULL) {
envir().setResultMsg("Unable to create new MediaSubsession");
return False;
}
// Parse the line as "m=<medium_name> <client_portNum> RTP/AVP <fmt>"
// or "m=<medium_name> <client_portNum>/<num_ports> RTP/AVP <fmt>"
// (Should we be checking for >1 payload format number here?)#####
char* mediumName = strDupSize(sdpLine); // ensures we have enough space
char* protocolName = NULL;
unsigned payloadFormat;
if ((sscanf(sdpLine, "m=%s %hu RTP/AVP %u",
mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 ||
sscanf(sdpLine, "m=%s %hu/%*u RTP/AVP %u",
mediumName, &subsession->fClientPortNum, &payloadFormat) == 3)
&& payloadFormat <= 127) {
protocolName = "RTP";
} else if ((sscanf(sdpLine, "m=%s %hu UDP %u",
mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 ||
sscanf(sdpLine, "m=%s %hu udp %u",
mediumName, &subsession->fClientPortNum, &payloadFormat) == 3 ||
sscanf(sdpLine, "m=%s %hu RAW/RAW/UDP %u",
mediumName, &subsession->fClientPortNum, &payloadFormat) == 3)
&& payloadFormat <= 127) {
// This is a RAW UDP source
protocolName = "UDP";
} else {
// This "m=" line is bad; output an error message saying so:
char* sdpLineStr;
if (nextSDPLine == NULL) {
sdpLineStr = (char*)sdpLine;
} else {
sdpLineStr = strDup(sdpLine);
sdpLineStr[nextSDPLine-sdpLine] = '\0';
}
envir() << "Bad SDP \"m=\" line: " << sdpLineStr << "\n";
if (sdpLineStr != (char*)sdpLine) delete[] sdpLineStr;
delete[] mediumName;
delete subsession;
// Skip the following SDP lines, up until the next "m=":
while (1) {
sdpLine = nextSDPLine;
if (sdpLine == NULL) break; // we've reached the end
if (!parseSDPLine(sdpLine, nextSDPLine)) return False;
if (sdpLine[0] == 'm') break; // we've reached the next subsession
}
continue;
}
// Insert this subsession at the end of the list:
if (fSubsessionsTail == NULL) {
fSubsessionsHead = fSubsessionsTail = subsession;
} else {
fSubsessionsTail->setNext(subsession);
fSubsessionsTail = subsession;
}
subsession->serverPortNum = subsession->fClientPortNum; // by default
char const* mStart = sdpLine;
subsession->fSavedSDPLines = strDup(mStart);
subsession->fMediumName = strDup(mediumName);
delete[] mediumName;
subsession->fProtocolName = strDup(protocolName);
subsession->fRTPPayloadFormat = payloadFormat;
//.........这里部分代码省略.........