[vlc-commits] demux: adaptative: don't gather/copy stringlist on debug

Francois Cartegnie git at videolan.org
Fri May 15 21:29:30 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 15 12:19:26 2015 +0200| [a649c63ea695d15199e7b28a02bde6aa37c377f2] | committer: Francois Cartegnie

demux: adaptative: don't gather/copy stringlist on debug

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

 .../adaptative/playlist/BaseAdaptationSet.cpp      |   11 +++-------
 .../demux/adaptative/playlist/BaseAdaptationSet.h  |    2 +-
 modules/demux/adaptative/playlist/BasePeriod.cpp   |   11 +++-------
 modules/demux/adaptative/playlist/BasePeriod.h     |    3 +--
 .../adaptative/playlist/BaseRepresentation.cpp     |   12 +++--------
 .../demux/adaptative/playlist/BaseRepresentation.h |    2 +-
 modules/demux/adaptative/playlist/Segment.cpp      |   21 ++++++++------------
 modules/demux/adaptative/playlist/Segment.h        |    4 ++--
 modules/demux/dash/mpd/MPD.cpp                     |    9 +--------
 9 files changed, 23 insertions(+), 52 deletions(-)

diff --git a/modules/demux/adaptative/playlist/BaseAdaptationSet.cpp b/modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
index 9715677..0ac16fd 100644
--- a/modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
+++ b/modules/demux/adaptative/playlist/BaseAdaptationSet.cpp
@@ -79,17 +79,12 @@ bool BaseAdaptationSet::getBitstreamSwitching  () const
     return this->isBitstreamSwitching;
 }
 
-std::vector<std::string> BaseAdaptationSet::toString(int indent) const
+void BaseAdaptationSet::debug(vlc_object_t *obj, int indent) const
 {
-    std::vector<std::string> ret;
     std::string text(indent, ' ');
     text.append("BaseAdaptationSet");
-    ret.push_back(text);
+    msg_Dbg(obj, "%s", text.c_str());
     std::vector<BaseRepresentation *>::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;
+        (*k)->debug(obj, indent + 1);
 }
diff --git a/modules/demux/adaptative/playlist/BaseAdaptationSet.h b/modules/demux/adaptative/playlist/BaseAdaptationSet.h
index b851422..70d1c8e 100644
--- a/modules/demux/adaptative/playlist/BaseAdaptationSet.h
+++ b/modules/demux/adaptative/playlist/BaseAdaptationSet.h
@@ -50,7 +50,7 @@ namespace adaptative
                 void                            setBitstreamSwitching(bool value);
                 bool                            getBitstreamSwitching() const;
                 void                            addRepresentation( BaseRepresentation *rep );
-                std::vector<std::string>        toString(int = 0) const;
+                void                            debug(vlc_object_t *,int = 0) const;
 
             protected:
                 std::vector<BaseRepresentation *>   representations;
diff --git a/modules/demux/adaptative/playlist/BasePeriod.cpp b/modules/demux/adaptative/playlist/BasePeriod.cpp
index dcb92de..e88d682 100644
--- a/modules/demux/adaptative/playlist/BasePeriod.cpp
+++ b/modules/demux/adaptative/playlist/BasePeriod.cpp
@@ -87,19 +87,14 @@ BaseAdaptationSet * BasePeriod::getAdaptationSet(StreamType type) const
     return NULL;
 }
 
-std::vector<std::string> BasePeriod::toString(int indent) const
+void BasePeriod::debug(vlc_object_t *obj, int indent) const
 {
-    std::vector<std::string> ret;
     std::string text(indent, ' ');
     text.append("Period");
-    ret.push_back(text);
+    msg_Dbg(obj, "%s", text.c_str());
     std::vector<BaseAdaptationSet *>::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;
+        (*k)->debug(obj, indent + 1);
 }
 
 mtime_t BasePeriod::getPeriodStart() const
diff --git a/modules/demux/adaptative/playlist/BasePeriod.h b/modules/demux/adaptative/playlist/BasePeriod.h
index c2f5b0a..fd97920 100644
--- a/modules/demux/adaptative/playlist/BasePeriod.h
+++ b/modules/demux/adaptative/playlist/BasePeriod.h
@@ -25,7 +25,6 @@
 #define BASEPERIOD_H_
 
 #include <vector>
-#include <string>
 
 #include "BaseAdaptationSet.h"
 #include "SegmentInformation.hpp"
@@ -46,7 +45,7 @@ namespace adaptative
                 const std::vector<BaseAdaptationSet *>  getAdaptationSets   (StreamType) const;
                 BaseAdaptationSet *                 getAdaptationSet    (StreamType) const;
                 void                                addAdaptationSet    (BaseAdaptationSet *AdaptationSet);
-                std::vector<std::string>            toString            (int = 0) const;
+                void                                debug               (vlc_object_t *,int = 0) const;
 
                 virtual mtime_t getPeriodStart() const; /* reimpl */
 
diff --git a/modules/demux/adaptative/playlist/BaseRepresentation.cpp b/modules/demux/adaptative/playlist/BaseRepresentation.cpp
index 186ed4f..0cab1a7 100644
--- a/modules/demux/adaptative/playlist/BaseRepresentation.cpp
+++ b/modules/demux/adaptative/playlist/BaseRepresentation.cpp
@@ -55,21 +55,15 @@ void    BaseRepresentation::setBandwidth( uint64_t bandwidth )
     this->bandwidth = bandwidth;
 }
 
