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 (std::map<std::string, std::string> attributes)
35 this->attributes = attributes;
36 this->contentProtection = NULL;
37 this->trickModeType = NULL;
38 this->segmentInfo = NULL;
40 Representation::~Representation ()
42 delete(this->segmentInfo);
43 delete(this->contentProtection);
44 delete(this->trickModeType);
47 std::string Representation::getFrameRate () throw(AttributeNotPresentException)
49 if(this->attributes.find("frameRate") == this->attributes.end())
50 throw AttributeNotPresentException();
52 return this->attributes["frameRate"];
55 std::string Representation::getSamplingRate () throw(AttributeNotPresentException)
57 if(this->attributes.find("samplingRate") == this->attributes.end())
58 throw AttributeNotPresentException();
60 return this->attributes["samplingRate"];
63 std::string Representation::getDependencyId () throw(AttributeNotPresentException)
65 if(this->attributes.find("dependencyId") == this->attributes.end())
66 throw AttributeNotPresentException();
68 return this->attributes["dependencyId"];
71 std::string Representation::getId () throw(AttributeNotPresentException)
73 if(this->attributes.find("id") == this->attributes.end())
74 throw AttributeNotPresentException();
76 return this->attributes["id"];
79 std::string Representation::getLang () throw(AttributeNotPresentException)
81 if(this->attributes.find("lang") == this->attributes.end())
82 throw AttributeNotPresentException();
84 return this->attributes["lang"];
87 std::string Representation::getParX () throw(AttributeNotPresentException)
89 if(this->attributes.find("parx") == this->attributes.end())
90 throw AttributeNotPresentException();
92 return this->attributes["parx"];
95 std::string Representation::getParY () throw(AttributeNotPresentException)
97 if(this->attributes.find("pary") == this->attributes.end())
98 throw AttributeNotPresentException();
100 return this->attributes["pary"];
103 std::string Representation::getHeight () throw(AttributeNotPresentException)
105 if(this->attributes.find("height") == this->attributes.end())
106 throw AttributeNotPresentException();
108 return this->attributes["height"];
111 std::string Representation::getWidth () throw(AttributeNotPresentException)
113 if(this->attributes.find("width") == this->attributes.end())
114 throw AttributeNotPresentException();
116 return this->attributes["width"];
119 std::string Representation::getBandwidth () throw(AttributeNotPresentException)
121 if(this->attributes.find("bandwidth") == this->attributes.end())
122 throw AttributeNotPresentException();
124 return this->attributes["bandwidth"];
127 std::string Representation::getNumberOfChannels () throw(AttributeNotPresentException)
129 if(this->attributes.find("numberOfChannels") == this->attributes.end())
130 throw AttributeNotPresentException();
132 return this->attributes["numberOfChannels"];
135 SegmentInfo* Representation::getSegmentInfo () throw(ElementNotPresentException)
137 if(this->segmentInfo == NULL)
138 throw ElementNotPresentException();
140 return this->segmentInfo;
142 TrickModeType* Representation::getTrickModeType () throw(ElementNotPresentException)
144 if(this->segmentInfo == NULL)
145 throw ElementNotPresentException();
147 return this->trickModeType;
149 ContentProtection* Representation::getContentProtection () throw(ElementNotPresentException)
151 if(this->contentProtection == NULL)
152 throw ElementNotPresentException();
154 return this->contentProtection;
156 void Representation::setTrickModeType (TrickModeType *trickModeType)
158 this->trickModeType = trickModeType;
160 void Representation::setContentProtection (ContentProtection *protection)
162 this->contentProtection = protection;
164 void Representation::setSegmentInfo (SegmentInfo *info)
166 this->segmentInfo = info;