Commit a649c63e authored by François Cartegnie's avatar François Cartegnie 🤞

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

parent 974b79d8
......@@ -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);
}
......@@ -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;
......
......@@ -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
......
......@@ -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 */
......
......@@ -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
......
......@@ -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 &,
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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));
}
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