]> git.sesse.net Git - vlc/blob - modules/stream_filter/dash/mpd/Representation.cpp
dash: Representation: Cosmetics.
[vlc] / modules / stream_filter / dash / mpd / Representation.cpp
1 /*
2  * Representation.cpp
3  *****************************************************************************
4  * Copyright (C) 2010 - 2011 Klagenfurt University
5  *
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>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27
28 #include "Representation.h"
29
30 using namespace dash::mpd;
31 using namespace dash::exception;
32
33 Representation::Representation  (const std::map<std::string, std::string>&  attributes) :
34     attributes( attributes ),
35     segmentInfo( NULL ),
36     trickModeType( NULL ),
37     contentProtection( NULL )
38 {
39 }
40
41 Representation::~Representation ()
42 {
43     delete(this->segmentInfo);
44     delete(this->contentProtection);
45     delete(this->trickModeType);
46 }
47
48 std::string         Representation::getFrameRate            () const throw(AttributeNotPresentException)
49 {
50     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("frameRate");
51     if ( it == this->attributes.end())
52         throw AttributeNotPresentException();
53
54     return it->second;
55
56 }
57 std::string         Representation::getSamplingRate         () const throw(AttributeNotPresentException)
58 {
59     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("samplingRate");
60     if ( it == this->attributes.end() )
61         throw AttributeNotPresentException();
62
63     return it->second;
64
65 }
66 std::string         Representation::getDependencyId         () const throw(AttributeNotPresentException)
67 {
68     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("dependencyId");
69     if ( it == this->attributes.end() )
70         throw AttributeNotPresentException();
71
72     return it->second;
73
74 }
75 std::string         Representation::getId                   () const throw(AttributeNotPresentException)
76 {
77     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("id");
78     if ( it == this->attributes.end())
79         throw AttributeNotPresentException();
80
81     return it->second;
82
83 }
84 std::string         Representation::getLang                 () const throw(AttributeNotPresentException)
85 {
86     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("lang");
87     if ( it == this->attributes.end() )
88         throw AttributeNotPresentException();
89
90     return it->second;
91
92 }
93 std::string         Representation::getParX                 () const throw(AttributeNotPresentException)
94 {
95     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("parx");
96     if ( it == this->attributes.end())
97         throw AttributeNotPresentException();
98
99     return it->second;
100
101 }
102 std::string         Representation::getParY                 () const throw(AttributeNotPresentException)
103 {
104     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("pary");
105     if ( it == this->attributes.end() )
106         throw AttributeNotPresentException();
107
108     return it->second;
109
110 }
111 std::string         Representation::getHeight               () const throw(AttributeNotPresentException)
112 {
113     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("height");
114     if ( it == this->attributes.end() )
115         throw AttributeNotPresentException();
116
117     return it->second;
118
119 }
120 std::string         Representation::getWidth                () const throw(AttributeNotPresentException)
121 {
122     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("width");
123     if ( it == this->attributes.end())
124         throw AttributeNotPresentException();
125
126     return it->second;
127
128 }
129 std::string         Representation::getBandwidth            () const throw(AttributeNotPresentException)
130 {
131     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("bandwidth");
132     if ( it == this->attributes.end())
133         throw AttributeNotPresentException();
134
135     return it->second;
136
137 }
138 std::string         Representation::getNumberOfChannels     () const throw(AttributeNotPresentException)
139 {
140     std::map<std::string, std::string>::const_iterator  it = this->attributes.find("numberOfChannels");
141     if( it == this->attributes.end() )
142         throw AttributeNotPresentException();
143
144     return it->second;
145
146 }
147 SegmentInfo*        Representation::getSegmentInfo          () const throw(ElementNotPresentException)
148 {
149     if(this->segmentInfo == NULL)
150         throw ElementNotPresentException();
151
152     return this->segmentInfo;
153 }
154 TrickModeType*      Representation::getTrickModeType        () const throw(ElementNotPresentException)
155 {
156     if(this->segmentInfo == NULL)
157         throw ElementNotPresentException();
158
159     return this->trickModeType;
160 }
161 ContentProtection*  Representation::getContentProtection    () const throw(ElementNotPresentException)
162 {
163     if(this->contentProtection == NULL)
164         throw ElementNotPresentException();
165
166     return this->contentProtection;
167 }
168 void                Representation::setTrickModeType        (TrickModeType *trickModeType)
169 {
170     this->trickModeType = trickModeType;
171 }
172 void                Representation::setContentProtection    (ContentProtection *protection)
173 {
174     this->contentProtection = protection;
175 }
176 void                Representation::setSegmentInfo          (SegmentInfo *info)
177 {
178     this->segmentInfo = info;
179 }