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

demux: adaptative: add default ID to AdaptationSet/Representation

parent 508d7a81
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "SegmentTemplate.h" #include "SegmentTemplate.h"
#include "BasePeriod.h" #include "BasePeriod.h"
#include "ID.hpp"
using namespace adaptative; using namespace adaptative;
using namespace adaptative::playlist; using namespace adaptative::playlist;
...@@ -61,6 +62,17 @@ std::vector<BaseRepresentation*>& BaseAdaptationSet::getRepresentations() ...@@ -61,6 +62,17 @@ std::vector<BaseRepresentation*>& BaseAdaptationSet::getRepresentations()
return representations; return representations;
} }
BaseRepresentation * BaseAdaptationSet::getRepresentationByID(const ID &id)
{
std::vector<BaseRepresentation *>::const_iterator it;
for(it = representations.begin(); it != representations.end(); ++it)
{
if((*it)->getID() == id)
return *it;
}
return NULL;
}
void BaseAdaptationSet::addRepresentation(BaseRepresentation *rep) void BaseAdaptationSet::addRepresentation(BaseRepresentation *rep)
{ {
representations.push_back(rep); representations.push_back(rep);
...@@ -80,7 +92,8 @@ bool BaseAdaptationSet::getBitstreamSwitching () const ...@@ -80,7 +92,8 @@ bool BaseAdaptationSet::getBitstreamSwitching () const
void BaseAdaptationSet::debug(vlc_object_t *obj, int indent) const void BaseAdaptationSet::debug(vlc_object_t *obj, int indent) const
{ {
std::string text(indent, ' '); std::string text(indent, ' ');
text.append("BaseAdaptationSet"); text.append("BaseAdaptationSet ");
text.append(id.str());
msg_Dbg(obj, "%s", text.c_str()); msg_Dbg(obj, "%s", text.c_str());
std::vector<BaseRepresentation *>::const_iterator k; std::vector<BaseRepresentation *>::const_iterator k;
for(k = representations.begin(); k != representations.end(); ++k) for(k = representations.begin(); k != representations.end(); ++k)
......
...@@ -38,6 +38,7 @@ namespace adaptative ...@@ -38,6 +38,7 @@ namespace adaptative
{ {
class BaseRepresentation; class BaseRepresentation;
class BasePeriod; class BasePeriod;
class ID;
class BaseAdaptationSet : public CommonAttributesElements, class BaseAdaptationSet : public CommonAttributesElements,
public SegmentInformation public SegmentInformation
...@@ -48,6 +49,7 @@ namespace adaptative ...@@ -48,6 +49,7 @@ namespace adaptative
virtual StreamFormat getStreamFormat() const; /*reimpl*/ virtual StreamFormat getStreamFormat() const; /*reimpl*/
std::vector<BaseRepresentation *>& getRepresentations (); std::vector<BaseRepresentation *>& getRepresentations ();
BaseRepresentation * getRepresentationByID(const ID &);
void setSwitchPolicy(bool value); void setSwitchPolicy(bool value);
bool getBitstreamSwitching() const; bool getBitstreamSwitching() const;
void addRepresentation( BaseRepresentation *rep ); void addRepresentation( BaseRepresentation *rep );
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "BaseRepresentation.h" #include "BaseRepresentation.h"
#include "BaseAdaptationSet.h" #include "BaseAdaptationSet.h"
#include "SegmentTemplate.h" #include "SegmentTemplate.h"
#include "ID.hpp"
using namespace adaptative; using namespace adaptative;
using namespace adaptative::playlist; using namespace adaptative::playlist;
...@@ -73,7 +74,8 @@ void BaseRepresentation::addCodec(const std::string &codec) ...@@ -73,7 +74,8 @@ void BaseRepresentation::addCodec(const std::string &codec)
void BaseRepresentation::debug(vlc_object_t *obj, int indent) const void BaseRepresentation::debug(vlc_object_t *obj, int indent) const
{ {
std::string text(indent, ' '); std::string text(indent, ' ');
text.append("Representation"); text.append("Representation ");
text.append(id.str());
msg_Dbg(obj, "%s", text.c_str()); msg_Dbg(obj, "%s", text.c_str());
std::vector<ISegment *> list; std::vector<ISegment *> list;
getAllSegments(list); getAllSegments(list);
......
...@@ -84,3 +84,8 @@ void CommonAttributesElements::addLang( const std::string &lang ) ...@@ -84,3 +84,8 @@ void CommonAttributesElements::addLang( const std::string &lang )
if ( lang.empty() == false ) if ( lang.empty() == false )
this->lang.push_back( lang ); this->lang.push_back( lang );
} }
const ID & CommonAttributesElements::getID() const
{
return id;
}
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <list> #include <list>
#include <string> #include <string>
#include "ID.hpp"
namespace adaptative namespace adaptative
{ {
...@@ -44,12 +45,14 @@ namespace adaptative ...@@ -44,12 +45,14 @@ namespace adaptative
void setHeight( int height ); void setHeight( int height );
const std::list<std::string>& getLang() const; const std::list<std::string>& getLang() const;
void addLang( const std::string &lang ); void addLang( const std::string &lang );
const ID & getID() const;
protected: protected:
std::string mimeType; std::string mimeType;
int width; int width;
int height; int height;
std::list<std::string> lang; std::list<std::string> lang;
ID id;
}; };
} }
} }
......
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