Representation.cpp 6.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*
 * Representation.cpp
 *****************************************************************************
 * Copyright (C) 2010 - 2011 Klagenfurt University
 *
 * Created on: Aug 10, 2010
 * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
 *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "Representation.h"

using namespace dash::mpd;
using namespace dash::exception;

33 34 35 36 37
Representation::Representation  (const std::map<std::string, std::string>&  attributes) :
    attributes( attributes ),
    segmentInfo( NULL ),
    trickModeType( NULL ),
    contentProtection( NULL )
38 39
{
}
40

41 42 43 44 45 46 47
Representation::~Representation ()
{
    delete(this->segmentInfo);
    delete(this->contentProtection);
    delete(this->trickModeType);
}

48
std::string         Representation::getFrameRate            () const throw(AttributeNotPresentException)
49
{
50 51
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("frameRate");
    if ( it == this->attributes.end())
52 53
        throw AttributeNotPresentException();

54
    return it->second;
55 56

}
57
std::string         Representation::getSamplingRate         () const throw(AttributeNotPresentException)
58
{
59 60
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("samplingRate");
    if ( it == this->attributes.end() )
61 62
        throw AttributeNotPresentException();

63
    return it->second;
64 65

}
66
std::string         Representation::getDependencyId         () const throw(AttributeNotPresentException)
67
{
68 69
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("dependencyId");
    if ( it == this->attributes.end() )
70 71
        throw AttributeNotPresentException();

72
    return it->second;
73 74

}
75
std::string         Representation::getId                   () const throw(AttributeNotPresentException)
76
{
77 78
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("id");
    if ( it == this->attributes.end())
79 80
        throw AttributeNotPresentException();

81
    return it->second;
82 83

}
84
std::string         Representation::getLang                 () const throw(AttributeNotPresentException)
85
{
86 87
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("lang");
    if ( it == this->attributes.end() )
88 89
        throw AttributeNotPresentException();

90
    return it->second;
91 92

}
93
std::string         Representation::getParX                 () const throw(AttributeNotPresentException)
94
{
95 96
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("parx");
    if ( it == this->attributes.end())
97 98
        throw AttributeNotPresentException();

99
    return it->second;
100 101

}
102
std::string         Representation::getParY                 () const throw(AttributeNotPresentException)
103
{
104 105
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("pary");
    if ( it == this->attributes.end() )
106 107
        throw AttributeNotPresentException();

108
    return it->second;
109 110

}
111
std::string         Representation::getHeight               () const throw(AttributeNotPresentException)
112
{
113 114
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("height");
    if ( it == this->attributes.end() )
115 116
        throw AttributeNotPresentException();

117
    return it->second;
118 119

}
120
std::string         Representation::getWidth                () const throw(AttributeNotPresentException)
121
{
122 123
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("width");
    if ( it == this->attributes.end())
124 125
        throw AttributeNotPresentException();

126
    return it->second;
127 128

}
129
std::string         Representation::getBandwidth            () const throw(AttributeNotPresentException)
130
{
131 132
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("bandwidth");
    if ( it == this->attributes.end())
133 134
        throw AttributeNotPresentException();

135
    return it->second;
136 137

}
138
std::string         Representation::getNumberOfChannels     () const throw(AttributeNotPresentException)
139
{
140 141
    std::map<std::string, std::string>::const_iterator  it = this->attributes.find("numberOfChannels");
    if( it == this->attributes.end() )
142 143
        throw AttributeNotPresentException();

144
    return it->second;
145 146

}
147
SegmentInfo*        Representation::getSegmentInfo          () const throw(ElementNotPresentException)
148 149 150 151 152 153
{
    if(this->segmentInfo == NULL)
        throw ElementNotPresentException();

    return this->segmentInfo;
}
154
TrickModeType*      Representation::getTrickModeType        () const throw(ElementNotPresentException)
155 156 157 158 159 160
{
    if(this->segmentInfo == NULL)
        throw ElementNotPresentException();

    return this->trickModeType;
}
161
ContentProtection*  Representation::getContentProtection    () const throw(ElementNotPresentException)
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
{
    if(this->contentProtection == NULL)
        throw ElementNotPresentException();

    return this->contentProtection;
}
void                Representation::setTrickModeType        (TrickModeType *trickModeType)
{
    this->trickModeType = trickModeType;
}
void                Representation::setContentProtection    (ContentProtection *protection)
{
    this->contentProtection = protection;
}
void                Representation::setSegmentInfo          (SegmentInfo *info)
{
    this->segmentInfo = info;
}