本文整理汇总了C++中NamedList::length方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedList::length方法的具体用法?C++ NamedList::length怎么用?C++ NamedList::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedList
的用法示例。
在下文中一共展示了NamedList::length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putNamedList
// Append all paramters from one named list to another, inserting keys prefix
static void putNamedList(NamedList& dst, const NamedList& src, String prefix)
{
unsigned int n = src.length();
for (unsigned int i = 0; i < n; i++) {
const NamedString* param = src.getParam(i);
if (param)
dst.addParam(prefix + param->name(),*param);
}
}
示例2: updateSDP
// Update from parameters. Build a default SDP if no media is found in params
bool SDPSession::updateSDP(const NamedList& params)
{
DDebug(m_parser,DebugAll,"SDPSession::updateSdp('%s') [%p]",params.c_str(),this);
bool defaults = true;
const char* sdpPrefix = params.getValue("osdp-prefix","osdp");
ObjList* lst = 0;
unsigned int n = params.length();
String defFormats;
m_parser->getAudioFormats(defFormats);
for (unsigned int i = 0; i < n; i++) {
const NamedString* p = params.getParam(i);
if (!p)
continue;
// search for rtp_port or rtp_port_MEDIANAME parameters
String tmp(p->name());
if (!tmp.startSkip("media",false))
continue;
if (tmp && (tmp[0] != '_'))
continue;
// since we found at least one media declaration disable defaults
defaults = false;
// now tmp holds the suffix for the media, null for audio
bool audio = tmp.null();
// check if media is supported, default only for audio
if (!p->toBoolean(audio))
continue;
String fmts = params.getValue("formats" + tmp);
if (audio && fmts.null())
fmts = defFormats;
if (fmts.null())
continue;
String trans = params.getValue("transport" + tmp,"RTP/AVP");
String crypto;
if (m_secure)
crypto = params.getValue("crypto" + tmp);
if (audio)
tmp = "audio";
else
tmp >> "_";
SDPMedia* rtp = 0;
// try to take the media descriptor from the old list
if (m_rtpMedia) {
ObjList* om = m_rtpMedia->find(tmp);
if (om)
rtp = static_cast<SDPMedia*>(om->remove(false));
}
bool append = false;
if (rtp)
rtp->update(fmts);
else {
rtp = new SDPMedia(tmp,trans,fmts);
append = true;
}
rtp->crypto(crypto,false);
if (sdpPrefix) {
for (unsigned int j = 0; j < n; j++) {
const NamedString* param = params.getParam(j);
if (!param)
continue;
tmp = param->name();
if (tmp.startSkip(sdpPrefix + rtp->suffix() + "_",false) && (tmp.find('_') < 0))
rtp->parameter(tmp,*param,append);
}
}
if (!lst)
lst = new ObjList;
lst->append(rtp);
}
if (defaults && !lst) {
lst = new ObjList;
lst->append(new SDPMedia("audio","RTP/AVP",params.getValue("formats",defFormats)));
}
return setMedia(lst);
}