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; ...@@ -32,26 +32,15 @@ using namespace adaptative::playlist;
SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) : SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) :
ICanonicalUrl( parent ), Initializable(), Indexable(), ICanonicalUrl( parent ), Initializable(), Indexable(),
duration( 0 ),
startIndex( 0 ) startIndex( 0 )
{ {
duration.Set(0);
} }
SegmentInfoCommon::~SegmentInfoCommon() 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 int SegmentInfoCommon::getStartIndex() const
{ {
return this->startIndex; return this->startIndex;
......
...@@ -46,15 +46,13 @@ namespace adaptative ...@@ -46,15 +46,13 @@ namespace adaptative
public: public:
SegmentInfoCommon( ICanonicalUrl *parent = NULL ); SegmentInfoCommon( ICanonicalUrl *parent = NULL );
virtual ~SegmentInfoCommon(); virtual ~SegmentInfoCommon();
time_t getDuration() const;
void setDuration( time_t duration );
int getStartIndex() const; int getStartIndex() const;
void setStartIndex( int startIndex ); void setStartIndex( int startIndex );
void appendBaseURL( const std::string& url ); void appendBaseURL( const std::string& url );
virtual Url getUrlSegment() const; /* impl */ virtual Url getUrlSegment() const; /* impl */
Property<uint64_t> duration;
private: private:
time_t duration;
int startIndex; int startIndex;
std::list<std::string> baseURLs; std::list<std::string> baseURLs;
}; };
......
...@@ -183,7 +183,7 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con ...@@ -183,7 +183,7 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
else if ( (segList = inheritSegmentList()) ) else if ( (segList = inheritSegmentList()) )
{ {
timescale = segList->inheritTimescale(); timescale = segList->inheritTimescale();
duration = segList->getDuration(); duration = segList->duration.Get();
} }
if(duration) if(duration)
...@@ -217,7 +217,7 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons ...@@ -217,7 +217,7 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
else if ( (segList = inheritSegmentList()) ) else if ( (segList = inheritSegmentList()) )
{ {
timescale = segList->inheritTimescale(); timescale = segList->inheritTimescale();
time = number * segList->getDuration(); time = number * segList->duration.Get();
} }
if(time) if(time)
......
...@@ -298,7 +298,7 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation ...@@ -298,7 +298,7 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info); parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);
if(segListNode->hasAttribute("duration")) 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")) if(segListNode->hasAttribute("timescale"))
list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale"))); list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale")));
...@@ -323,10 +323,10 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation ...@@ -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())); 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); seg->startTime.Set(totaltime);
totaltime += list->getDuration(); totaltime += list->duration.Get();
} }
list->addSegment(seg); 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