Commit 62578f1b authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: fix subsegment debug info

parent f4a73140
...@@ -63,8 +63,11 @@ std::vector<std::string> BaseRepresentation::toString(int indent) const ...@@ -63,8 +63,11 @@ std::vector<std::string> BaseRepresentation::toString(int indent) const
ret.push_back(text); ret.push_back(text);
std::vector<ISegment *> list = getSegments(); std::vector<ISegment *> list = getSegments();
std::vector<ISegment *>::const_iterator l; std::vector<ISegment *>::const_iterator l;
for(l = list.begin(); l < list.end(); l++) for(l = list.begin(); l < list.end(); ++l)
ret.push_back((*l)->toString(indent + 1)); {
std::vector<std::string> debug = (*l)->toString(indent + 1);
ret.insert(ret.end(), debug.begin(), debug.end());
}
return ret; return ret;
} }
......
...@@ -88,13 +88,15 @@ size_t ISegment::getOffset() const ...@@ -88,13 +88,15 @@ size_t ISegment::getOffset() const
return startByte; return startByte;
} }
std::string ISegment::toString(int indent) const std::vector<std::string> ISegment::toString(int indent) const
{ {
std::vector<std::string> out;
std::stringstream ss; std::stringstream ss;
ss << std::string(indent, ' ') << debugName << " url=" << getUrlSegment().toString(); ss << std::string(indent, ' ') << debugName << " url=" << getUrlSegment().toString();
if(startByte!=endByte) if(startByte!=endByte)
ss << " @" << startByte << ".." << endByte; ss << " @" << startByte << ".." << endByte;
return ss.str(); out.push_back(ss.str());
return out;
} }
bool ISegment::contains(size_t byte) const bool ISegment::contains(size_t byte) const
...@@ -151,7 +153,7 @@ void Segment::setSourceUrl ( const std::string &url ) ...@@ -151,7 +153,7 @@ void Segment::setSourceUrl ( const std::string &url )
this->sourceUrl = url; this->sourceUrl = url;
} }
std::string Segment::toString(int indent) const std::vector<std::string> Segment::toString(int indent) const
{ {
if (subsegments.empty()) if (subsegments.empty())
{ {
...@@ -159,11 +161,13 @@ std::string Segment::toString(int indent) const ...@@ -159,11 +161,13 @@ std::string Segment::toString(int indent) const
} }
else else
{ {
std::string ret; std::vector<std::string> ret;
std::vector<SubSegment *>::const_iterator l; std::vector<SubSegment *>::const_iterator l;
ret.push_back(std::string(indent, ' ').append("Segment"));
for(l = subsegments.begin(); l != subsegments.end(); ++l) for(l = subsegments.begin(); l != subsegments.end(); ++l)
{ {
ret.append( (*l)->toString(indent + 1) ); std::vector<std::string> debug = (*l)->toString(indent + 1);
ret.insert(ret.end(), debug.begin(), debug.end());
} }
return ret; return ret;
} }
......
...@@ -56,7 +56,7 @@ namespace adaptative ...@@ -56,7 +56,7 @@ namespace adaptative
virtual size_t getOffset () const; virtual size_t getOffset () const;
virtual std::vector<ISegment*> subSegments () = 0; virtual std::vector<ISegment*> subSegments () = 0;
virtual void addSubSegment (SubSegment *) = 0; virtual void addSubSegment (SubSegment *) = 0;
virtual std::string toString (int = 0) const; virtual std::vector<std::string> toString (int = 0) const;
virtual bool contains (size_t byte) const; virtual bool contains (size_t byte) const;
int getClassId () const; int getClassId () const;
Property<mtime_t> startTime; Property<mtime_t> startTime;
...@@ -95,7 +95,7 @@ namespace adaptative ...@@ -95,7 +95,7 @@ namespace adaptative
virtual Url getUrlSegment() const; /* impl */ virtual Url getUrlSegment() const; /* impl */
virtual Chunk* toChunk(size_t, BaseRepresentation * = NULL); virtual Chunk* toChunk(size_t, BaseRepresentation * = NULL);
virtual std::vector<ISegment*> subSegments(); virtual std::vector<ISegment*> subSegments();
virtual std::string toString(int = 0) const; virtual std::vector<std::string> toString(int = 0) const;
virtual void addSubSegment(SubSegment *); virtual void addSubSegment(SubSegment *);
static const int CLASSID_SEGMENT = 1; static const int CLASSID_SEGMENT = 1;
......
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