本文整理汇总了C++中SegmentList::getDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ SegmentList::getDuration方法的具体用法?C++ SegmentList::getDuration怎么用?C++ SegmentList::getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SegmentList
的用法示例。
在下文中一共展示了SegmentList::getDuration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseSegmentList
size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation *info)
{
size_t total = 0;
mtime_t totaltime = 0;
if(segListNode)
{
std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);
SegmentList *list;
if((list = new (std::nothrow) SegmentList()))
{
parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);
if(segListNode->hasAttribute("duration"))
list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
if(segListNode->hasAttribute("timescale"))
list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale")));
std::vector<Node *>::const_iterator it;
for(it = segments.begin(); it != segments.end(); ++it)
{
Node *segmentURL = *it;
std::string mediaUrl = segmentURL->getAttributeValue("media");
if(mediaUrl.empty())
continue;
Segment *seg = new (std::nothrow) Segment(info);
if(!seg)
continue;
seg->setSourceUrl(segmentURL->getAttributeValue("media"));
if(segmentURL->hasAttribute("mediaRange"))
{
std::string range = segmentURL->getAttributeValue("mediaRange");
size_t pos = range.find("-");
seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
}
if(totaltime || list->getDuration())
{
seg->startTime.Set(totaltime);
totaltime += list->getDuration();
}
list->addSegment(seg);
total++;
}
info->setSegmentList(list);
}
}
return total;
}
示例2: getPlaybackTimeBySegmentNumber
mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) const
{
SegmentList *segList;
MediaSegmentTemplate *mediaTemplate;
uint64_t timescale = 1;
mtime_t time = 0;
if( (mediaTemplate = inheritSegmentTemplate()) )
{
timescale = mediaTemplate->inheritTimescale();
if(mediaTemplate->segmentTimeline.Get())
{
time = mediaTemplate->segmentTimeline.Get()->
getScaledPlaybackTimeByElementNumber(number);
}
else
{
time = number * mediaTemplate->duration.Get();
}
}
else if ( (segList = inheritSegmentList()) )
{
timescale = segList->inheritTimescale();
time = number * segList->getDuration();
}
if(time)
time = CLOCK_FREQ * time / timescale;
return time;
}
示例3: getSegmentNumberByTime
bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) const
{
SegmentList *segList;
MediaSegmentTemplate *mediaTemplate;
uint64_t timescale = 1;
mtime_t duration = 0;
if( (mediaTemplate = inheritSegmentTemplate()) )
{
timescale = mediaTemplate->inheritTimescale();
duration = mediaTemplate->duration.Get();
}
else if ( (segList = inheritSegmentList()) )
{
timescale = segList->inheritTimescale();
duration = segList->getDuration();
}
if(duration)
{
*ret = time / (CLOCK_FREQ * duration / timescale);
return true;
}
return false;
}