Commit b4d90eb2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Representation: Cosmetics.

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3852dd54
...@@ -30,13 +30,14 @@ ...@@ -30,13 +30,14 @@
using namespace dash::mpd; using namespace dash::mpd;
using namespace dash::exception; using namespace dash::exception;
Representation::Representation (std::map<std::string, std::string> attributes) Representation::Representation (const std::map<std::string, std::string>& attributes) :
attributes( attributes ),
segmentInfo( NULL ),
trickModeType( NULL ),
contentProtection( NULL )
{ {
this->attributes = attributes;
this->contentProtection = NULL;
this->trickModeType = NULL;
this->segmentInfo = NULL;
} }
Representation::~Representation () Representation::~Representation ()
{ {
delete(this->segmentInfo); delete(this->segmentInfo);
...@@ -44,109 +45,120 @@ Representation::~Representation () ...@@ -44,109 +45,120 @@ Representation::~Representation ()
delete(this->trickModeType); delete(this->trickModeType);
} }
std::string Representation::getFrameRate () throw(AttributeNotPresentException) std::string Representation::getFrameRate () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("frameRate") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("frameRate");
if ( it == this->attributes.end())
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["frameRate"]; return it->second;
} }
std::string Representation::getSamplingRate () throw(AttributeNotPresentException) std::string Representation::getSamplingRate () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("samplingRate") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("samplingRate");
if ( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["samplingRate"]; return it->second;
} }
std::string Representation::getDependencyId () throw(AttributeNotPresentException) std::string Representation::getDependencyId () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("dependencyId") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("dependencyId");
if ( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["dependencyId"]; return it->second;
} }
std::string Representation::getId () throw(AttributeNotPresentException) std::string Representation::getId () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("id") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("id");
if ( it == this->attributes.end())
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["id"]; return it->second;
} }
std::string Representation::getLang () throw(AttributeNotPresentException) std::string Representation::getLang () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("lang") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("lang");
if ( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["lang"]; return it->second;
} }
std::string Representation::getParX () throw(AttributeNotPresentException) std::string Representation::getParX () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("parx") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("parx");
if ( it == this->attributes.end())
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["parx"]; return it->second;
} }
std::string Representation::getParY () throw(AttributeNotPresentException) std::string Representation::getParY () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("pary") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("pary");
if ( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["pary"]; return it->second;
} }
std::string Representation::getHeight () throw(AttributeNotPresentException) std::string Representation::getHeight () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("height") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("height");
if ( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["height"]; return it->second;
} }
std::string Representation::getWidth () throw(AttributeNotPresentException) std::string Representation::getWidth () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("width") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("width");
if ( it == this->attributes.end())
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["width"]; return it->second;
} }
std::string Representation::getBandwidth () throw(AttributeNotPresentException) std::string Representation::getBandwidth () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("bandwidth") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("bandwidth");
if ( it == this->attributes.end())
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["bandwidth"]; return it->second;
} }
std::string Representation::getNumberOfChannels () throw(AttributeNotPresentException) std::string Representation::getNumberOfChannels () const throw(AttributeNotPresentException)
{ {
if(this->attributes.find("numberOfChannels") == this->attributes.end()) std::map<std::string, std::string>::const_iterator it = this->attributes.find("numberOfChannels");
if( it == this->attributes.end() )
throw AttributeNotPresentException(); throw AttributeNotPresentException();
return this->attributes["numberOfChannels"]; return it->second;
} }
SegmentInfo* Representation::getSegmentInfo () throw(ElementNotPresentException) SegmentInfo* Representation::getSegmentInfo () const throw(ElementNotPresentException)
{ {
if(this->segmentInfo == NULL) if(this->segmentInfo == NULL)
throw ElementNotPresentException(); throw ElementNotPresentException();
return this->segmentInfo; return this->segmentInfo;
} }
TrickModeType* Representation::getTrickModeType () throw(ElementNotPresentException) TrickModeType* Representation::getTrickModeType () const throw(ElementNotPresentException)
{ {
if(this->segmentInfo == NULL) if(this->segmentInfo == NULL)
throw ElementNotPresentException(); throw ElementNotPresentException();
return this->trickModeType; return this->trickModeType;
} }
ContentProtection* Representation::getContentProtection () throw(ElementNotPresentException) ContentProtection* Representation::getContentProtection () const throw(ElementNotPresentException)
{ {
if(this->contentProtection == NULL) if(this->contentProtection == NULL)
throw ElementNotPresentException(); throw ElementNotPresentException();
......
...@@ -42,23 +42,23 @@ namespace dash ...@@ -42,23 +42,23 @@ namespace dash
class Representation class Representation
{ {
public: public:
Representation (std::map<std::string, std::string> attributes); Representation ( const std::map<std::string, std::string>& attributes);
virtual ~Representation (); virtual ~Representation ();
std::string getWidth () throw(dash::exception::AttributeNotPresentException); std::string getWidth () const throw(dash::exception::AttributeNotPresentException);
std::string getHeight () throw(dash::exception::AttributeNotPresentException); std::string getHeight () const throw(dash::exception::AttributeNotPresentException);
std::string getParX () throw(dash::exception::AttributeNotPresentException); std::string getParX () const throw(dash::exception::AttributeNotPresentException);
std::string getParY () throw(dash::exception::AttributeNotPresentException); std::string getParY () const throw(dash::exception::AttributeNotPresentException);
std::string getLang () throw(dash::exception::AttributeNotPresentException); std::string getLang () const throw(dash::exception::AttributeNotPresentException);
std::string getFrameRate () throw(dash::exception::AttributeNotPresentException); std::string getFrameRate () const throw(dash::exception::AttributeNotPresentException);
std::string getId () throw(dash::exception::AttributeNotPresentException); std::string getId () const throw(dash::exception::AttributeNotPresentException);
std::string getBandwidth () throw(dash::exception::AttributeNotPresentException); std::string getBandwidth () const throw(dash::exception::AttributeNotPresentException);
std::string getDependencyId () throw(dash::exception::AttributeNotPresentException); std::string getDependencyId () const throw(dash::exception::AttributeNotPresentException);
std::string getNumberOfChannels () throw(dash::exception::AttributeNotPresentException); std::string getNumberOfChannels () const throw(dash::exception::AttributeNotPresentException);
std::string getSamplingRate () throw(dash::exception::AttributeNotPresentException); std::string getSamplingRate () const throw(dash::exception::AttributeNotPresentException);
SegmentInfo* getSegmentInfo () throw(dash::exception::ElementNotPresentException); SegmentInfo* getSegmentInfo () const throw(dash::exception::ElementNotPresentException);
TrickModeType* getTrickModeType () throw(dash::exception::ElementNotPresentException); TrickModeType* getTrickModeType () const throw(dash::exception::ElementNotPresentException);
ContentProtection* getContentProtection () throw(dash::exception::ElementNotPresentException); ContentProtection* getContentProtection () const throw(dash::exception::ElementNotPresentException);
void setSegmentInfo (SegmentInfo *info); void setSegmentInfo (SegmentInfo *info);
void setTrickModeType (TrickModeType *trickModeType); void setTrickModeType (TrickModeType *trickModeType);
......
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