Commit 9df6750e authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: dash: drop MPGManager{Factory,}

Was useless proxy for periods
parent 737a297d
...@@ -45,8 +45,6 @@ libdash_plugin_la_SOURCES = \ ...@@ -45,8 +45,6 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/CommonAttributesElements.h \ stream_filter/dash/mpd/CommonAttributesElements.h \
stream_filter/dash/mpd/ContentDescription.cpp \ stream_filter/dash/mpd/ContentDescription.cpp \
stream_filter/dash/mpd/ContentDescription.h \ stream_filter/dash/mpd/ContentDescription.h \
stream_filter/dash/mpd/MPDManager.hpp \
stream_filter/dash/mpd/MPDManager.cpp \
stream_filter/dash/mpd/ICanonicalUrl.hpp \ stream_filter/dash/mpd/ICanonicalUrl.hpp \
stream_filter/dash/mpd/IMPDParser.cpp \ stream_filter/dash/mpd/IMPDParser.cpp \
stream_filter/dash/mpd/IMPDParser.h \ stream_filter/dash/mpd/IMPDParser.h \
...@@ -56,8 +54,6 @@ libdash_plugin_la_SOURCES = \ ...@@ -56,8 +54,6 @@ libdash_plugin_la_SOURCES = \
stream_filter/dash/mpd/MPD.h \ stream_filter/dash/mpd/MPD.h \
stream_filter/dash/mpd/MPDFactory.cpp \ stream_filter/dash/mpd/MPDFactory.cpp \
stream_filter/dash/mpd/MPDFactory.h \ stream_filter/dash/mpd/MPDFactory.h \
stream_filter/dash/mpd/MPDManagerFactory.cpp \
stream_filter/dash/mpd/MPDManagerFactory.h \
stream_filter/dash/mpd/Period.cpp \ stream_filter/dash/mpd/Period.cpp \
stream_filter/dash/mpd/Period.h \ stream_filter/dash/mpd/Period.h \
stream_filter/dash/mpd/Profile.cpp \ stream_filter/dash/mpd/Profile.cpp \
......
...@@ -39,7 +39,6 @@ DASHManager::DASHManager ( MPD *mpd, ...@@ -39,7 +39,6 @@ DASHManager::DASHManager ( MPD *mpd,
conManager ( NULL ), conManager ( NULL ),
adaptationLogic( NULL ), adaptationLogic( NULL ),
logicType ( type ), logicType ( type ),
mpdManager ( NULL ),
mpd ( mpd ), mpd ( mpd ),
stream ( stream ), stream ( stream ),
downloader ( NULL ), downloader ( NULL ),
...@@ -52,17 +51,11 @@ DASHManager::~DASHManager () ...@@ -52,17 +51,11 @@ DASHManager::~DASHManager ()
delete this->buffer; delete this->buffer;
delete this->conManager; delete this->conManager;
delete this->adaptationLogic; delete this->adaptationLogic;
delete this->mpdManager;
} }
bool DASHManager::start() bool DASHManager::start()
{ {
this->mpdManager = mpd::MPDManagerFactory::create( mpd ); adaptationLogic = AdaptationLogicFactory::create( logicType, mpd );
if ( this->mpdManager == NULL )
return false;
adaptationLogic = AdaptationLogicFactory::create( logicType, mpdManager );
if ( this->adaptationLogic == NULL ) if ( this->adaptationLogic == NULL )
return false; return false;
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
#include "xml/Node.h" #include "xml/Node.h"
#include "adaptationlogic/IAdaptationLogic.h" #include "adaptationlogic/IAdaptationLogic.h"
#include "adaptationlogic/AdaptationLogicFactory.h" #include "adaptationlogic/AdaptationLogicFactory.h"
#include "mpd/MPDManager.hpp"
#include "mpd/MPDManagerFactory.h"
#include "buffer/BlockBuffer.h" #include "buffer/BlockBuffer.h"
#include "DASHDownloader.h" #include "DASHDownloader.h"
#include "mpd/MPD.h" #include "mpd/MPD.h"
...@@ -55,7 +53,6 @@ namespace dash ...@@ -55,7 +53,6 @@ namespace dash
http::HTTPConnectionManager *conManager; http::HTTPConnectionManager *conManager;
logic::IAdaptationLogic *adaptationLogic; logic::IAdaptationLogic *adaptationLogic;
logic::IAdaptationLogic::LogicType logicType; logic::IAdaptationLogic::LogicType logicType;
mpd::MPDManager *mpdManager;
mpd::MPD *mpd; mpd::MPD *mpd;
stream_t *stream; stream_t *stream;
DASHDownloader *downloader; DASHDownloader *downloader;
......
...@@ -31,8 +31,8 @@ using namespace dash::logic; ...@@ -31,8 +31,8 @@ using namespace dash::logic;
using namespace dash::xml; using namespace dash::xml;
using namespace dash::mpd; using namespace dash::mpd;
AbstractAdaptationLogic::AbstractAdaptationLogic (MPDManager *mpdManager) : AbstractAdaptationLogic::AbstractAdaptationLogic (MPD *mpd_) :
mpdManager (mpdManager), mpd (mpd_),
bpsAvg (0), bpsAvg (0),
bpsLastChunk (0), bpsLastChunk (0),
bufferedMicroSec (0), bufferedMicroSec (0),
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "xml/Node.h" #include "xml/Node.h"
#include "http/Chunk.h" #include "http/Chunk.h"
#include "mpd/MPD.h" #include "mpd/MPD.h"
#include "mpd/MPDManager.hpp"
#include "mpd/Period.h" #include "mpd/Period.h"
#include "mpd/Representation.h" #include "mpd/Representation.h"
#include "mpd/Segment.h" #include "mpd/Segment.h"
...@@ -43,7 +42,7 @@ namespace dash ...@@ -43,7 +42,7 @@ namespace dash
class AbstractAdaptationLogic : public IAdaptationLogic class AbstractAdaptationLogic : public IAdaptationLogic
{ {
public: public:
AbstractAdaptationLogic (dash::mpd::MPDManager *mpdManager); AbstractAdaptationLogic (mpd::MPD *mpd);
virtual ~AbstractAdaptationLogic (); virtual ~AbstractAdaptationLogic ();
virtual void downloadRateChanged (uint64_t bpsAvg, uint64_t bpsLastChunk); virtual void downloadRateChanged (uint64_t bpsAvg, uint64_t bpsLastChunk);
...@@ -54,7 +53,7 @@ namespace dash ...@@ -54,7 +53,7 @@ namespace dash
int getBufferPercent () const; int getBufferPercent () const;
protected: protected:
dash::mpd::MPDManager *mpdManager; dash::mpd::MPD *mpd;
private: private:
int bpsAvg; int bpsAvg;
......
...@@ -35,13 +35,13 @@ using namespace dash::xml; ...@@ -35,13 +35,13 @@ using namespace dash::xml;
using namespace dash::mpd; using namespace dash::mpd;
IAdaptationLogic* AdaptationLogicFactory::create ( IAdaptationLogic::LogicType logic, IAdaptationLogic* AdaptationLogicFactory::create ( IAdaptationLogic::LogicType logic,
MPDManager *mpdManager) MPD *mpd)
{ {
switch(logic) switch(logic)
{ {
case IAdaptationLogic::AlwaysBest: return new AlwaysBestAdaptationLogic (mpdManager); case IAdaptationLogic::AlwaysBest: return new AlwaysBestAdaptationLogic (mpd);
case IAdaptationLogic::RateBased: return new RateBasedAdaptationLogic (mpdManager); case IAdaptationLogic::RateBased: return new RateBasedAdaptationLogic (mpd);
case IAdaptationLogic::AlwaysLowest: return new AlwaysLowestAdaptationLogic (mpdManager); case IAdaptationLogic::AlwaysLowest: return new AlwaysLowestAdaptationLogic (mpd);
case IAdaptationLogic::Default: case IAdaptationLogic::Default:
default: default:
return NULL; return NULL;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "adaptationlogic/IAdaptationLogic.h" #include "adaptationlogic/IAdaptationLogic.h"
#include "xml/Node.h" #include "xml/Node.h"
#include "mpd/MPDManager.hpp"
struct stream_t; struct stream_t;
...@@ -38,7 +37,7 @@ namespace dash ...@@ -38,7 +37,7 @@ namespace dash
class AdaptationLogicFactory class AdaptationLogicFactory
{ {
public: public:
static IAdaptationLogic* create (IAdaptationLogic::LogicType logic, dash::mpd::MPDManager *mpdManager); static IAdaptationLogic* create (IAdaptationLogic::LogicType logic, mpd::MPD *mpd);
}; };
} }
} }
......
...@@ -32,8 +32,8 @@ using namespace dash::xml; ...@@ -32,8 +32,8 @@ using namespace dash::xml;
using namespace dash::http; using namespace dash::http;
using namespace dash::mpd; using namespace dash::mpd;
AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic (MPDManager *mpdManager) : AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic (MPD *mpd) :
AbstractAdaptationLogic (mpdManager) AbstractAdaptationLogic (mpd)
{ {
initSchedule(); initSchedule();
} }
...@@ -64,9 +64,9 @@ const Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation(Stream ...@@ -64,9 +64,9 @@ const Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation(Stream
void AlwaysBestAdaptationLogic::initSchedule () void AlwaysBestAdaptationLogic::initSchedule ()
{ {
if(mpdManager) if(mpd)
{ {
std::vector<Period *> periods = mpdManager->getPeriods(); std::vector<Period *> periods = mpd->getPeriods();
if (periods.empty()) if (periods.empty())
return; return;
RepresentationSelector selector; RepresentationSelector selector;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "Representationselectors.hpp" #include "Representationselectors.hpp"
#include "http/Chunk.h" #include "http/Chunk.h"
#include "xml/Node.h" #include "xml/Node.h"
#include "mpd/MPDManager.hpp"
#include "mpd/Period.h" #include "mpd/Period.h"
#include "mpd/Segment.h" #include "mpd/Segment.h"
#include "Streams.hpp" #include "Streams.hpp"
...@@ -42,7 +41,7 @@ namespace dash ...@@ -42,7 +41,7 @@ namespace dash
class AlwaysBestAdaptationLogic : public AbstractAdaptationLogic class AlwaysBestAdaptationLogic : public AbstractAdaptationLogic
{ {
public: public:
AlwaysBestAdaptationLogic (dash::mpd::MPDManager *mpdManager); AlwaysBestAdaptationLogic (mpd::MPD *mpd);
virtual ~AlwaysBestAdaptationLogic (); virtual ~AlwaysBestAdaptationLogic ();
virtual dash::http::Chunk* getNextChunk(Streams::Type); virtual dash::http::Chunk* getNextChunk(Streams::Type);
......
...@@ -24,9 +24,9 @@ using namespace dash::logic; ...@@ -24,9 +24,9 @@ using namespace dash::logic;
using namespace dash::http; using namespace dash::http;
using namespace dash::mpd; using namespace dash::mpd;
AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(dash::mpd::MPDManager *mpdManager): AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(mpd::MPD *mpd):
AbstractAdaptationLogic(mpdManager), AbstractAdaptationLogic(mpd),
currentPeriod(mpdManager->getFirstPeriod()), currentPeriod(mpd->getFirstPeriod()),
count(0) count(0)
{ {
} }
...@@ -43,7 +43,7 @@ Chunk* AlwaysLowestAdaptationLogic::getNextChunk(Streams::Type type) ...@@ -43,7 +43,7 @@ Chunk* AlwaysLowestAdaptationLogic::getNextChunk(Streams::Type type)
std::vector<ISegment *> segments = rep->getSegments(); std::vector<ISegment *> segments = rep->getSegments();
if ( count == segments.size() ) if ( count == segments.size() )
{ {
currentPeriod = mpdManager->getNextPeriod(currentPeriod); currentPeriod = mpd->getNextPeriod(currentPeriod);
count = 0; count = 0;
return getNextChunk(type); return getNextChunk(type);
} }
......
...@@ -29,7 +29,7 @@ namespace dash ...@@ -29,7 +29,7 @@ namespace dash
class AlwaysLowestAdaptationLogic : public AbstractAdaptationLogic class AlwaysLowestAdaptationLogic : public AbstractAdaptationLogic
{ {
public: public:
AlwaysLowestAdaptationLogic(dash::mpd::MPDManager *mpdManager); AlwaysLowestAdaptationLogic(mpd::MPD *mpd);
virtual dash::http::Chunk* getNextChunk (Streams::Type); virtual dash::http::Chunk* getNextChunk (Streams::Type);
virtual const dash::mpd::Representation* getCurrentRepresentation(Streams::Type) const; virtual const dash::mpd::Representation* getCurrentRepresentation(Streams::Type) const;
......
...@@ -36,13 +36,13 @@ using namespace dash::xml; ...@@ -36,13 +36,13 @@ using namespace dash::xml;
using namespace dash::http; using namespace dash::http;
using namespace dash::mpd; using namespace dash::mpd;
RateBasedAdaptationLogic::RateBasedAdaptationLogic (MPDManager *mpdManager) : RateBasedAdaptationLogic::RateBasedAdaptationLogic (MPD *mpd) :
AbstractAdaptationLogic (mpdManager), AbstractAdaptationLogic (mpd),
count (0), count (0),
currentPeriod (mpdManager->getFirstPeriod()) currentPeriod (mpd->getFirstPeriod())
{ {
width = var_InheritInteger(mpdManager->getMPD()->getVLCObject(), "dash-prefwidth"); width = var_InheritInteger(mpd->getVLCObject(), "dash-prefwidth");
height = var_InheritInteger(mpdManager->getMPD()->getVLCObject(), "dash-prefheight"); height = var_InheritInteger(mpd->getVLCObject(), "dash-prefheight");
} }
Chunk* RateBasedAdaptationLogic::getNextChunk(Streams::Type type) Chunk* RateBasedAdaptationLogic::getNextChunk(Streams::Type type)
...@@ -58,7 +58,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk(Streams::Type type) ...@@ -58,7 +58,7 @@ Chunk* RateBasedAdaptationLogic::getNextChunk(Streams::Type type)
if ( this->count == segments.size() ) if ( this->count == segments.size() )
{ {
this->currentPeriod = this->mpdManager->getNextPeriod(this->currentPeriod); currentPeriod = mpd->getNextPeriod(currentPeriod);
this->count = 0; this->count = 0;
return getNextChunk(type); return getNextChunk(type);
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "adaptationlogic/AbstractAdaptationLogic.h" #include "adaptationlogic/AbstractAdaptationLogic.h"
#include "xml/Node.h" #include "xml/Node.h"
#include "mpd/MPDManager.hpp"
#include "http/Chunk.h" #include "http/Chunk.h"
#define MINBUFFER 30 #define MINBUFFER 30
...@@ -39,7 +38,7 @@ namespace dash ...@@ -39,7 +38,7 @@ namespace dash
class RateBasedAdaptationLogic : public AbstractAdaptationLogic class RateBasedAdaptationLogic : public AbstractAdaptationLogic
{ {
public: public:
RateBasedAdaptationLogic (dash::mpd::MPDManager *mpdManager); RateBasedAdaptationLogic (mpd::MPD *mpd);
virtual dash::http::Chunk* getNextChunk(Streams::Type); virtual dash::http::Chunk* getNextChunk(Streams::Type);
const dash::mpd::Representation *getCurrentRepresentation(Streams::Type) const; const dash::mpd::Representation *getCurrentRepresentation(Streams::Type) const;
......
...@@ -60,10 +60,10 @@ BasicCMParser::~BasicCMParser () ...@@ -60,10 +60,10 @@ BasicCMParser::~BasicCMParser ()
{ {
} }
bool BasicCMParser::parse () bool BasicCMParser::parse (Profile profile)
{ {
const std::map<std::string, std::string> attr = this->root->getAttributes(); const std::map<std::string, std::string> attr = this->root->getAttributes();
this->mpd = new MPD(p_stream); mpd = new MPD(p_stream, profile);
std::map<std::string, std::string>::const_iterator it; std::map<std::string, std::string>::const_iterator it;
it = attr.find("mediaPresentationDuration"); it = attr.find("mediaPresentationDuration");
......
...@@ -44,7 +44,7 @@ namespace dash ...@@ -44,7 +44,7 @@ namespace dash
BasicCMParser( dash::xml::Node *root, stream_t *p_stream ); BasicCMParser( dash::xml::Node *root, stream_t *p_stream );
virtual ~BasicCMParser(); virtual ~BasicCMParser();
bool parse (); bool parse (Profile profile);
private: private:
void handleDependencyId( Representation* rep, const AdaptationSet* adaptationSet, const std::string& dependencyId ); void handleDependencyId( Representation* rep, const AdaptationSet* adaptationSet, const std::string& dependencyId );
......
...@@ -43,7 +43,7 @@ namespace dash ...@@ -43,7 +43,7 @@ namespace dash
public: public:
IMPDParser(dash::xml::Node *, MPD*, stream_t*, Representation*); IMPDParser(dash::xml::Node *, MPD*, stream_t*, Representation*);
virtual ~IMPDParser(){} virtual ~IMPDParser(){}
virtual bool parse () = 0; virtual bool parse (Profile profile) = 0;
virtual MPD* getMPD (); virtual MPD* getMPD ();
virtual void setMPDBaseUrl(dash::xml::Node *root); virtual void setMPDBaseUrl(dash::xml::Node *root);
virtual void setAdaptationSets(dash::xml::Node *periodNode, Period *period) = 0; virtual void setAdaptationSets(dash::xml::Node *periodNode, Period *period) = 0;
......
...@@ -43,9 +43,9 @@ IsoffMainParser::~IsoffMainParser () ...@@ -43,9 +43,9 @@ IsoffMainParser::~IsoffMainParser ()
{ {
} }
bool IsoffMainParser::parse () bool IsoffMainParser::parse (Profile profile)
{ {
mpd = new MPD(p_stream); mpd = new MPD(p_stream, profile);
setMPDAttributes(); setMPDAttributes();
setMPDBaseUrl(root); setMPDBaseUrl(root);
setPeriods(root); setPeriods(root);
......
...@@ -46,7 +46,7 @@ namespace dash ...@@ -46,7 +46,7 @@ namespace dash
IsoffMainParser (dash::xml::Node *root, stream_t *p_stream); IsoffMainParser (dash::xml::Node *root, stream_t *p_stream);
virtual ~IsoffMainParser (); virtual ~IsoffMainParser ();
bool parse (); bool parse (Profile profile);
void print (); void print ();
private: private:
......
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
using namespace dash::mpd; using namespace dash::mpd;
MPD::MPD (stream_t *stream_) : MPD::MPD (stream_t *stream_, Profile profile_) :
ICanonicalUrl(), ICanonicalUrl(),
stream(stream_), stream(stream_),
profile( dash::mpd::Profile::Unknown ), profile( profile_ ),
live( false ), live( false ),
availabilityStartTime( -1 ), availabilityStartTime( -1 ),
availabilityEndTime( -1 ), availabilityEndTime( -1 ),
...@@ -161,11 +161,6 @@ Profile MPD::getProfile() const ...@@ -161,11 +161,6 @@ Profile MPD::getProfile() const
return profile; return profile;
} }
void MPD::setProfile(Profile profile)
{
this->profile = profile;
}
std::string MPD::getUrlSegment() const std::string MPD::getUrlSegment() const
{ {
if (!baseUrls.empty()) if (!baseUrls.empty())
...@@ -178,3 +173,26 @@ vlc_object_t * MPD::getVLCObject() const ...@@ -178,3 +173,26 @@ vlc_object_t * MPD::getVLCObject() const
{ {
return VLC_OBJECT(stream); return VLC_OBJECT(stream);
} }
Period* MPD::getFirstPeriod() const
{
std::vector<Period *> periods = getPeriods();
if( !periods.empty() )
return periods.front();
else
return NULL;
}
Period* MPD::getNextPeriod(Period *period)
{
std::vector<Period *> periods = getPeriods();
for(size_t i = 0; i < periods.size(); i++)
{
if(periods.at(i) == period && (i + 1) < periods.size())
return periods.at(i + 1);
}
return NULL;
}
...@@ -42,11 +42,10 @@ namespace dash ...@@ -42,11 +42,10 @@ namespace dash
class MPD : public ICanonicalUrl class MPD : public ICanonicalUrl
{ {
public: public:
MPD(stream_t *); MPD(stream_t *, Profile);
virtual ~MPD(); virtual ~MPD();
Profile getProfile() const; Profile getProfile() const;
void setProfile( Profile profile );
bool isLive() const; bool isLive() const;
void setLive( bool live ); void setLive( bool live );
time_t getAvailabilityStartTime() const; time_t getAvailabilityStartTime() const;
...@@ -61,7 +60,6 @@ namespace dash ...@@ -61,7 +60,6 @@ namespace dash
void setMinBufferTime( time_t time ); void setMinBufferTime( time_t time );
time_t getTimeShiftBufferDepth() const; time_t getTimeShiftBufferDepth() const;
void setTimeShiftBufferDepth( time_t depth ); void setTimeShiftBufferDepth( time_t depth );
const std::vector<Period *>& getPeriods() const;
const ProgramInformation* getProgramInformation() const; const ProgramInformation* getProgramInformation() const;
void addPeriod (Period *period); void addPeriod (Period *period);
...@@ -71,6 +69,10 @@ namespace dash ...@@ -71,6 +69,10 @@ namespace dash
virtual std::string getUrlSegment() const; /* impl */ virtual std::string getUrlSegment() const; /* impl */
vlc_object_t * getVLCObject() const; vlc_object_t * getVLCObject() const;
virtual const std::vector<Period *>& getPeriods() const;
virtual Period* getFirstPeriod() const;
virtual Period* getNextPeriod(Period *period);
private: private:
stream_t *stream; stream_t *stream;
Profile profile; Profile profile;
......
...@@ -51,13 +51,10 @@ MPD* MPDFactory::create (dash::xml::Node *root, stream_t *p_stream, ...@@ -51,13 +51,10 @@ MPD* MPDFactory::create (dash::xml::Node *root, stream_t *p_stream,
return NULL; return NULL;
MPD* mpd = NULL; MPD* mpd = NULL;
if(parser->parse()) if(parser->parse(profile))
mpd = parser->getMPD(); mpd = parser->getMPD();
delete parser; delete parser;
if (mpd)
mpd->setProfile(profile);
return mpd; return mpd;
} }
/*
* MPDManager.cpp
*****************************************************************************
* 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
#include "MPDManager.hpp"
#include <limits>
using namespace dash::mpd;
MPDManager::MPDManager(MPD *mpd_) :
mpd(mpd_)
{
}
MPDManager::~MPDManager()
{
delete mpd;
}
const std::vector<Period*>& MPDManager::getPeriods() const
{
return mpd->getPeriods();
}
Period* MPDManager::getFirstPeriod() const
{
std::vector<Period *> periods = getPeriods();
if( !periods.empty() )
return periods.front();
else
return NULL;
}
Period* MPDManager::getNextPeriod(Period *period)
{
std::vector<Period *> periods = getPeriods();
for(size_t i = 0; i < periods.size(); i++)
{
if(periods.at(i) == period && (i + 1) < periods.size())
return periods.at(i + 1);
}
return NULL;
}
const MPD* MPDManager::getMPD() const
{
return mpd;
}
/*
* MPDManager.hpp
*****************************************************************************
* 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 MPDMANAGER_H_
#define MPDMANAGER_H_
#include "mpd/MPD.h"
#include "mpd/Period.h"
#include "mpd/Representation.h"
namespace dash
{
namespace mpd
{
class MPDManager
{
public:
MPDManager( MPD *mpd );
virtual ~MPDManager();
virtual const std::vector<Period *>& getPeriods () const;
virtual Period* getFirstPeriod () const;
virtual Period* getNextPeriod (Period *period);
virtual const MPD* getMPD () const;
protected:
MPD *mpd;
};
}
}
#endif /* MPDMANAGER_H_ */
/*
* MPDManagerFactory.cpp
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Apr 20, 2011
* 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 "mpd/MPDManagerFactory.h"
using namespace dash::mpd;
MPDManager* MPDManagerFactory::create( MPD *mpd )
{
switch( mpd->getProfile() )
{
case mpd::Profile::ISOOnDemand:
case mpd::Profile::Full:
case mpd::Profile::ISOMain:
return new MPDManager(mpd);
default:
return NULL;
}
}
/*
* MPDManagerFactory.h
*****************************************************************************
* Copyright (C) 2010 - 2011 Klagenfurt University
*
* Created on: Apr 20, 2011
* 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 MPDMANAGERFACTORY_H_
#define MPDMANAGERFACTORY_H_
#include "mpd/MPDManager.hpp"
namespace dash
{
namespace mpd
{
class MPDManagerFactory
{
public:
static MPDManager* create( MPD *mpd );
};
}
}
#endif /* MPDMANAGERFACTORY_H_ */
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include <vlc_common.h> #include <vlc_common.h>
#include "mpd/MPDManager.hpp"
#include "xml/Node.h" #include "xml/Node.h"
#include "mpd/Profile.hpp"
namespace dash namespace dash
{ {
......
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