Commit 1850ed6c authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: remove BaseUrl

parent f1b37e54
...@@ -293,7 +293,6 @@ libdash_plugin_la_SOURCES += \ ...@@ -293,7 +293,6 @@ libdash_plugin_la_SOURCES += \
demux/adaptative/playlist/BasePeriod.h \ demux/adaptative/playlist/BasePeriod.h \
demux/adaptative/playlist/BaseRepresentation.cpp \ demux/adaptative/playlist/BaseRepresentation.cpp \
demux/adaptative/playlist/BaseRepresentation.h \ demux/adaptative/playlist/BaseRepresentation.h \
demux/adaptative/playlist/BaseUrl.h \
demux/adaptative/playlist/CommonAttributesElements.cpp \ demux/adaptative/playlist/CommonAttributesElements.cpp \
demux/adaptative/playlist/CommonAttributesElements.h \ demux/adaptative/playlist/CommonAttributesElements.h \
demux/adaptative/playlist/ICanonicalUrl.hpp \ demux/adaptative/playlist/ICanonicalUrl.hpp \
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "../tools/Helper.h" #include "../tools/Helper.h"
#include "BasePeriod.h" #include "BasePeriod.h"
#include "SegmentTimeline.h" #include "SegmentTimeline.h"
#include "BaseUrl.h"
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_stream.h> #include <vlc_stream.h>
#include <sstream> #include <sstream>
...@@ -51,9 +50,6 @@ AbstractPlaylist::~AbstractPlaylist() ...@@ -51,9 +50,6 @@ AbstractPlaylist::~AbstractPlaylist()
{ {
for(size_t i = 0; i < this->periods.size(); i++) for(size_t i = 0; i < this->periods.size(); i++)
delete(this->periods.at(i)); delete(this->periods.at(i));
for(size_t i = 0; i < this->baseUrls.size(); i++)
delete(this->baseUrls.at(i));
} }
const std::vector<BasePeriod *>& AbstractPlaylist::getPeriods() const std::vector<BasePeriod *>& AbstractPlaylist::getPeriods()
...@@ -61,7 +57,7 @@ const std::vector<BasePeriod *>& AbstractPlaylist::getPeriods() ...@@ -61,7 +57,7 @@ const std::vector<BasePeriod *>& AbstractPlaylist::getPeriods()
return periods; return periods;
} }
void AbstractPlaylist::addBaseUrl(BaseUrl *url) void AbstractPlaylist::addBaseUrl(const std::string &url)
{ {
baseUrls.push_back(url); baseUrls.push_back(url);
} }
...@@ -78,7 +74,7 @@ void AbstractPlaylist::setType(const std::string &type_) ...@@ -78,7 +74,7 @@ void AbstractPlaylist::setType(const std::string &type_)
Url AbstractPlaylist::getUrlSegment() const Url AbstractPlaylist::getUrlSegment() const
{ {
if (!baseUrls.empty()) if (!baseUrls.empty())
return Url(baseUrls.front()->getUrl()); return Url(baseUrls.front());
else else
{ {
std::stringstream ss; std::stringstream ss;
......
...@@ -32,7 +32,6 @@ namespace adaptative ...@@ -32,7 +32,6 @@ namespace adaptative
namespace playlist namespace playlist
{ {
class BasePeriod; class BasePeriod;
class BaseUrl;
class AbstractPlaylist : public ICanonicalUrl class AbstractPlaylist : public ICanonicalUrl
{ {
...@@ -45,7 +44,7 @@ namespace adaptative ...@@ -45,7 +44,7 @@ namespace adaptative
virtual void debug() = 0; virtual void debug() = 0;
void addPeriod (BasePeriod *period); void addPeriod (BasePeriod *period);
void addBaseUrl (BaseUrl *url); void addBaseUrl (const std::string &);
virtual Url getUrlSegment() const; /* impl */ virtual Url getUrlSegment() const; /* impl */
vlc_object_t * getVLCObject() const; vlc_object_t * getVLCObject() const;
...@@ -69,7 +68,7 @@ namespace adaptative ...@@ -69,7 +68,7 @@ namespace adaptative
protected: protected:
stream_t *stream; stream_t *stream;
std::vector<BasePeriod *> periods; std::vector<BasePeriod *> periods;
std::vector<BaseUrl *> baseUrls; std::vector<std::string> baseUrls;
std::string type; std::string type;
}; };
} }
......
...@@ -79,11 +79,6 @@ bool BaseAdaptationSet::getBitstreamSwitching () const ...@@ -79,11 +79,6 @@ bool BaseAdaptationSet::getBitstreamSwitching () const
return this->isBitstreamSwitching; return this->isBitstreamSwitching;
} }
Url BaseAdaptationSet::getUrlSegment() const
{
return getParentUrlSegment();
}
std::vector<std::string> BaseAdaptationSet::toString(int indent) const std::vector<std::string> BaseAdaptationSet::toString(int indent) const
{ {
std::vector<std::string> ret; std::vector<std::string> ret;
......
...@@ -50,7 +50,6 @@ namespace adaptative ...@@ -50,7 +50,6 @@ namespace adaptative
void setBitstreamSwitching(bool value); void setBitstreamSwitching(bool value);
bool getBitstreamSwitching() const; bool getBitstreamSwitching() const;
void addRepresentation( BaseRepresentation *rep ); void addRepresentation( BaseRepresentation *rep );
virtual Url getUrlSegment() const; /* reimpl */
std::vector<std::string> toString(int = 0) const; std::vector<std::string> toString(int = 0) const;
protected: protected:
......
...@@ -87,14 +87,6 @@ BaseAdaptationSet * BasePeriod::getAdaptationSet(Streams::Type type) const ...@@ -87,14 +87,6 @@ BaseAdaptationSet * BasePeriod::getAdaptationSet(Streams::Type type) const
return NULL; return NULL;
} }
Url BasePeriod::getUrlSegment() const
{
if( baseUrl.Get() )
return *(baseUrl.Get());
else
return getParentUrlSegment();
}
std::vector<std::string> BasePeriod::toString(int indent) const std::vector<std::string> BasePeriod::toString(int indent) const
{ {
std::vector<std::string> ret; std::vector<std::string> ret;
......
...@@ -48,10 +48,8 @@ namespace adaptative ...@@ -48,10 +48,8 @@ namespace adaptative
void addAdaptationSet (BaseAdaptationSet *AdaptationSet); void addAdaptationSet (BaseAdaptationSet *AdaptationSet);
std::vector<std::string> toString (int = 0) const; std::vector<std::string> toString (int = 0) const;
virtual Url getUrlSegment() const; /* reimpl */
virtual mtime_t getPeriodStart() const; /* reimpl */ virtual mtime_t getPeriodStart() const; /* reimpl */
Property<Url *> baseUrl;
Property<mtime_t> duration; Property<mtime_t> duration;
Property<mtime_t> startTime; Property<mtime_t> startTime;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "BaseRepresentation.h" #include "BaseRepresentation.h"
#include "BaseAdaptationSet.h" #include "BaseAdaptationSet.h"
#include "BaseUrl.h"
#include "SegmentTemplate.h" #include "SegmentTemplate.h"
using namespace adaptative::playlist; using namespace adaptative::playlist;
...@@ -38,14 +37,12 @@ BaseRepresentation::BaseRepresentation( BaseAdaptationSet *set, AbstractPlaylist ...@@ -38,14 +37,12 @@ BaseRepresentation::BaseRepresentation( BaseAdaptationSet *set, AbstractPlaylist
SegmentInformation( set ), SegmentInformation( set ),
playlist ( playlist_ ), playlist ( playlist_ ),
adaptationSet ( set ), adaptationSet ( set ),
bandwidth (0), bandwidth (0)
baseUrl ( NULL )
{ {
} }
BaseRepresentation::~BaseRepresentation () BaseRepresentation::~BaseRepresentation ()
{ {
delete baseUrl;
} }
uint64_t BaseRepresentation::getBandwidth () const uint64_t BaseRepresentation::getBandwidth () const
...@@ -58,11 +55,6 @@ void BaseRepresentation::setBandwidth( uint64_t bandwidth ) ...@@ -58,11 +55,6 @@ void BaseRepresentation::setBandwidth( uint64_t bandwidth )
this->bandwidth = bandwidth; this->bandwidth = bandwidth;
} }
void BaseRepresentation::setBaseUrl(BaseUrl *base)
{
baseUrl = base;
}
std::vector<std::string> BaseRepresentation::toString(int indent) const std::vector<std::string> BaseRepresentation::toString(int indent) const
{ {
std::vector<std::string> ret; std::vector<std::string> ret;
...@@ -77,14 +69,6 @@ std::vector<std::string> BaseRepresentation::toString(int indent) const ...@@ -77,14 +69,6 @@ std::vector<std::string> BaseRepresentation::toString(int indent) const
return ret; return ret;
} }
Url BaseRepresentation::getUrlSegment() const
{
Url ret = getParentUrlSegment();
if (baseUrl)
ret.append(baseUrl->getUrl());
return ret;
}
AbstractPlaylist * BaseRepresentation::getPlaylist() const AbstractPlaylist * BaseRepresentation::getPlaylist() const
{ {
return playlist; return playlist;
......
...@@ -36,7 +36,6 @@ namespace adaptative ...@@ -36,7 +36,6 @@ namespace adaptative
{ {
class BaseAdaptationSet; class BaseAdaptationSet;
class AbstractPlaylist; class AbstractPlaylist;
class BaseUrl;
class BaseSegmentTemplate; class BaseSegmentTemplate;
class BaseRepresentation : public CommonAttributesElements, class BaseRepresentation : public CommonAttributesElements,
...@@ -55,11 +54,9 @@ namespace adaptative ...@@ -55,11 +54,9 @@ namespace adaptative
uint64_t getBandwidth () const; uint64_t getBandwidth () const;
void setBandwidth ( uint64_t bandwidth ); void setBandwidth ( uint64_t bandwidth );
void setBaseUrl (BaseUrl *baseUrl);
AbstractPlaylist* getPlaylist () const; AbstractPlaylist* getPlaylist () const;
std::vector<std::string> toString(int = 0) const; std::vector<std::string> toString(int = 0) const;
virtual Url getUrlSegment () const; /* impl */
/* for segment templates */ /* for segment templates */
virtual std::string contextualize(size_t, const std::string &, virtual std::string contextualize(size_t, const std::string &,
...@@ -69,7 +66,6 @@ namespace adaptative ...@@ -69,7 +66,6 @@ namespace adaptative
AbstractPlaylist *playlist; AbstractPlaylist *playlist;
BaseAdaptationSet *adaptationSet; BaseAdaptationSet *adaptationSet;
uint64_t bandwidth; uint64_t bandwidth;
BaseUrl *baseUrl;
}; };
} }
} }
......
/*
* BaseUrl.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 BASEURL_H_
#define BASEURL_H_
#include <string>
namespace adaptative
{
namespace playlist
{
class BaseUrl
{
public:
BaseUrl (const std::string& url) : url(url) {}
virtual ~BaseUrl() {}
const std::string& getUrl() const { return this->url; }
private:
std::string url;
};
}
}
#endif /* BASEURL_H_ */
...@@ -327,6 +327,21 @@ void SegmentInformation::setBitstreamSwitching(bool bitswitch) ...@@ -327,6 +327,21 @@ void SegmentInformation::setBitstreamSwitching(bool bitswitch)
bitswitch_policy = (bitswitch) ? BITSWITCH_YES : BITSWITCH_NO; bitswitch_policy = (bitswitch) ? BITSWITCH_YES : BITSWITCH_NO;
} }
Url SegmentInformation::getUrlSegment() const
{
if(baseUrl.Get() && baseUrl.Get()->hasScheme())
{
return *(baseUrl.Get());
}
else
{
Url ret = getParentUrlSegment();
if (baseUrl.Get())
ret.append(*(baseUrl.Get()));
return ret;
}
}
SegmentBase * SegmentInformation::inheritSegmentBase() const SegmentBase * SegmentInformation::inheritSegmentBase() const
{ {
if(segmentBase) if(segmentBase)
......
...@@ -88,6 +88,8 @@ namespace adaptative ...@@ -88,6 +88,8 @@ namespace adaptative
void setSegmentBase(SegmentBase *); void setSegmentBase(SegmentBase *);
void setSegmentTemplate(MediaSegmentTemplate *); void setSegmentTemplate(MediaSegmentTemplate *);
void setBitstreamSwitching(bool); void setBitstreamSwitching(bool);
virtual Url getUrlSegment() const; /* impl */
Property<Url *> baseUrl;
private: private:
void init(); void init();
......
...@@ -37,6 +37,19 @@ Url::Url(const std::string &str) ...@@ -37,6 +37,19 @@ Url::Url(const std::string &str)
prepend(Component(str)); prepend(Component(str));
} }
bool Url::hasScheme() const
{
if(components.empty())
return false;
const Component *comp = &components[0];
if(comp->component.compare(0, 7, "http://") &&
comp->component.compare(0, 8, "https://"))
return false;
return true;
}
Url & Url::prepend(const Component & comp) Url & Url::prepend(const Component & comp)
{ {
components.insert(components.begin(), comp); components.insert(components.begin(), comp);
......
...@@ -52,6 +52,7 @@ namespace adaptative ...@@ -52,6 +52,7 @@ namespace adaptative
Url(); Url();
Url(const Component &); Url(const Component &);
explicit Url(const std::string &); explicit Url(const std::string &);
bool hasScheme() const;
Url & prepend(const Component &); Url & prepend(const Component &);
Url & append(const Component &); Url & append(const Component &);
Url & append(const Url &); Url & append(const Url &);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
*****************************************************************************/ *****************************************************************************/
#include "IMPDParser.h" #include "IMPDParser.h"
#include "xml/DOMHelper.h" #include "xml/DOMHelper.h"
#include "../adaptative/playlist/BaseUrl.h"
using namespace dash::mpd; using namespace dash::mpd;
using namespace dash::xml; using namespace dash::xml;
...@@ -37,10 +36,7 @@ void IMPDParser::setMPDBaseUrl(Node *root) ...@@ -37,10 +36,7 @@ void IMPDParser::setMPDBaseUrl(Node *root)
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL"); std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL");
for(size_t i = 0; i < baseUrls.size(); i++) for(size_t i = 0; i < baseUrls.size(); i++)
{ mpd->addBaseUrl(baseUrls.at(i)->getText());
BaseUrl *url = new BaseUrl(baseUrls.at(i)->getText());
mpd->addBaseUrl(url);
}
} }
MPD* IMPDParser::getMPD() MPD* IMPDParser::getMPD()
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#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 "../adaptative/playlist/BaseUrl.h"
#include "Representation.h" #include "Representation.h"
#include "Period.h" #include "Period.h"
#include "AdaptationSet.h" #include "AdaptationSet.h"
...@@ -196,6 +195,10 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period) ...@@ -196,6 +195,10 @@ void IsoffMainParser::setAdaptationSets (Node *periodNode, Period *period)
if((*it)->hasAttribute("mimeType")) if((*it)->hasAttribute("mimeType"))
adaptationSet->setMimeType((*it)->getAttributeValue("mimeType")); adaptationSet->setMimeType((*it)->getAttributeValue("mimeType"));
Node *baseUrl = DOMHelper::getFirstChildElementByName((*it), "BaseURL");
if(baseUrl)
adaptationSet->baseUrl.Set(new Url(baseUrl->getText()));
parseSegmentInformation( *it, adaptationSet ); parseSegmentInformation( *it, adaptationSet );
setRepresentations((*it), adaptationSet); setRepresentations((*it), adaptationSet);
...@@ -213,7 +216,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation ...@@ -213,7 +216,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL"); std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
if(!baseUrls.empty()) if(!baseUrls.empty())
currentRepresentation->setBaseUrl( new BaseUrl( baseUrls.front()->getText() ) ); currentRepresentation->baseUrl.Set(new Url(baseUrls.front()->getText()));
if(repNode->hasAttribute("id")) if(repNode->hasAttribute("id"))
currentRepresentation->setId(repNode->getAttributeValue("id")); currentRepresentation->setId(repNode->getAttributeValue("id"));
......
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