]> git.sesse.net Git - vlc/blob - modules/stream_filter/dash/mpd/Representation.cpp
Added DASH stream filter
[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  (std::map<std::string, std::string>  attributes)
34 {
35     this->attributes        = attributes;
36     this->contentProtection = NULL;
37     this->trickModeType     = NULL;
38     this->segmentInfo       = NULL;
39 }
40 Representation::~Representation ()
41 {
42     delete(this->segmentInfo);
43     delete(this->contentProtection);
44     delete(this->trickModeType);
45 }
46
47 std::string         Representation::getFrameRate            () throw(AttributeNotPresentException)
48 {
49     if(this->attributes.find("frameRate") == this->attributes.end())
50         throw AttributeNotPresentException();
51
52     return this->attributes["frameRate"];
53
54 }
55 std::string         Representation::getSamplingRate         () throw(AttributeNotPresentException)
56 {
57     if(this->attributes.find("samplingRate") == this->attributes.end())
58         throw AttributeNotPresentException();
59
60     return this->attributes["samplingRate"];
61
62 }
63 std::string         Representation::getDependencyId         () throw(AttributeNotPresentException)
64 {
65     if(this->attributes.find("dependencyId") == this->attributes.end())
66         throw AttributeNotPresentException();
67
68     return this->attributes["dependencyId"];
69
70 }
71 std::string         Representation::getId                   () throw(AttributeNotPresentException)
72 {
73     if(this->attributes.find("id") == this->attributes.end())
74         throw AttributeNotPresentException();
75
76     return this->attributes["id"];
77
78 }
79 std::string         Representation::getLang                 () throw(AttributeNotPresentException)
80 {
81     if(this->attributes.find("lang") == this->attributes.end())
82         throw AttributeNotPresentException();
83
84     return this->attributes["lang"];
85
86 }
87 std::string         Representation::getParX                 () throw(AttributeNotPresentException)
88 {
89     if(this->attributes.find("parx") == this->attributes.end())
90         throw AttributeNotPresentException();
91
92     return this->attributes["parx"];
93
94 }
95 std::string         Representation::getParY                 () throw(AttributeNotPresentException)
96 {
97     if(this->attributes.find("pary") == this->attributes.end())
98         throw AttributeNotPresentException();
99
100     return this->attributes["pary"];
101
102 }
103 std::string         Representation::getHeight               () throw(AttributeNotPresentException)
104 {
105     if(this->attributes.find("height") == this->attributes.end())
106         throw AttributeNotPresentException();
107
108     return this->attributes["height"];
109
110 }
111 std::string         Representation::getWidth                () throw(AttributeNotPresentException)
112 {
113     if(this->attributes.find("width") == this->attributes.end())
114         throw AttributeNotPresentException();
115
116     return this->attributes["width"];
117
118 }
119 std::string         Representation::getBandwidth            () throw(AttributeNotPresentException)
120 {
121     if(this->attributes.find("bandwidth") == this->attributes.end())
122         throw AttributeNotPresentException();
123
124     return this->attributes["bandwidth"];
125
126 }
127 std::string         Representation::getNumberOfChannels     () throw(AttributeNotPresentException)
128 {
129     if(this->attributes.find("numberOfChannels") == this->attributes.end())
130         throw AttributeNotPresentException();
131
132     return this->attributes["numberOfChannels"];
133
134 }
135 SegmentInfo*        Representation::getSegmentInfo          () throw(ElementNotPresentException)
136 {
137     if(this->segmentInfo == NULL)
138         throw ElementNotPresentException();
139
140     return this->segmentInfo;
141 }
142 TrickModeType*      Representation::getTrickModeType        () throw(ElementNotPresentException)
143 {
144     if(this->segmentInfo == NULL)
145         throw ElementNotPresentException();
146
147     return this->trickModeType;
148 }
149 ContentProtection*  Representation::getContentProtection    () throw(ElementNotPresentException)
150 {
151     if(this->contentProtection == NULL)
152         throw ElementNotPresentException();
153
154     return this->contentProtection;
155 }
156 void                Representation::setTrickModeType        (TrickModeType *trickModeType)
157 {
158     this->trickModeType = trickModeType;
159 }
160 void                Representation::setContentProtection    (ContentProtection *protection)
161 {
162     this->contentProtection = protection;
163 }
164 void                Representation::setSegmentInfo          (SegmentInfo *info)
165 {
166     this->segmentInfo = info;
167 }