本文整理汇总了C++中Media::removeMember方法的典型用法代码示例。如果您正苦于以下问题:C++ Media::removeMember方法的具体用法?C++ Media::removeMember怎么用?C++ Media::removeMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::removeMember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSampleRange
bool SampleService::getSampleRange(Media& media)
{
bool rval = false;
// FIXME: change cache to just store sample range array? not entire media?
// keep in mind that the code currently uses other information from
// the media like the performer and title for the sample id3v2 tags
// check with cache
bool found = false;
mSampleRangeCacheLock.lock();
{
if(mSampleRangeCache["cache"]->hasMember(media["id"]->getString()))
{
media = mSampleRangeCache["cache"][media["id"]->getString()];
rval = found = true;
}
}
mSampleRangeCacheLock.unlock();
if(!found)
{
// get sample range for media from bitmunk
Url url;
url.format("/api/3.0/media/%" PRIu64, BM_MEDIA_ID(media["id"]));
StringTokenizer st;
if((rval = mNode->getMessenger()->getFromBitmunk(&url, media)))
{
// validate sample range
st.tokenize(media["sampleRange"]->getString(), '-');
if((rval = (st.getTokenCount() == 2)))
{
// set sample range start and end
media["sampleRange"][0] =
(uint32_t)strtoul(st.nextToken(), NULL, 10);
media["sampleRange"][1] =
(uint32_t)strtoul(st.nextToken(), NULL, 10);
// update media length to use sample length
int sampleLength =
media["sampleRange"][1]->getUInt32() -
media["sampleRange"][0]->getUInt32();
media["length"] = sampleLength;
// update media title to include "- Bitmunk Sample"
string title = media["title"]->getString();
title.append(" - Bitmunk Sample");
media["title"] = title.c_str();
// update cache
mSampleRangeCacheLock.lock();
{
if(mSampleRangeCache["cache"]->length() + 1 >=
mSampleRangeCache["capacity"]->getInt32())
{
// clear cache, capacity reached
mSampleRangeCache->clear();
}
mSampleRangeCache["cache"][media["id"]->getString()] = media;
}
mSampleRangeCacheLock.unlock();
}
else
{
// no sample range available
media["sampleRange"][0] = 0;
media["sampleRange"][1] = 0;
}
// clear any sample content-length
media->removeMember("sampleContentLength");
}
}
return rval;
}