3 *****************************************************************************
4 * Copyright (C) 2010 - 2011 Klagenfurt University
6 * Created on: Aug 10, 2010
7 * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
8 * Christian Timmerer <christian.timmerer@itec.uni-klu.ac.at>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published
12 * by the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
28 #include "Representation.h"
30 using namespace dash::mpd;
31 using namespace dash::exception;
33 Representation::Representation (const std::map<std::string, std::string>& attributes) :
34 attributes( attributes ),
36 trickModeType( NULL ),
37 contentProtection( NULL )
41 Representation::~Representation ()
43 delete(this->segmentInfo);
44 delete(this->contentProtection);
45 delete(this->trickModeType);
48 std::string Representation::getFrameRate () const throw(AttributeNotPresentException)
50 std::map<std::string, std::string>::const_iterator it = this->attributes.find("frameRate");
51 if ( it == this->attributes.end())
52 throw AttributeNotPresentException();
57 std::string Representation::getSamplingRate () const throw(AttributeNotPresentException)
59 std::map<std::string, std::string>::const_iterator it = this->attributes.find("samplingRate");
60 if ( it == this->attributes.end() )
61 throw AttributeNotPresentException();
66 std::string Representation::getDependencyId () const throw(AttributeNotPresentException)
68 std::map<std::string, std::string>::const_iterator it = this->attributes.find("dependencyId");
69 if ( it == this->attributes.end() )
70 throw AttributeNotPresentException();
75 std::string Representation::getId () const throw(AttributeNotPresentException)
77 std::map<std::string, std::string>::const_iterator it = this->attributes.find("id");
78 if ( it == this->attributes.end())
79 throw AttributeNotPresentException();
84 std::string Representation::getLang () const throw(AttributeNotPresentException)
86 std::map<std::string, std::string>::const_iterator it = this->attributes.find("lang");
87 if ( it == this->attributes.end() )
88 throw AttributeNotPresentException();
93 std::string Representation::getParX () const throw(AttributeNotPresentException)
95 std::map<std::string, std::string>::const_iterator it = this->attributes.find("parx");
96 if ( it == this->attributes.end())
97 throw AttributeNotPresentException();
102 std::string Representation::getParY () const throw(AttributeNotPresentException)
104 std::map<std::string, std::string>::const_iterator it = this->attributes.find("pary");
105 if ( it == this->attributes.end() )
106 throw AttributeNotPresentException();
111 std::string Representation::getHeight () const throw(AttributeNotPresentException)
113 std::map<std::string, std::string>::const_iterator it = this->attributes.find("height");
114 if ( it == this->attributes.end() )
115 throw AttributeNotPresentException();
120 std::string Representation::getWidth () const throw(AttributeNotPresentException)
122 std::map<std::string, std::string>::const_iterator it = this->attributes.find("width");
123 if ( it == this->attributes.end())
124 throw AttributeNotPresentException();
129 std::string Representation::getBandwidth () const throw(AttributeNotPresentException)
131 std::map<std::string, std::string>::const_iterator it = this->attributes.find("bandwidth");
132 if ( it == this->attributes.end())
133 throw AttributeNotPresentException();
138 std::string Representation::getNumberOfChannels () const throw(AttributeNotPresentException)
140 std::map<std::string, std::string>::const_iterator it = this->attributes.find("numberOfChannels");
141 if( it == this->attributes.end() )
142 throw AttributeNotPresentException();
147 SegmentInfo* Representation::getSegmentInfo () const throw(ElementNotPresentException)
149 if(this->segmentInfo == NULL)
150 throw ElementNotPresentException();
152 return this->segmentInfo;
154 TrickModeType* Representation::getTrickModeType () const throw(ElementNotPresentException)
156 if(this->segmentInfo == NULL)
157 throw ElementNotPresentException();
159 return this->trickModeType;
161 ContentProtection* Representation::getContentProtection () const throw(ElementNotPresentException)
163 if(this->contentProtection == NULL)
164 throw ElementNotPresentException();
166 return this->contentProtection;
168 void Representation::setTrickModeType (TrickModeType *trickModeType)
170 this->trickModeType = trickModeType;
172 void Representation::setContentProtection (ContentProtection *protection)
174 this->contentProtection = protection;
176 void Representation::setSegmentInfo (SegmentInfo *info)
178 this->segmentInfo = info;