]> git.sesse.net Git - vlc/commitdiff
stream_filter: dash: better indent for debug
authorFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 17 Dec 2014 19:51:28 +0000 (20:51 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 18 Dec 2014 21:38:09 +0000 (22:38 +0100)
modules/stream_filter/dash/mpd/AdaptationSet.cpp
modules/stream_filter/dash/mpd/AdaptationSet.h
modules/stream_filter/dash/mpd/IsoffMainParser.cpp
modules/stream_filter/dash/mpd/Period.cpp
modules/stream_filter/dash/mpd/Period.h
modules/stream_filter/dash/mpd/Representation.cpp
modules/stream_filter/dash/mpd/Representation.h
modules/stream_filter/dash/mpd/Segment.cpp
modules/stream_filter/dash/mpd/Segment.h

index 090ac3190cc9bbb4e93cb75cf82cdd2b11a2c5cd..306d73c9c8722febe54ae6f703a354c616aaa860 100644 (file)
@@ -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;
+}
index 8f20d9f602acbdab822343e96618f4f0b74d1bdd..e47ecda70bcaf43e0c0fe34edf0498f731c9aee3 100644 (file)
@@ -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;
index db67a9fdabfbb1a72b2827e28738646406daba11..5567be9fab1362356a4f09ed969fa7b6568af511 100644 (file)
@@ -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());
             }
         }
     }
index 00a6ebeb4f575aa39d06f90388dd5b6f10691df1..8d2f179dc8f52049ea0fdc980fcc614bf7c91283 100644 (file)
@@ -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;
+}
index 0a16d358e75a8fba83caf44d59e4cec302872e21..1593c7cf280cfe2048687b81af017e0027fcbe9d 100644 (file)
@@ -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 */
 
index 227d99073b92478a533f853e6032e58f3ef7e7b3..61aa8f12fe17b4603e61688ff88304680b411e3e 100644 (file)
@@ -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;
 }
index 10c88f769746a5718b2d30ad96fea21968b627f4..67da99ac7364614e09b8f9f3d08ced96218405da 100644 (file)
@@ -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:
index 28cd1af500d0ce4466c73cf8873be3c68b432076..b4b8b5f751b585ee06643f71259059e61a821a16 100644 (file)
@@ -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;
     }
index 9cfb3669925ec8fe2499a04fe756ae96fc40d87e..896fb72e529ecbb6c82d78294ddafb734c7c8b03 100644 (file)
@@ -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;