AdaptationSet.cpp 3.07 KB
Newer Older
1
2
3
/*
 * AdaptationSet.cpp
 *****************************************************************************
4
 * Copyright (C) 2010 - 2011 Klagenfurt University
5
 *
6
 * Created on: Aug 10, 2010
7
8
9
 * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
 *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
 *
10
11
 * 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
12
13
14
15
16
 * 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
17
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
19
20
 *
 * You should have received a copy of the GNU Lesser General Public License
21
22
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
24
 *****************************************************************************/

25
26
27
28
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

29
30
#include "AdaptationSet.h"

31
32
33
34
35
#include <vlc_common.h>
#include <vlc_arrays.h>

#include "SegmentInfoDefault.h"

36
37
using namespace dash::mpd;

38
39
40
41
AdaptationSet::AdaptationSet() :
    subsegmentAlignmentFlag( false ),
    segmentInfoDefault( NULL ),
    isBitstreamSwitching( false )
42
43
{
}
44

45
46
AdaptationSet::~AdaptationSet   ()
{
47
48
49
50
    delete this->segmentInfoDefault;
    vlc_delete_all( this->representations );
}

51
52
53
54
55
56
57
58
const std::string& AdaptationSet::getMimeType() const
{
    if (mimeType.empty() && !representations.empty())
        return representations.front()->getMimeType();
    else
        return mimeType;
}

59
60
61
62
63
64
65
66
67
68
bool                AdaptationSet::getSubsegmentAlignmentFlag() const
{
    return this->subsegmentAlignmentFlag;
}

void AdaptationSet::setSubsegmentAlignmentFlag(bool alignment)
{
    this->subsegmentAlignmentFlag = alignment;
}

69
std::vector<Representation*>&    AdaptationSet::getRepresentations       ()
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
    return this->representations;
}

const Representation *AdaptationSet::getRepresentationById(const std::string &id) const
{
    std::vector<Representation*>::const_iterator    it = this->representations.begin();
    std::vector<Representation*>::const_iterator    end = this->representations.end();

    while ( it != end )
    {
        if ( (*it)->getId() == id )
            return *it;
        ++it;
    }
    return NULL;
}

const SegmentInfoDefault *AdaptationSet::getSegmentInfoDefault() const
{
    return this->segmentInfoDefault;
}

void AdaptationSet::setSegmentInfoDefault(const SegmentInfoDefault *seg)
{
    if ( seg != NULL )
        this->segmentInfoDefault = seg;
}

void                            AdaptationSet::addRepresentation        (Representation *rep)
{
    this->representations.push_back(rep);
102
103
104
105
106
107
}

void AdaptationSet::setBitstreamSwitching  (bool value)
{
    this->isBitstreamSwitching = value;
}
108

109
110
111
112
bool AdaptationSet::getBitstreamSwitching  () const
{
    return this->isBitstreamSwitching;
}