Commit 7d42832c authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: better indent for debug

parent 72a278f6
...@@ -119,3 +119,18 @@ Url AdaptationSet::getUrlSegment() const ...@@ -119,3 +119,18 @@ Url AdaptationSet::getUrlSegment() const
{ {
return getParentUrlSegment(); return getParentUrlSegment();
} }
std::vector<std::string> AdaptationSet::toString(int indent) const
{
std::vector<std::string> ret;
std::string text(indent, ' ');
text.append("AdaptationSet");
ret.push_back(text);
std::vector<Representation *>::const_iterator k;
for(k = representations.begin(); k != representations.end(); k++)
{
std::vector<std::string> debug = (*k)->toString(indent + 1);
ret.insert(ret.end(), debug.begin(), debug.end());
}
return ret;
}
...@@ -59,6 +59,7 @@ namespace dash ...@@ -59,6 +59,7 @@ namespace dash
bool getBitstreamSwitching() const; bool getBitstreamSwitching() const;
void addRepresentation( Representation *rep ); void addRepresentation( Representation *rep );
virtual Url getUrlSegment() const; /* reimpl */ virtual Url getUrlSegment() const; /* reimpl */
std::vector<std::string> toString(int = 0) const;
private: private:
bool subsegmentAlignmentFlag; bool subsegmentAlignmentFlag;
......
...@@ -335,21 +335,11 @@ void IsoffMainParser::print () ...@@ -335,21 +335,11 @@ void IsoffMainParser::print ()
std::vector<Period *>::const_iterator i; std::vector<Period *>::const_iterator i;
for(i = mpd->getPeriods().begin(); i != mpd->getPeriods().end(); i++) for(i = mpd->getPeriods().begin(); i != mpd->getPeriods().end(); i++)
{ {
msg_Dbg(p_stream, " Period"); std::vector<std::string> debug = (*i)->toString();
std::vector<AdaptationSet *>::const_iterator j; std::vector<std::string>::const_iterator l;
for(j = (*i)->getAdaptationSets().begin(); j != (*i)->getAdaptationSets().end(); j++) for(l = debug.begin(); l < debug.end(); l++)
{ {
msg_Dbg(p_stream, " AdaptationSet"); msg_Dbg(p_stream, "%s", (*l).c_str());
std::vector<Representation *>::const_iterator k;
for(k = (*j)->getRepresentations().begin(); k != (*j)->getRepresentations().end(); k++)
{
std::vector<std::string> debug = (*k)->toString();
std::vector<std::string>::const_iterator l;
for(l = debug.begin(); l < debug.end(); l++)
{
msg_Dbg(p_stream, "%s", (*l).c_str());
}
}
} }
} }
} }
......
...@@ -82,3 +82,18 @@ Url Period::getUrlSegment() const ...@@ -82,3 +82,18 @@ Url Period::getUrlSegment() const
{ {
return getParentUrlSegment(); return getParentUrlSegment();
} }
std::vector<std::string> Period::toString(int indent) const
{
std::vector<std::string> ret;
std::string text(indent, ' ');
text.append("Period");
ret.push_back(text);
std::vector<AdaptationSet *>::const_iterator k;
for(k = adaptationSets.begin(); k != adaptationSets.end(); k++)
{
std::vector<std::string> debug = (*k)->toString(indent + 1);
ret.insert(ret.end(), debug.begin(), debug.end());
}
return ret;
}
...@@ -48,6 +48,7 @@ namespace dash ...@@ -48,6 +48,7 @@ namespace dash
const std::vector<AdaptationSet *> getAdaptationSets (Streams::Type) const; const std::vector<AdaptationSet *> getAdaptationSets (Streams::Type) const;
AdaptationSet * getAdaptationSet (Streams::Type) const; AdaptationSet * getAdaptationSet (Streams::Type) const;
void addAdaptationSet (AdaptationSet *AdaptationSet); void addAdaptationSet (AdaptationSet *AdaptationSet);
std::vector<std::string> toString (int = 0) const;
virtual Url getUrlSegment() const; /* reimpl */ virtual Url getUrlSegment() const; /* reimpl */
......
...@@ -132,14 +132,16 @@ int Representation::getHeight () const ...@@ -132,14 +132,16 @@ int Representation::getHeight () const
return this->height; return this->height;
} }
std::vector<std::string> Representation::toString() const std::vector<std::string> Representation::toString(int indent) const
{ {
std::vector<std::string> ret; std::vector<std::string> ret;
ret.push_back(std::string(" Representation")); std::string text(indent, ' ');
text.append("Representation");
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()); ret.push_back((*l)->toString(indent + 1));
return ret; return ret;
} }
......
...@@ -79,7 +79,7 @@ namespace dash ...@@ -79,7 +79,7 @@ namespace dash
void setBaseUrl (BaseUrl *baseUrl); void setBaseUrl (BaseUrl *baseUrl);
MPD* getMPD () const; MPD* getMPD () const;
std::vector<std::string> toString() const; std::vector<std::string> toString(int = 0) const;
virtual Url getUrlSegment () const; /* impl */ virtual Url getUrlSegment () const; /* impl */
private: private:
......
...@@ -116,10 +116,10 @@ size_t ISegment::getOffset() const ...@@ -116,10 +116,10 @@ size_t ISegment::getOffset() const
return startByte; return startByte;
} }
std::string ISegment::toString() const std::string ISegment::toString(int indent) const
{ {
std::stringstream ss(" "); std::stringstream ss;
ss << 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(); return ss.str();
...@@ -174,11 +174,11 @@ void Segment::setSourceUrl ( const std::string &url ) ...@@ -174,11 +174,11 @@ void Segment::setSourceUrl ( const std::string &url )
this->sourceUrl = url; this->sourceUrl = url;
} }
std::string Segment::toString() const std::string Segment::toString(int indent) const
{ {
if (subsegments.empty()) if (subsegments.empty())
{ {
return ISegment::toString(); return ISegment::toString(indent);
} }
else else
{ {
...@@ -186,7 +186,7 @@ std::string Segment::toString() const ...@@ -186,7 +186,7 @@ std::string Segment::toString() const
std::vector<SubSegment *>::const_iterator l; std::vector<SubSegment *>::const_iterator l;
for(l = subsegments.begin(); l != subsegments.end(); l++) for(l = subsegments.begin(); l != subsegments.end(); l++)
{ {
ret.append( (*l)->toString() ); ret.append( (*l)->toString(indent + 1) );
} }
return ret; return ret;
} }
......
...@@ -60,7 +60,7 @@ namespace dash ...@@ -60,7 +60,7 @@ namespace dash
virtual void setDuration (mtime_t); virtual void setDuration (mtime_t);
virtual size_t getOffset () const; virtual size_t getOffset () const;
virtual std::vector<ISegment*> subSegments () = 0; virtual std::vector<ISegment*> subSegments () = 0;
virtual std::string toString () const; virtual 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;
...@@ -96,7 +96,7 @@ namespace dash ...@@ -96,7 +96,7 @@ namespace dash
virtual Url getUrlSegment() const; /* impl */ virtual Url getUrlSegment() const; /* impl */
virtual dash::http::Chunk* toChunk(size_t, Representation * = NULL); virtual dash::http::Chunk* toChunk(size_t, Representation * = NULL);
virtual std::vector<ISegment*> subSegments(); virtual std::vector<ISegment*> subSegments();
virtual std::string toString() const; virtual 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