MPDManager.cpp 1.77 KB
Newer Older
1
/*
2
 * MPDManager.cpp
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *****************************************************************************
 * Copyright (C) 2014 - VideoLAN Authors
 *
 * 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 Lesser 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

24
#include "MPDManager.hpp"
25
#include <limits>
26 27 28

using namespace dash::mpd;

29
MPDManager::MPDManager(MPD *mpd_) :
30
    mpd(mpd_)
31
{
32 33 34

}

35
MPDManager::~MPDManager()
36 37 38 39
{
    delete mpd;
}

40
const std::vector<Period*>& MPDManager::getPeriods() const
41 42 43 44
{
    return mpd->getPeriods();
}

45
Period* MPDManager::getFirstPeriod() const
46 47 48 49 50 51 52 53 54
{
    std::vector<Period *> periods = getPeriods();

    if( !periods.empty() )
        return periods.front();
    else
        return NULL;
}

55
Period* MPDManager::getNextPeriod(Period *period)
56 57 58 59
{
    std::vector<Period *> periods = getPeriods();

    for(size_t i = 0; i < periods.size(); i++)
60
    {
61 62
        if(periods.at(i) == period && (i + 1) < periods.size())
            return periods.at(i + 1);
63
    }
64 65 66 67

    return NULL;
}

68
const MPD* MPDManager::getMPD() const
69 70 71
{
    return mpd;
}