-std::vector<std::string> BaseRepresentation::toString(int indent) const
+void BaseRepresentation::debug(vlc_object_t *obj, int indent) const
 {
-    std::vector<std::string> ret;
     std::string text(indent, ' ');
     text.append("Representation");
-    ret.push_back(text);
+    msg_Dbg(obj, "%s", text.c_str());
     std::vector<ISegment *> list = getSegments();
     std::vector<ISegment *>::const_iterator l;
     for(l = list.begin(); l < list.end(); ++l)
-    {
-        std::vector<std::string> debug = (*l)->toString(indent + 1);
-        ret.insert(ret.end(), debug.begin(), debug.end());
-    }
-
-    return ret;
+        (*l)->debug(obj, indent + 1);
 }
 
 AbstractPlaylist * BaseRepresentation::getPlaylist() const
diff --git a/modules/demux/adaptative/playlist/BaseRepresentation.h b/modules/demux/adaptative/playlist/BaseRepresentation.h
index f81595e..daf70e2 100644
--- a/modules/demux/adaptative/playlist/BaseRepresentation.h
+++ b/modules/demux/adaptative/playlist/BaseRepresentation.h
@@ -56,7 +56,7 @@ namespace adaptative
 
                 AbstractPlaylist*   getPlaylist             () const;
 
-                std::vector<std::string> toString(int = 0) const;
+                void                debug                   (vlc_object_t *,int = 0) const;
 
                 /* for segment templates */
                 virtual std::string contextualize(size_t, const std::string &,
diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp
index d4d1f52..4dcb1c5 100644
--- a/modules/demux/adaptative/playlist/Segment.cpp
+++ b/modules/demux/adaptative/playlist/Segment.cpp
@@ -88,15 +88,13 @@ size_t ISegment::getOffset() const
     return startByte;
 }
 
-std::vector<std::string> ISegment::toString(int indent) const
+void ISegment::debug(vlc_object_t *obj, int indent) const
 {
-    std::vector<std::string> out;
     std::stringstream ss;
     ss << std::string(indent, ' ') << debugName << " url=" << getUrlSegment().toString();
     if(startByte!=endByte)
         ss << " @" << startByte << ".." << endByte;
-    out.push_back(ss.str());
-    return out;
+    msg_Dbg(obj, "%s", ss.str().c_str());
 }
 
 bool ISegment::contains(size_t byte) const
@@ -153,23 +151,20 @@ void                    Segment::setSourceUrl   ( const std::string &url )
         this->sourceUrl = url;
 }
 
-std::vector<std::string> Segment::toString(int indent) const
+void Segment::debug(vlc_object_t *obj, int indent) const
 {
     if (subsegments.empty())
     {
-        return ISegment::toString(indent);
+        ISegment::debug(obj, indent);
     }
     else
     {
-        std::vector<std::string> ret;
+        std::string text(indent, ' ');
+        text.append("Segment");
+        msg_Dbg(obj, "%s", text.c_str());
         std::vector<SubSegment *>::const_iterator l;
-        ret.push_back(std::string(indent, ' ').append("Segment"));
         for(l = subsegments.begin(); l != subsegments.end(); ++l)
-        {
-            std::vector<std::string> debug = (*l)->toString(indent + 1);
-            ret.insert(ret.end(), debug.begin(), debug.end());
-        }
-        return ret;
+            (*l)->debug(obj, indent + 1);
     }
 }
 
diff --git a/modules/demux/adaptative/playlist/Segment.h b/modules/demux/adaptative/playlist/Segment.h
index bc5e90c..57426f9 100644
--- a/modules/demux/adaptative/playlist/Segment.h
+++ b/modules/demux/adaptative/playlist/Segment.h
@@ -56,7 +56,7 @@ namespace adaptative
                 virtual size_t                          getOffset       () const;
                 virtual std::vector<ISegment*>          subSegments     () = 0;
                 virtual void                            addSubSegment   (SubSegment *) = 0;
-                virtual std::vector<std::string>        toString        (int = 0) const;
+                virtual void                            debug           (vlc_object_t *,int = 0) const;
                 virtual bool                            contains        (size_t byte) const;
                 int                                     getClassId      () const;
                 Property<mtime_t>       startTime;
@@ -95,7 +95,7 @@ namespace adaptative
                 virtual Url getUrlSegment() const; /* impl */
                 virtual Chunk* toChunk(size_t, BaseRepresentation * = NULL);
                 virtual std::vector<ISegment*> subSegments();
-                virtual std::vector<std::string> toString(int = 0) const;
+                virtual void debug(vlc_object_t *,int = 0) const;
                 virtual void addSubSegment(SubSegment *);
                 static const int CLASSID_SEGMENT = 1;
 
diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp
index 7b23bf4..ab484ad 100644
--- a/modules/demux/dash/mpd/MPD.cpp
+++ b/modules/demux/dash/mpd/MPD.cpp
@@ -72,12 +72,5 @@ void MPD::debug()
 
     std::vector<BasePeriod *>::const_iterator i;
     for(i = getPeriods().begin(); i != getPeriods().end(); ++i)
-    {
-        std::vector<std::string> debug = (*i)->toString();
-        std::vector<std::string>::const_iterator l;
-        for(l = debug.begin(); l < debug.end(); ++l)
-        {
-            msg_Dbg(stream, "%s", (*l).c_str());
-        }
-    }
+        (*i)->debug(VLC_OBJECT(stream));
 }



More information about the vlc-commits mailing list