]> git.sesse.net Git - vlc/blob - modules/stream_filter/dash/mpd/MPD.cpp
dash: added isoffmainmanager
[vlc] / modules / stream_filter / dash / mpd / MPD.cpp
1 /*
2  * MPD.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 "MPD.h"
29
30 using namespace dash::mpd;
31
32 MPD::MPD () :
33     profile( dash::mpd::UnknownProfile ),
34     live( false ),
35     availabilityStartTime( -1 ),
36     availabilityEndTime( -1 ),
37     duration( -1 ),
38     minUpdatePeriod( -1 ),
39     minBufferTime( -1 ),
40     timeShiftBufferDepth( -1 ),
41     programInfo( NULL )
42 {
43 }
44
45 MPD::~MPD   ()
46 {
47     for(size_t i = 0; i < this->periods.size(); i++)
48         delete(this->periods.at(i));
49
50     for(size_t i = 0; i < this->baseUrls.size(); i++)
51         delete(this->baseUrls.at(i));
52
53     delete(this->programInfo);
54 }
55
56 const std::vector<Period*>&    MPD::getPeriods             () const
57 {
58     return this->periods;
59 }
60
61 const std::vector<BaseUrl*>&   MPD::getBaseUrls            () const
62 {
63     return this->baseUrls;
64 }
65
66
67 time_t      MPD::getDuration() const
68 {
69     return this->duration;
70 }
71
72 void MPD::setDuration(time_t duration)
73 {
74     if ( duration >= 0 )
75         this->duration = duration;
76 }
77
78 time_t MPD::getMinUpdatePeriod() const
79 {
80     return this->minUpdatePeriod;
81 }
82
83 void MPD::setMinUpdatePeriod(time_t period)
84 {
85     if ( period >= 0 )
86         this->minUpdatePeriod = period;
87 }
88
89 time_t MPD::getMinBufferTime() const
90 {
91     return this->minBufferTime;
92 }
93
94 void MPD::setMinBufferTime(time_t time)
95 {
96     if ( time >= 0 )
97         this->minBufferTime = time;
98 }
99
100 time_t MPD::getTimeShiftBufferDepth() const
101 {
102     return this->timeShiftBufferDepth;
103 }
104
105 void MPD::setTimeShiftBufferDepth(time_t depth)
106 {
107     if ( depth >= 0 )
108         this->timeShiftBufferDepth = depth;
109 }
110
111 const ProgramInformation*     MPD::getProgramInformation  () const
112 {
113     return this->programInfo;
114 }
115
116 void                    MPD::addBaseUrl             (BaseUrl *url)
117 {
118     this->baseUrls.push_back(url);
119 }
120 void                    MPD::addPeriod              (Period *period)
121 {
122     this->periods.push_back(period);
123 }
124 void                    MPD::setProgramInformation  (ProgramInformation *progInfo)
125 {
126     this->programInfo = progInfo;
127 }
128
129 bool                    MPD::isLive() const
130 {
131     return this->live;
132 }
133
134 void                    MPD::setLive( bool live )
135 {
136     this->live = live;
137 }
138
139 time_t MPD::getAvailabilityStartTime() const
140 {
141     return this->availabilityStartTime;
142 }
143
144 void MPD::setAvailabilityStartTime(time_t time)
145 {
146     if ( time >=0 )
147         this->availabilityStartTime = time;
148 }
149
150 time_t MPD::getAvailabilityEndTime() const
151 {
152     return this->availabilityEndTime;
153 }
154
155 void MPD::setAvailabilityEndTime(time_t time)
156 {
157     if ( time >= 0 )
158         this->availabilityEndTime = time;
159 }
160
161 Profile MPD::getProfile() const
162 {
163     return this->profile;
164 }
165
166 void MPD::setProfile(Profile profile)
167 {
168     this->profile = profile;
169 }
170
171 void MPD::setProfile( const std::string &strProfile )
172 {
173     if( strProfile == "urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm" )
174         this->profile = dash::mpd::BasicCM;
175     else if ( strProfile == "urn:mpeg:mpegB:profile:dash:full:2011" )
176         this->profile = dash::mpd::Full2011;
177     else if ( strProfile == "urn:mpeg:dash:profile:isoff-main:2011" )
178         this->profile = dash::mpd::IsoffMain;
179     else
180         this->profile = dash::mpd::UnknownProfile;
181 }