Commit 51e7ebd5 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: remove IMPDParser

parent 1850ed6c
...@@ -253,8 +253,6 @@ libdash_plugin_la_SOURCES = \ ...@@ -253,8 +253,6 @@ libdash_plugin_la_SOURCES = \
demux/dash/mpd/DASHSegment.h \ demux/dash/mpd/DASHSegment.h \
demux/dash/mpd/ContentDescription.cpp \ demux/dash/mpd/ContentDescription.cpp \
demux/dash/mpd/ContentDescription.h \ demux/dash/mpd/ContentDescription.h \
demux/dash/mpd/IMPDParser.cpp \
demux/dash/mpd/IMPDParser.h \
demux/dash/mpd/IsoffMainParser.cpp \ demux/dash/mpd/IsoffMainParser.cpp \
demux/dash/mpd/IsoffMainParser.h \ demux/dash/mpd/IsoffMainParser.h \
demux/dash/mpd/MPD.cpp \ demux/dash/mpd/MPD.cpp \
......
/*
* IMPDParser.cpp
*****************************************************************************
* Copyright (C) 2010 - 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.
*****************************************************************************/
#include "IMPDParser.h"
#include "xml/DOMHelper.h"
using namespace dash::mpd;
using namespace dash::xml;
IMPDParser::IMPDParser(Node *root_, MPD *mpd_, stream_t *stream, Representation *rep)
{
root = root_;
mpd = mpd_;
currentRepresentation = rep;
p_stream = stream;
}
void IMPDParser::setMPDBaseUrl(Node *root)
{
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL");
for(size_t i = 0; i < baseUrls.size(); i++)
mpd->addBaseUrl(baseUrls.at(i)->getText());
}
MPD* IMPDParser::getMPD()
{
return mpd;
}
/*
* IMPDParser.h
*****************************************************************************
* 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 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.
*****************************************************************************/
#ifndef IMPDPARSER_H_
#define IMPDPARSER_H_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "mpd/MPD.h"
#include "xml/DOMParser.h"
#include <vlc_common.h>
namespace dash
{
namespace mpd
{
class Representation;
class Period;
class IMPDParser
{
public:
IMPDParser(dash::xml::Node *, MPD*, stream_t*, Representation*);
virtual ~IMPDParser(){}
virtual bool parse (Profile profile) = 0;
virtual MPD* getMPD ();
virtual void setMPDBaseUrl(dash::xml::Node *root);
virtual void setAdaptationSets(dash::xml::Node *periodNode, Period *period) = 0;
protected:
dash::xml::Node *root;
MPD *mpd;
stream_t *p_stream;
Representation *currentRepresentation;
};
}
}
#endif /* IMPDPARSER_H_ */
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "../adaptative/playlist/SegmentBase.h" #include "../adaptative/playlist/SegmentBase.h"
#include "../adaptative/playlist/SegmentList.h" #include "../adaptative/playlist/SegmentList.h"
#include "../adaptative/playlist/SegmentTimeline.h" #include "../adaptative/playlist/SegmentTimeline.h"
#include "MPD.h"
#include "Representation.h" #include "Representation.h"
#include "Period.h" #include "Period.h"
#include "AdaptationSet.h" #include "AdaptationSet.h"
...@@ -47,14 +48,31 @@ using namespace dash::mpd; ...@@ -47,14 +48,31 @@ using namespace dash::mpd;
using namespace dash::xml; using namespace dash::xml;
using namespace adaptative::playlist; using namespace adaptative::playlist;
IsoffMainParser::IsoffMainParser (Node *root, stream_t *p_stream) : IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream)
IMPDParser(root, NULL, p_stream, NULL)
{ {
root = root_;
mpd = NULL;
currentRepresentation = NULL;
p_stream = stream;
} }
IsoffMainParser::~IsoffMainParser () IsoffMainParser::~IsoffMainParser ()
{ {
} }
void IsoffMainParser::setMPDBaseUrl(Node *root)
{
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL");
for(size_t i = 0; i < baseUrls.size(); i++)
mpd->addBaseUrl(baseUrls.at(i)->getText());
}
MPD* IsoffMainParser::getMPD()
{
return mpd;
}
bool IsoffMainParser::parse (Profile profile) bool IsoffMainParser::parse (Profile profile)
{ {
mpd = new MPD(p_stream, profile); mpd = new MPD(p_stream, profile);
......
...@@ -25,12 +25,18 @@ ...@@ -25,12 +25,18 @@
#ifndef ISOFFMAINPARSER_H_ #ifndef ISOFFMAINPARSER_H_
#define ISOFFMAINPARSER_H_ #define ISOFFMAINPARSER_H_
#include "IMPDParser.h" #ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "../adaptative/playlist/SegmentInfoCommon.h" #include "../adaptative/playlist/SegmentInfoCommon.h"
#include "mpd/Profile.hpp"
#include <cstdlib> #include <cstdlib>
#include <sstream> #include <sstream>
#include <vlc_common.h>
namespace adaptative namespace adaptative
{ {
namespace playlist namespace playlist
...@@ -51,29 +57,38 @@ namespace dash ...@@ -51,29 +57,38 @@ namespace dash
{ {
class Period; class Period;
class AdaptationSet; class AdaptationSet;
class Representation;
class MPD;
using namespace adaptative::playlist; using namespace adaptative::playlist;
class IsoffMainParser : public IMPDParser class IsoffMainParser
{ {
public: public:
IsoffMainParser (dash::xml::Node *root, stream_t *p_stream); IsoffMainParser (xml::Node *root, stream_t *p_stream);
virtual ~IsoffMainParser (); virtual ~IsoffMainParser ();
bool parse (Profile profile); bool parse (Profile profile);
virtual MPD* getMPD ();
virtual void setMPDBaseUrl(xml::Node *root);
private: private:
void setMPDAttributes (); void setMPDAttributes ();
void setAdaptationSets (dash::xml::Node *periodNode, Period *period); void setAdaptationSets (xml::Node *periodNode, Period *period);
void setRepresentations (dash::xml::Node *adaptationSetNode, AdaptationSet *adaptationSet); void setRepresentations (xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
void parseInitSegment (dash::xml::Node *, Initializable<Segment> *); void parseInitSegment (xml::Node *, Initializable<Segment> *);
void parseTimeline (dash::xml::Node *, MediaSegmentTemplate *); void parseTimeline (xml::Node *, MediaSegmentTemplate *);
void parsePeriods (dash::xml::Node *); void parsePeriods (xml::Node *);
size_t parseSegmentInformation(dash::xml::Node *, SegmentInformation *); size_t parseSegmentInformation(xml::Node *, SegmentInformation *);
size_t parseSegmentBase (dash::xml::Node *, SegmentInformation *); size_t parseSegmentBase (xml::Node *, SegmentInformation *);
size_t parseSegmentList (dash::xml::Node *, SegmentInformation *); size_t parseSegmentList (xml::Node *, SegmentInformation *);
size_t parseSegmentTemplate(dash::xml::Node *, SegmentInformation *); size_t parseSegmentTemplate(xml::Node *, SegmentInformation *);
void parseProgramInformation(dash::xml::Node *, MPD *); void parseProgramInformation(xml::Node *, MPD *);
xml::Node *root;
MPD *mpd;
stream_t *p_stream;
Representation *currentRepresentation;
}; };
class IsoTime class IsoTime
......
...@@ -27,20 +27,21 @@ ...@@ -27,20 +27,21 @@
#endif #endif
#include "MPDFactory.h" #include "MPDFactory.h"
#include "mpd/IsoffMainParser.h"
using namespace dash::xml; using namespace dash::xml;
using namespace dash::mpd; using namespace dash::mpd;
MPD* MPDFactory::create (dash::xml::Node *root, stream_t *p_stream, Profile profile) MPD* MPDFactory::create(Node *root, stream_t *p_stream, Profile profile)
{ {
IMPDParser *parser = NULL; IsoffMainParser *parser = NULL;
switch( profile ) switch( profile )
{ {
case Profile::Unknown: case Profile::Unknown:
break; break;
default: default:
parser = new IsoffMainParser(root, p_stream); parser = new (std::nothrow) IsoffMainParser(root, p_stream);
break; break;
} }
......
...@@ -21,21 +21,25 @@ ...@@ -21,21 +21,25 @@
* along with this program; if not, write to the Free Software Foundation, * along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef MPDFACTORY_H_ #ifndef MPDFACTORY_H_
#define MPDFACTORY_H_ #define MPDFACTORY_H_
#include "mpd/MPD.h" #include "mpd/MPD.h"
#include "mpd/IsoffMainParser.h" #include "mpd/Profile.hpp"
namespace dash namespace dash
{ {
namespace xml
{
class Node;
}
namespace mpd namespace mpd
{ {
class MPDFactory class MPDFactory
{ {
public: public:
static MPD* create(dash::xml::Node *root, stream_t *p_stream, Profile profile); static MPD* create(xml::Node *root, stream_t *p_stream, Profile profile);
}; };
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment