Commit eb2d6145 authored by François Cartegnie's avatar François Cartegnie 🤞

stream_filter: dash: always get segments through representation

parent 80706d97
......@@ -80,7 +80,7 @@ void AlwaysBestAdaptationLogic::initSchedule ()
if(best != NULL)
{
std::vector<Segment *> segments = this->mpdManager->getSegments(best);
std::vector<Segment *> segments = best->getSegments();
for(size_t j = 0; j < segments.size(); j++)
{
this->schedule.push_back(segments.at(j));
......
......@@ -62,7 +62,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk()
if ( rep == NULL )
return NULL;
std::vector<Segment *> segments = this->mpdManager->getSegments(rep);
std::vector<Segment *> segments = rep->getSegments();
if ( this->count == segments.size() )
{
......
......@@ -35,19 +35,6 @@ BasicCMManager::BasicCMManager(MPD *mpd) :
}
std::vector<Segment*> BasicCMManager::getSegments( const Representation *rep )
{
std::vector<Segment *> retSegments;
SegmentInfo* info = rep->getSegmentInfo();
Segment* initSegment = info->getInitialisationSegment();
if ( initSegment )
retSegments.push_back( initSegment );
retSegments.insert( retSegments.end(), info->getSegments().begin(),
info->getSegments().end() );
return retSegments;
}
Representation* BasicCMManager::getRepresentation (Period *period, uint64_t bitrate, int, int ) const
{
return IMPDManager::getRepresentation(period, bitrate);
......
......@@ -42,7 +42,6 @@ namespace dash
public:
BasicCMManager (MPD *mpd);
std::vector<Segment *> getSegments( const Representation *rep );
Representation* getRepresentation (Period *period, uint64_t bitrate,
int width, int height) const;
};
......
......@@ -43,7 +43,6 @@ namespace dash
virtual Period* getFirstPeriod () const;
virtual Period* getNextPeriod (Period *period);
virtual Representation* getBestRepresentation (Period *period) const;
virtual std::vector<Segment *> getSegments (const Representation *rep) = 0;
virtual Representation* getRepresentation (Period *period, uint64_t bitrate) const;
virtual const MPD* getMPD () const;
virtual Representation* getRepresentation (Period *period, uint64_t bitrate,
......
......@@ -36,24 +36,6 @@ IsoffMainManager::IsoffMainManager(MPD *mpd) :
}
std::vector<Segment*> IsoffMainManager::getSegments (const Representation *rep)
{
std::vector<Segment *> retSegments;
SegmentList* list= rep->getSegmentList();
if(rep->getSegmentBase())
{
Segment* initSegment = rep->getSegmentBase()->getInitSegment();
if(initSegment)
retSegments.push_back(initSegment);
}
if ( list )
retSegments.insert(retSegments.end(), list->getSegments().begin(), list->getSegments().end());
return retSegments;
}
Representation* IsoffMainManager::getRepresentation (Period *period, uint64_t bitrate, int width, int height) const
{
if(period == NULL)
......
......@@ -43,7 +43,6 @@ namespace dash
public:
IsoffMainManager (MPD *mpd);
std::vector<Segment *> getSegments (const Representation *rep);
Representation* getRepresentation (Period *period, uint64_t bitrate,
int width, int height) const;
};
......
......@@ -198,18 +198,11 @@ void IsoffMainParser::print ()
std::vector<Representation *>::const_iterator k;
for(k = (*j)->getRepresentations().begin(); k != (*j)->getRepresentations().end(); k++)
{
msg_Dbg(p_stream, " Representation");
msg_Dbg(p_stream, " InitSeg url=%s", (*k)->getSegmentBase()->getInitSegment()->getSourceUrl().c_str());
const SegmentList *segmentList = (*k)->getSegmentList();
if (segmentList)
std::vector<std::string> debug = (*k)->toString();
std::vector<std::string>::const_iterator l;
for(l = debug.begin(); l < debug.end(); l++)
{
std::vector<Segment *>::const_iterator l;
for(l = segmentList->getSegments().begin();
l < segmentList->getSegments().end(); l++)
{
msg_Dbg(p_stream, " Segment url=%s", (*l)->getSourceUrl().c_str());
}
msg_Dbg(p_stream, "%s", (*l).c_str());
}
}
}
......
......@@ -127,18 +127,39 @@ void Representation::addDependency(const Representation *dep)
if ( dep != NULL )
this->dependencies.push_back( dep );
}
SegmentList* Representation::getSegmentList () const
std::vector<Segment *> Representation::getSegments() const
{
return this->segmentList;
std::vector<Segment *> retSegments;
if ( segmentInfo )
{
retSegments.push_back( segmentInfo->getInitialisationSegment() );
if ( !segmentInfo->getSegments().empty() )
retSegments.insert( retSegments.end(),
segmentInfo->getSegments().begin(),
segmentInfo->getSegments().end() );
}
else
{
if( segmentBase && segmentBase->getInitSegment() )
retSegments.push_back( segmentBase->getInitSegment() );
if ( segmentList )
retSegments.insert( retSegments.end(),
segmentList->getSegments().begin(),
segmentList->getSegments().end() );
}
return retSegments;
}
void Representation::setSegmentList (SegmentList *list)
{
this->segmentList = list;
}
SegmentBase* Representation::getSegmentBase () const
{
return this->segmentBase;
}
void Representation::setSegmentBase (SegmentBase *base)
{
this->segmentBase = base;
......@@ -170,3 +191,22 @@ int Representation::getHeight () const
{
return this->height;
}
std::vector<std::string> Representation::toString() const
{
std::vector<std::string> ret;
ret.push_back(std::string(" Representation"));
ret.push_back(std::string(" InitSeg url=")
.append(segmentBase->getInitSegment()->getSourceUrl()));
if (segmentList)
{
std::vector<Segment *>::const_iterator l;
for(l = segmentList->getSegments().begin();
l < segmentList->getSegments().end(); l++)
{
ret.push_back(std::string(" Segment url=")
.append((*l)->getSourceUrl()));
}
}
return ret;
}
......@@ -73,9 +73,8 @@ namespace dash
const AdaptationSet* getParentGroup() const;
void setParentGroup( const AdaptationSet *group );
SegmentList* getSegmentList () const;
std::vector<Segment*> getSegments ()const;
void setSegmentList (SegmentList *list);
SegmentBase* getSegmentBase () const;
void setSegmentBase (SegmentBase *base);
void setWidth (int width);
int getWidth () const;
......@@ -84,6 +83,8 @@ namespace dash
BaseUrl* getBaseUrl () const;
void setBaseUrl (BaseUrl *baseUrl);
std::vector<std::string> toString() const;
private:
uint64_t bandwidth;
std::string id;
......
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