[vlc-commits] stream_filter: dash: better indent for debug

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:59 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 17 20:51:28 2014 +0100| [7d42832c3bfc826e66eb42fc2c95d98cbaebf435] | committer: Francois Cartegnie

stream_filter: dash: better indent for debug

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7d42832c3bfc826e66eb42fc2c95d98cbaebf435
---

 modules/stream_filter/dash/mpd/AdaptationSet.cpp   |   15 +++++++++++++++
 modules/stream_filter/dash/mpd/AdaptationSet.h     |    1 +
 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |   18 ++++--------------
 modules/stream_filter/dash/mpd/Period.cpp          |   15 +++++++++++++++
 modules/stream_filter/dash/mpd/Period.h            |    1 +
 modules/stream_filter/dash/mpd/Representation.cpp  |    8 +++++---
 modules/stream_filter/dash/mpd/Representation.h    |    2 +-
 modules/stream_filter/dash/mpd/Segment.cpp         |   12 ++++++------
 modules/stream_filter/dash/mpd/Segment.h           |    4 ++--
 9 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.cpp b/modules/stream_filter/dash/mpd/AdaptationSet.cpp
index 090ac31..306d73c 100644
--- a/modules/stream_filter/dash/mpd/AdaptationSet.cpp
+++ b/modules/stream_filter/dash/mpd/AdaptationSet.cpp
@@ -119,3 +119,18 @@ Url AdaptationSet::getUrlSegment() const
 {
     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;
+}
diff --git a/modules/stream_filter/dash/mpd/AdaptationSet.h b/modules/stream_filter/dash/mpd/AdaptationSet.h
index 8f20d9f..e47ecda 100644
--- a/modules/stream_filter/dash/mpd/AdaptationSet.h
+++ b/modules/stream_filter/dash/mpd/AdaptationSet.h
@@ -59,6 +59,7 @@ namespace dash
                 bool                            getBitstreamSwitching() const;
                 void                            addRepresentation( Representation *rep );
                 virtual Url                     getUrlSegment() const; /* reimpl */
+                std::vector<std::string>        toString(int = 0) const;
 
             private:
                 bool                            subsegmentAlignmentFlag;
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index db67a9f..5567be9 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -335,21 +335,11 @@ void    IsoffMainParser::print              ()
         std::vector<Period *>::const_iterator i;
         for(i = mpd->getPeriods().begin(); i != mpd->getPeriods().end(); i++)
         {
-            msg_Dbg(p_stream, " Period");
-            std::vector<AdaptationSet *>::const_iterator j;
-            for(j = (*i)->getAdaptationSets().begin(); j != (*i)->getAdaptationSets().end(); j++)
+            std::vector<std::string> debug = (*i)->toString();
+            std::vector<std::string>::const_iterator l;
+            for(l = debug.begin(); l < debug.end(); l++)
             {
-                msg_Dbg(p_stream, "  AdaptationSet");
-                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());
-                    }
-                }
+                msg_Dbg(p_stream, "%s", (*l).c_str());
             }
         }
     }
diff --git a/modules/stream_filter/dash/mpd/Period.cpp b/modules/stream_filter/dash/mpd/Period.cpp
index 00a6ebe..8d2f179 100644
--- a/modules/stream_filter/dash/mpd/Period.cpp
+++ b/modules/stream_filter/dash/mpd/Period.cpp
@@ -82,3 +82,18 @@ Url Period::getUrlSegment() const
 {
     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;
+}
diff --git a/modules/stream_filter/dash/mpd/Period.h b/modules/stream_filter/dash/mpd/Period.h
index 0a16d35..1593c7c 100644
--- a/modules/stream_filter/dash/mpd/Period.h
+++ b/modules/stream_filter/dash/mpd/Period.h
@@ -48,6 +48,7 @@ namespace dash
                 const std::vector<AdaptationSet *>  getAdaptationSets   (Streams::Type) const;
                 AdaptationSet *                     getAdaptationSet    (Streams::Type) const;
                 void                                addAdaptationSet    (AdaptationSet *AdaptationSet);
+                std::vector<std::string>            toString            (int = 0) const;
 
                 virtual Url getUrlSegment() const; /* reimpl */
 
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
index 227d990..61aa8f1 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -132,14 +132,16 @@ int                 Representation::getHeight               () const
     return this->height;
 }
 
-std::vector<std::string> Representation::toString() const
+std::vector<std::string> Representation::toString(int indent) const
 {
     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 *>::const_iterator l;
     for(l = list.begin(); l < list.end(); l++)
-        ret.push_back((*l)->toString());
+        ret.push_back((*l)->toString(indent + 1));
 
     return ret;
 }
diff --git a/modules/stream_filter/dash/mpd/Representation.h b/modules/stream_filter/dash/mpd/Representation.h
index 10c88f7..67da99a 100644
--- a/modules/stream_filter/dash/mpd/Representation.h
+++ b/modules/stream_filter/dash/mpd/Representation.h
@@ -79,7 +79,7 @@ namespace dash
                 void                setBaseUrl              (BaseUrl *baseUrl);
                 MPD*                getMPD                  () const;
 
-                std::vector<std::string> toString() const;
+                std::vector<std::string> toString(int = 0) const;
                 virtual Url         getUrlSegment           () const; /* impl */
 
             private:
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 28cd1af..b4b8b5f 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -116,10 +116,10 @@ size_t ISegment::getOffset() const
     return startByte;
 }
 
-std::string ISegment::toString() const
+std::string ISegment::toString(int indent) const
 {
-    std::stringstream ss("    ");
-    ss << debugName << " url=" << getUrlSegment().toString();
+    std::stringstream ss;
+    ss << std::string(indent, ' ') << debugName << " url=" << getUrlSegment().toString();
     if(startByte!=endByte)
         ss << " @" << startByte << ".." << endByte;
     return ss.str();
@@ -174,11 +174,11 @@ void                    Segment::setSourceUrl   ( const std::string &url )
         this->sourceUrl = url;
 }
 
-std::string Segment::toString() const
+std::string Segment::toString(int indent) const
 {
     if (subsegments.empty())
     {
-        return ISegment::toString();
+        return ISegment::toString(indent);
     }
     else
     {
@@ -186,7 +186,7 @@ std::string Segment::toString() const
         std::vector<SubSegment *>::const_iterator l;
         for(l = subsegments.begin(); l != subsegments.end(); l++)
         {
-            ret.append( (*l)->toString() );
+            ret.append( (*l)->toString(indent + 1) );
         }
         return ret;
     }
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index 9cfb366..896fb72 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -60,7 +60,7 @@ namespace dash
                 virtual void                            setDuration     (mtime_t);
                 virtual size_t                          getOffset       () const;
                 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;
                 int                                     getClassId      () const;
 
@@ -96,7 +96,7 @@ namespace dash
                 virtual Url getUrlSegment() const; /* impl */
                 virtual dash::http::Chunk* toChunk(size_t, Representation * = NULL);
                 virtual std::vector<ISegment*> subSegments();
-                virtual std::string toString() const;
+                virtual std::string toString(int = 0) const;
                 virtual void addSubSegment(SubSegment *);
                 static const int CLASSID_SEGMENT = 1;
 



More information about the vlc-commits mailing list