MPDFactory.cpp 1.71 KB
Newer Older
Christopher Mueller's avatar
Christopher Mueller committed
1
2
3
4
5
6
7
8
9
/*
 * MPDFactory.cpp
 *****************************************************************************
 * Copyright (C) 2010 - 2012 Klagenfurt University
 *
 * Created on: Jan 27, 2012
 * 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
Christopher Mueller's avatar
Christopher Mueller committed
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.
Christopher Mueller's avatar
Christopher Mueller committed
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.
Christopher Mueller's avatar
Christopher Mueller committed
23
24
 *****************************************************************************/

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

Christopher Mueller's avatar
Christopher Mueller committed
29
30
31
32
33
#include "MPDFactory.h"

using namespace dash::xml;
using namespace dash::mpd;

34
MPD* MPDFactory::create             (dash::xml::Node *root, stream_t *p_stream, Profile profile)
Christopher Mueller's avatar
Christopher Mueller committed
35
{
36
37
    IMPDParser *parser = NULL;

38
    switch( profile )
Christopher Mueller's avatar
Christopher Mueller committed
39
    {
40
41
        case Profile::Unknown:
            break;
42
        default:
43
            parser = new IsoffMainParser(root, p_stream);
44
            break;
Christopher Mueller's avatar
Christopher Mueller committed
45
46
    }

47
    if(!parser)
Christopher Mueller's avatar
Christopher Mueller committed
48
49
        return NULL;

50
    MPD* mpd = NULL;
51
    if(parser->parse(profile))
52
53
54
55
56
        mpd = parser->getMPD();

    delete parser;

    return mpd;
Christopher Mueller's avatar
Christopher Mueller committed
57
}