Commit 4c6b8b70 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: dash: drop mpdfactory

parent 877863da
......@@ -352,8 +352,6 @@ libadaptative_dash_SOURCES = \
demux/dash/mpd/IsoffMainParser.h \
demux/dash/mpd/MPD.cpp \
demux/dash/mpd/MPD.h \
demux/dash/mpd/MPDFactory.cpp \
demux/dash/mpd/MPDFactory.h \
demux/dash/mpd/Period.cpp \
demux/dash/mpd/Period.h \
demux/dash/mpd/Profile.cpp \
......
......@@ -35,9 +35,9 @@
#include "playlist/BasePeriod.h"
#include "xml/DOMParser.h"
#include "../dash/mpd/MPDFactory.h"
#include "../dash/DASHManager.h"
#include "../dash/DASHStream.hpp"
#include "../dash/mpd/IsoffMainParser.h"
#include "../hls/HLSManager.hpp"
#include "../hls/HLSStreams.hpp"
......@@ -133,8 +133,8 @@ static int Open(vlc_object_t *p_obj)
return VLC_EGENERIC;
}
//Begin the actual MPD parsing:
MPD *p_playlist = MPDFactory::create(parser.getRootNode(), p_demux->s, playlisturl);
IsoffMainParser mpdparser(parser.getRootNode(), p_demux->s, playlisturl);
MPD *p_playlist = mpdparser.parse();
if(p_playlist == NULL)
{
msg_Err( p_demux, "Cannot create/unknown MPD for profile");
......
......@@ -29,8 +29,8 @@
#include <inttypes.h>
#include "DASHManager.h"
#include "mpd/MPDFactory.h"
#include "mpd/ProgramInformation.h"
#include "mpd/IsoffMainParser.h"
#include "xml/DOMParser.h"
#include "../adaptative/tools/Helper.h"
#include "../adaptative/http/HTTPConnectionManager.h"
......@@ -104,8 +104,9 @@ bool DASHManager::updatePlaylist()
minsegmentTime = segmentTime;
}
MPD *newmpd = MPDFactory::create(parser.getRootNode(), mpdstream,
Helper::getDirectoryPath(url).append("/"));
IsoffMainParser mpdparser(parser.getRootNode(), mpdstream,
Helper::getDirectoryPath(url).append("/"));
MPD *newmpd = mpdparser.parse();
if(newmpd)
{
playlist->mergeWith(newmpd, minsegmentTime);
......
......@@ -72,14 +72,9 @@ void IsoffMainParser::setMPDBaseUrl(Node *root)
mpd->setPlaylistUrl( Helper::getDirectoryPath(playlisturl).append("/") );
}
MPD* IsoffMainParser::getMPD()
MPD * IsoffMainParser::parse()
{
return mpd;
}
bool IsoffMainParser::parse (Profile profile)
{
mpd = new MPD(p_stream, profile);
mpd = new MPD(p_stream, getProfile());
setMPDAttributes();
parseProgramInformation(DOMHelper::getFirstChildElementByName(root, "ProgramInformation"), mpd);
setMPDBaseUrl(root);
......@@ -87,7 +82,7 @@ bool IsoffMainParser::parse (Profile profile)
if(mpd)
mpd->debug();
return true;
return mpd;
}
void IsoffMainParser::setMPDAttributes ()
......
......@@ -65,13 +65,11 @@ namespace dash
public:
IsoffMainParser (xml::Node *root, stream_t *p_stream, std::string &);
virtual ~IsoffMainParser ();
bool parse (Profile profile);
virtual MPD* getMPD ();
virtual void setMPDBaseUrl(xml::Node *root);
mpd::Profile getProfile() const;
MPD * parse();
private:
mpd::Profile getProfile () const;
void setMPDBaseUrl (xml::Node *root);
void setMPDAttributes ();
void setAdaptationSets (xml::Node *periodNode, Period *period);
void setRepresentations (xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
......
/*
* 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>
*
* 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
#include "MPDFactory.h"
#include "IsoffMainParser.h"
using namespace dash::mpd;
using namespace adaptative::xml;
MPD* MPDFactory::create(Node *root, stream_t *p_stream, std::string & playlisturl)
{
IsoffMainParser *parser = new (std::nothrow) IsoffMainParser(root, p_stream, playlisturl);
if(!parser)
return NULL;
MPD* mpd = NULL;
Profile profile = parser->getProfile();
if(!(profile == Profile::Unknown) && parser->parse(profile))
mpd = parser->getMPD();
delete parser;
return mpd;
}
/*
* MPDFactory.h
*****************************************************************************
* 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>
*
* 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 MPDFACTORY_H_
#define MPDFACTORY_H_
#include "MPD.h"
#include "Profile.hpp"
namespace adaptative
{
namespace xml
{
class Node;
}
}
namespace dash
{
namespace mpd
{
using namespace adaptative;
class MPDFactory
{
public:
static MPD* create(xml::Node *root, stream_t *p_stream, std::string &);
};
}
}
#endif /* MPDFACTORY_H_ */
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