Commit 295d44df authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: use property template for seglist duration

parent 83a72ce8
......@@ -32,26 +32,15 @@ using namespace adaptative::playlist;
SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) :
ICanonicalUrl( parent ), Initializable(), Indexable(),
duration( 0 ),
startIndex( 0 )
{
duration.Set(0);
}
SegmentInfoCommon::~SegmentInfoCommon()
{
}
time_t SegmentInfoCommon::getDuration() const
{
return this->duration;
}
void SegmentInfoCommon::setDuration( time_t duration )
{
if ( duration >= 0 )
this->duration = duration;
}
int SegmentInfoCommon::getStartIndex() const
{
return this->startIndex;
......
......@@ -46,15 +46,13 @@ namespace adaptative
public:
SegmentInfoCommon( ICanonicalUrl *parent = NULL );
virtual ~SegmentInfoCommon();
time_t getDuration() const;
void setDuration( time_t duration );
int getStartIndex() const;
void setStartIndex( int startIndex );
void appendBaseURL( const std::string& url );
virtual Url getUrlSegment() const; /* impl */
Property<uint64_t> duration;
private:
time_t duration;
int startIndex;
std::list<std::string> baseURLs;
};
......
......@@ -183,7 +183,7 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
else if ( (segList = inheritSegmentList()) )
{
timescale = segList->inheritTimescale();
duration = segList->getDuration();
duration = segList->duration.Get();
}
if(duration)
......@@ -217,7 +217,7 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
else if ( (segList = inheritSegmentList()) )
{
timescale = segList->inheritTimescale();
time = number * segList->getDuration();
time = number * segList->duration.Get();
}
if(time)
......
......@@ -298,7 +298,7 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);
if(segListNode->hasAttribute("duration"))
list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
list->duration.Set(Integer<uint64_t>(segListNode->getAttributeValue("duration")));
if(segListNode->hasAttribute("timescale"))
list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale")));
......@@ -323,10 +323,10 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
}
if(totaltime || list->getDuration())
if(totaltime || list->duration.Get())
{
seg->startTime.Set(totaltime);
totaltime += list->getDuration();
totaltime += list->duration.Get();
}
list->addSegment(seg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment