diff options
Diffstat (limited to 'libdash/source/mpd')
46 files changed, 3563 insertions, 0 deletions
diff --git a/libdash/source/mpd/AbstractMPDElement.cpp b/libdash/source/mpd/AbstractMPDElement.cpp new file mode 100644 index 00000000..146d1776 --- /dev/null +++ b/libdash/source/mpd/AbstractMPDElement.cpp @@ -0,0 +1,41 @@ +/* + * AbstractMPDElement.cpp + ***************************************************************************** + * Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "AbstractMPDElement.h" + +using namespace dash::mpd; +using namespace dash::xml; + +AbstractMPDElement::AbstractMPDElement () +{ +} +AbstractMPDElement::~AbstractMPDElement () +{ + for(size_t i = 0; i < this->additionalSubNodes.size(); i++) + delete(this->additionalSubNodes.at(i)); +} + +const std::vector<INode *> AbstractMPDElement::GetAdditionalSubNodes () const +{ + return this->additionalSubNodes; +} +const std::map<std::string, std::string> AbstractMPDElement::GetRawAttributes () const +{ + return this->rawAttributes; +} +void AbstractMPDElement::AddAdditionalSubNode (INode *node) +{ + this->additionalSubNodes.push_back(node); +} +void AbstractMPDElement::AddRawAttributes (std::map<std::string, std::string> attributes) +{ + this->rawAttributes = attributes; +}
\ No newline at end of file diff --git a/libdash/source/mpd/AbstractMPDElement.h b/libdash/source/mpd/AbstractMPDElement.h new file mode 100644 index 00000000..b4235087 --- /dev/null +++ b/libdash/source/mpd/AbstractMPDElement.h @@ -0,0 +1,41 @@ +/* + * AbstractMPDElement.h + ***************************************************************************** + * Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef ABSTRACTMPDELEMENT_H_ +#define ABSTRACTMPDELEMENT_H_ + +#include "config.h" + +#include "IMPDElement.h" + +namespace dash +{ + namespace mpd + { + class AbstractMPDElement : public virtual IMPDElement + { + public: + AbstractMPDElement (); + virtual ~AbstractMPDElement (); + + virtual const std::vector<xml::INode *> GetAdditionalSubNodes () const; + virtual const std::map<std::string, std::string> GetRawAttributes () const; + virtual void AddAdditionalSubNode (xml::INode * node); + virtual void AddRawAttributes (std::map<std::string, std::string> attributes); + + private: + std::vector<xml::INode *> additionalSubNodes; + std::map<std::string, std::string> rawAttributes; + }; + } +} + +#endif /* ABSTRACTMPDELEMENT_H_ */ diff --git a/libdash/source/mpd/AdaptationSet.cpp b/libdash/source/mpd/AdaptationSet.cpp new file mode 100644 index 00000000..b1a0331f --- /dev/null +++ b/libdash/source/mpd/AdaptationSet.cpp @@ -0,0 +1,343 @@ +/* + * AdaptationSet.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "AdaptationSet.h" +#include <cstdlib> + +using namespace dash::mpd; + +AdaptationSet::AdaptationSet () : + segmentBase(NULL), + segmentList(NULL), + segmentTemplate(NULL), + xlinkHref(""), + xlinkActuate("onRequest"), + id(0), + lang(""), + contentType(""), + par(""), + minBandwidth(0), + maxBandwidth(0), + minWidth(0), + maxWidth(0), + minHeight(0), + maxHeight(0), + minFramerate(""), + maxFramerate(""), + segmentAlignmentIsBool(true), + subsegmentAlignmentIsBool(true), + usesSegmentAlignment(false), + usesSubsegmentAlignment(false), + segmentAlignment(0), + subsegmentAlignment(0), + isBitstreamSwitching(false) +{ +} +AdaptationSet::~AdaptationSet () +{ + for(size_t i = 0; i < this->accessibility.size(); i++) + delete(this->accessibility.at(i)); + for(size_t i = 0; i < this->role.size(); i++) + delete(this->role.at(i)); + for(size_t i = 0; i < this->rating.size(); i++) + delete(this->rating.at(i)); + for(size_t i = 0; i < this->viewpoint.size(); i++) + delete(this->viewpoint.at(i)); + for(size_t i = 0; i < this->contentComponent.size(); i++) + delete(this->contentComponent.at(i)); + for(size_t i = 0; i < this->baseURLs.size(); i++) + delete(this->baseURLs.at(i)); + for(size_t i = 0; i < this->representation.size(); i++) + delete(this->representation.at(i)); + + delete(segmentBase); + delete(segmentList); + delete(segmentTemplate); +} + +const std::vector<IDescriptor *>& AdaptationSet::GetAccessibility () const +{ + return (std::vector<IDescriptor *> &) this->accessibility; +} +void AdaptationSet::AddAccessibity (Descriptor *accessibility) +{ + this->accessibility.push_back(accessibility); +} +const std::vector<IDescriptor *>& AdaptationSet::GetRole () const +{ + return (std::vector<IDescriptor *> &) this->role; +} +void AdaptationSet::AddRole (Descriptor *role) +{ + this->role.push_back(role); +} +const std::vector<IDescriptor *>& AdaptationSet::GetRating () const +{ + return (std::vector<IDescriptor *> &) this->rating; +} +void AdaptationSet::AddRating (Descriptor *rating) +{ + this->rating.push_back(rating); +} +const std::vector<IDescriptor *>& AdaptationSet::GetViewpoint () const +{ + return (std::vector<IDescriptor *> &) this->viewpoint; +} +void AdaptationSet::AddViewpoint (Descriptor *viewpoint) +{ + this->viewpoint.push_back(viewpoint); +} +const std::vector<IContentComponent *>& AdaptationSet::GetContentComponent () const +{ + return (std::vector<IContentComponent *> &) this->contentComponent; +} +void AdaptationSet::AddContentComponent (ContentComponent *contentComponent) +{ + this->contentComponent.push_back(contentComponent); +} +const std::vector<IBaseUrl *>& AdaptationSet::GetBaseURLs () const +{ + return (std::vector<IBaseUrl *> &) this->baseURLs; +} +void AdaptationSet::AddBaseURL (BaseUrl *baseUrl) +{ + this->baseURLs.push_back(baseUrl); +} +ISegmentBase* AdaptationSet::GetSegmentBase () const +{ + return this->segmentBase; +} +void AdaptationSet::SetSegmentBase (SegmentBase *segmentBase) +{ + this->segmentBase = segmentBase; +} +ISegmentList* AdaptationSet::GetSegmentList () const +{ + return this->segmentList; +} +void AdaptationSet::SetSegmentList (SegmentList *segmentList) +{ + this->segmentList = segmentList; +} +ISegmentTemplate* AdaptationSet::GetSegmentTemplate () const +{ + return this->segmentTemplate; +} +void AdaptationSet::SetSegmentTemplate (SegmentTemplate *segmentTemplate) +{ + this->segmentTemplate = segmentTemplate; +} +const std::vector<IRepresentation *>& AdaptationSet::GetRepresentation () const +{ + return (std::vector<IRepresentation *> &) this->representation; +} +void AdaptationSet::AddRepresentation (Representation *representation) +{ + this->representation.push_back(representation); +} +const std::string& AdaptationSet::GetXlinkHref () const +{ + return this->xlinkHref; +} +void AdaptationSet::SetXlinkHref (const std::string& xlinkHref) +{ + this->xlinkHref = xlinkHref; +} +const std::string& AdaptationSet::GetXlinkActuate () const +{ + return this->xlinkActuate; +} +void AdaptationSet::SetXlinkActuate (const std::string& xlinkActuate) +{ + this->xlinkActuate = xlinkActuate; +} +uint32_t AdaptationSet::GetId () const +{ + return this->id; +} +void AdaptationSet::SetId (uint32_t id) +{ + this->id = id; +} +uint32_t AdaptationSet::GetGroup () const +{ + return this->group; +} +void AdaptationSet::SetGroup (uint32_t group) +{ + this->group = group; +} +const std::string& AdaptationSet::GetLang () const +{ + return this->lang; +} +void AdaptationSet::SetLang (const std::string& lang) +{ + this->lang = lang; +} +const std::string& AdaptationSet::GetContentType () const +{ + return this->contentType; +} +void AdaptationSet::SetContentType (const std::string& contentType) +{ + this->contentType = contentType; +} +const std::string& AdaptationSet::GetPar () const +{ + return this->par; +} +void AdaptationSet::SetPar (const std::string& par) +{ + this->par = par; +} +uint32_t AdaptationSet::GetMinBandwidth () const +{ + return this->minBandwidth; +} +void AdaptationSet::SetMinBandwidth (uint32_t minBandwidth) +{ + this->minBandwidth = minBandwidth; +} +uint32_t AdaptationSet::GetMaxBandwidth () const +{ + return this->maxBandwidth; +} +void AdaptationSet::SetMaxBandwidth (uint32_t maxBandwidth) +{ + this->maxBandwidth = maxBandwidth; +} +uint32_t AdaptationSet::GetMinWidth () const +{ + return this->minWidth; +} +void AdaptationSet::SetMinWidth (uint32_t minWidth) +{ + this->minWidth = minWidth; +} +uint32_t AdaptationSet::GetMaxWidth () const +{ + return this->maxWidth; +} +void AdaptationSet::SetMaxWidth (uint32_t maxWidth) +{ + this->maxWidth = maxWidth; +} +uint32_t AdaptationSet::GetMinHeight () const +{ + return this->minHeight; +} +void AdaptationSet::SetMinHeight (uint32_t minHeight) +{ + this->minHeight = minHeight; +} +uint32_t AdaptationSet::GetMaxHeight () const +{ + return this->maxHeight; +} +void AdaptationSet::SetMaxHeight (uint32_t maxHeight) +{ + this->maxHeight = maxHeight; +} +const std::string& AdaptationSet::GetMinFramerate () const +{ + return this->minFramerate; +} +void AdaptationSet::SetMinFramerate (const std::string& minFramerate) +{ + this->minFramerate = minFramerate; +} +const std::string& AdaptationSet::GetMaxFramerate () const +{ + return this->maxFramerate; +} +void AdaptationSet::SetMaxFramerate (const std::string& maxFramerate) +{ + this->maxFramerate = maxFramerate; +} +bool AdaptationSet::SegmentAlignmentIsBoolValue () const +{ + return this->segmentAlignmentIsBool; +} +bool AdaptationSet::SubsegmentAlignmentIsBoolValue () const +{ + return this->subsegmentAlignmentIsBool; +} +bool AdaptationSet::HasSegmentAlignment () const +{ + return this->usesSegmentAlignment; +} +bool AdaptationSet::HasSubsegmentAlignment () const +{ + return this->usesSubsegmentAlignment; +} +uint32_t AdaptationSet::GetSegmentAligment () const +{ + return this->segmentAlignment; +} +void AdaptationSet::SetSegmentAlignment (const std::string& segmentAlignment) +{ + if (segmentAlignment == "true" || segmentAlignment == "True" || segmentAlignment == "TRUE") + { + this->segmentAlignmentIsBool = true; + this->usesSegmentAlignment = true; + return; + } + + if (segmentAlignment == "false" || segmentAlignment == "False" || segmentAlignment == "FALSE") + { + this->segmentAlignmentIsBool = true; + this->usesSegmentAlignment = false; + return; + } + + this->segmentAlignmentIsBool = false; + this->segmentAlignment = strtoul(segmentAlignment.c_str(), NULL, 10); +} +void AdaptationSet::SetSubsegmentAlignment (const std::string& subsegmentAlignment) +{ + if (subsegmentAlignment == "true" || subsegmentAlignment == "True" || subsegmentAlignment == "TRUE") + { + this->subsegmentAlignmentIsBool = true; + this->usesSubsegmentAlignment = true; + return; + } + + if (subsegmentAlignment == "false" || subsegmentAlignment == "False" || subsegmentAlignment == "FALSE") + { + this->subsegmentAlignmentIsBool = true; + this->usesSubsegmentAlignment = false; + return; + } + + this->subsegmentAlignmentIsBool = false; + this->subsegmentAlignment = strtoul(subsegmentAlignment.c_str(), NULL, 10); +} +uint32_t AdaptationSet::GetSubsegmentAlignment () const +{ + return this->subsegmentAlignment; +} +uint8_t AdaptationSet::GetSubsegmentStartsWithSAP () const +{ + return this->subsegmentStartsWithSAP; +} +void AdaptationSet::SetSubsegmentStartsWithSAP (uint8_t subsegmentStartsWithSAP) +{ + this->subsegmentStartsWithSAP = subsegmentStartsWithSAP; +} +bool AdaptationSet::GetBitstreamSwitching () const +{ + return this->isBitstreamSwitching; +} +void AdaptationSet::SetBitstreamSwitching (bool value) +{ + this->isBitstreamSwitching = value; +} diff --git a/libdash/source/mpd/AdaptationSet.h b/libdash/source/mpd/AdaptationSet.h new file mode 100644 index 00000000..5a17cf4a --- /dev/null +++ b/libdash/source/mpd/AdaptationSet.h @@ -0,0 +1,138 @@ +/* + * AdaptationSet.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef ADAPTATIONSET_H_ +#define ADAPTATIONSET_H_ + +#include "config.h" + +#include "IAdaptationSet.h" +#include "RepresentationBase.h" +#include "BaseUrl.h" +#include "SegmentBase.h" +#include "SegmentList.h" +#include "SegmentTemplate.h" +#include "ContentComponent.h" +#include "Representation.h" + +namespace dash +{ + namespace mpd + { + class AdaptationSet : public IAdaptationSet, public RepresentationBase + { + public: + AdaptationSet (); + virtual ~AdaptationSet (); + + const std::vector<IDescriptor *>& GetAccessibility () const; + const std::vector<IDescriptor *>& GetRole () const; + const std::vector<IDescriptor *>& GetRating () const; + const std::vector<IDescriptor *>& GetViewpoint () const; + const std::vector<IContentComponent *>& GetContentComponent () const; + const std::vector<IBaseUrl *>& GetBaseURLs () const; + ISegmentBase* GetSegmentBase () const; + ISegmentList* GetSegmentList () const; + ISegmentTemplate* GetSegmentTemplate () const; + const std::vector<IRepresentation *>& GetRepresentation () const; + const std::string& GetXlinkHref () const; + const std::string& GetXlinkActuate () const; + uint32_t GetId () const; + uint32_t GetGroup () const; + const std::string& GetLang () const; + const std::string& GetContentType () const; + const std::string& GetPar () const; + uint32_t GetMinBandwidth () const; + uint32_t GetMaxBandwidth () const; + uint32_t GetMinWidth () const; + uint32_t GetMaxWidth () const; + uint32_t GetMinHeight () const; + uint32_t GetMaxHeight () const; + const std::string& GetMinFramerate () const; + const std::string& GetMaxFramerate () const; + bool SegmentAlignmentIsBoolValue () const; + bool HasSegmentAlignment () const; + uint32_t GetSegmentAligment () const; + bool SubsegmentAlignmentIsBoolValue () const; + bool HasSubsegmentAlignment () const; + uint32_t GetSubsegmentAlignment () const; + uint8_t GetSubsegmentStartsWithSAP () const; + bool GetBitstreamSwitching () const; + + void AddAccessibity (Descriptor *accessibility); + void AddRole (Descriptor *role); + void AddRating (Descriptor *rating); + void AddViewpoint (Descriptor *viewpoint); + void AddContentComponent (ContentComponent *contentComponent); + void AddBaseURL (BaseUrl *baseURL); + void SetSegmentBase (SegmentBase *segmentBase); + void SetSegmentList (SegmentList *segmentList); + void SetSegmentTemplate (SegmentTemplate *segmentTemplate); + void AddRepresentation (Representation* representation); + void SetXlinkHref (const std::string& xlinkHref); + void SetXlinkActuate (const std::string& xlinkActuate); + void SetId (uint32_t id); + void SetGroup (uint32_t group); + void SetLang (const std::string& lang); + void SetContentType (const std::string& contentType); + void SetPar (const std::string& par); + void SetMinBandwidth (uint32_t minBandwidth); + void SetMaxBandwidth (uint32_t maxBandwidth); + void SetMinWidth (uint32_t minWidth); + void SetMaxWidth (uint32_t maxWidth); + void SetMinHeight (uint32_t minHeight); + void SetMaxHeight (uint32_t maxHeight); + void SetMinFramerate (const std::string& minFramerate); + void SetMaxFramerate (const std::string& maxFramerate); + void SetSegmentAlignment (const std::string& segmentAlignment); + void SetSubsegmentAlignment (const std::string& subsegmentAlignment); + void SetSubsegmentStartsWithSAP (uint8_t subsegmentStartsWithSAP); + void SetBitstreamSwitching (bool value); + + private: + std::vector<Descriptor *> accessibility; + std::vector<Descriptor *> role; + std::vector<Descriptor *> rating; + std::vector<Descriptor *> viewpoint; + std::vector<ContentComponent *> contentComponent; + std::vector<BaseUrl *> baseURLs; + SegmentBase *segmentBase; + SegmentList *segmentList; + SegmentTemplate *segmentTemplate; + std::vector<Representation *> representation; + std::string xlinkHref; + std::string xlinkActuate; + uint32_t id; + uint32_t group; + std::string lang; + std::string contentType; + std::string par; + uint32_t minBandwidth; + uint32_t maxBandwidth; + uint32_t minWidth; + uint32_t maxWidth; + uint32_t minHeight; + uint32_t maxHeight; + std::string minFramerate; + std::string maxFramerate; + bool segmentAlignmentIsBool; + bool subsegmentAlignmentIsBool; + bool usesSegmentAlignment; + bool usesSubsegmentAlignment; + uint32_t segmentAlignment; + uint32_t subsegmentAlignment; + uint8_t subsegmentStartsWithSAP; + bool isBitstreamSwitching; + }; + } +} + +#endif /* ADAPTATIONSET_H_ */ diff --git a/libdash/source/mpd/BaseUrl.cpp b/libdash/source/mpd/BaseUrl.cpp new file mode 100644 index 00000000..7bafe794 --- /dev/null +++ b/libdash/source/mpd/BaseUrl.cpp @@ -0,0 +1,60 @@ +/* + * BaseUrl.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "BaseUrl.h" + +using namespace dash::mpd; + +BaseUrl::BaseUrl () : + url(""), + serviceLocation(""), + byteRange("") +{ +} +BaseUrl::~BaseUrl () +{ +} + +const std::string& BaseUrl::GetUrl () const +{ + return this->url; +} +void BaseUrl::SetUrl (const std::string& url) +{ + this->url = url; +} +const std::string& BaseUrl::GetServiceLocation () const +{ + return this->serviceLocation; +} +void BaseUrl::SetServiceLocation (const std::string& serviceLocation) +{ + this->serviceLocation = serviceLocation; +} +const std::string& BaseUrl::GetByteRange () const +{ + return this->byteRange; +} +void BaseUrl::SetByteRange (const std::string& byteRange) +{ + this->byteRange = byteRange; +} +ISegment* BaseUrl::ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const +{ + Segment *seg = new Segment(); + + if(seg->Init(baseurls, this->url, this->byteRange, dash::metrics::MediaSegment)) + return seg; + + delete(seg); + + return NULL; +} diff --git a/libdash/source/mpd/BaseUrl.h b/libdash/source/mpd/BaseUrl.h new file mode 100644 index 00000000..0147c1ed --- /dev/null +++ b/libdash/source/mpd/BaseUrl.h @@ -0,0 +1,49 @@ +/* + * BaseUrl.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef BASEURL_H_ +#define BASEURL_H_ + +#include "config.h" + +#include "Segment.h" +#include "IBaseUrl.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class BaseUrl : public IBaseUrl, public AbstractMPDElement + { + public: + BaseUrl (); + virtual ~BaseUrl(); + + const std::string& GetUrl () const; + const std::string& GetServiceLocation () const; + const std::string& GetByteRange () const; + + void SetUrl (const std::string& url); + void SetServiceLocation (const std::string& serviceLocation); + void SetByteRange (const std::string& byteRange); + + virtual ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const; + + private: + std::string url; + std::string serviceLocation; + std::string byteRange; + }; + } +} + +#endif /* BASEURL_H_ */ diff --git a/libdash/source/mpd/ContentComponent.cpp b/libdash/source/mpd/ContentComponent.cpp new file mode 100644 index 00000000..ce3de857 --- /dev/null +++ b/libdash/source/mpd/ContentComponent.cpp @@ -0,0 +1,98 @@ +/* + * ContentComponent.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "ContentComponent.h" + +using namespace dash::mpd; + +ContentComponent::ContentComponent () : + id(0), + lang(""), + contentType(""), + par("") +{ +} +ContentComponent::~ContentComponent () +{ + for(size_t i = 0; i < this->accessibility.size(); i++) + delete(this->accessibility.at(i)); + for(size_t i = 0; i < this->role.size(); i++) + delete(this->role.at(i)); + for(size_t i = 0; i < this->rating.size(); i++) + delete(this->rating.at(i)); + for(size_t i = 0; i < this->viewpoint.size(); i++) + delete(this->viewpoint.at(i)); +} + +const std::vector<IDescriptor *>& ContentComponent::GetAccessibility () const +{ + return (std::vector<IDescriptor *> &)this->accessibility; +} +void ContentComponent::AddAccessibity (Descriptor *accessibility) +{ + this->accessibility.push_back(accessibility); +} +const std::vector<IDescriptor *>& ContentComponent::GetRole () const +{ + return (std::vector<IDescriptor *> &)this->role; +} +void ContentComponent::AddRole (Descriptor *role) +{ + this->role.push_back(role); +} +const std::vector<IDescriptor *>& ContentComponent::GetRating () const +{ + return (std::vector<IDescriptor *> &)this->rating; +} +void ContentComponent::AddRating (Descriptor *rating) +{ + this->rating.push_back(rating); +} +const std::vector<IDescriptor *>& ContentComponent::GetViewpoint () const +{ + return (std::vector<IDescriptor *> &)this->viewpoint; +} +void ContentComponent::AddViewpoint (Descriptor *viewpoint) +{ + this->viewpoint.push_back(viewpoint); +} +uint32_t ContentComponent::GetId () const +{ + return this->id; +} +void ContentComponent::SetId (uint32_t id) +{ + this->id = id; +} +const std::string& ContentComponent::GetLang () const +{ + return this->lang; +} +void ContentComponent::SetLang (const std::string& lang) +{ + this->lang = lang; +} +const std::string& ContentComponent::GetContentType () const +{ + return this->contentType; +} +void ContentComponent::SetContentType (const std::string& contentType) +{ + this->contentType = contentType; +} +const std::string& ContentComponent::GetPar () const +{ + return this->par; +} +void ContentComponent::SetPar (const std::string& par) +{ + this->par = par; +} diff --git a/libdash/source/mpd/ContentComponent.h b/libdash/source/mpd/ContentComponent.h new file mode 100644 index 00000000..b59ab6d8 --- /dev/null +++ b/libdash/source/mpd/ContentComponent.h @@ -0,0 +1,62 @@ +/* + * ContentComponent.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef CONTENTCOMPONENT_H_ +#define CONTENTCOMPONENT_H_ + +#include "config.h" + +#include "IContentComponent.h" +#include "Descriptor.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class ContentComponent : public IContentComponent, public AbstractMPDElement + { + public: + ContentComponent (); + virtual ~ContentComponent (); + + const std::vector<IDescriptor *>& GetAccessibility () const; + const std::vector<IDescriptor *>& GetRole () const; + const std::vector<IDescriptor *>& GetRating () const; + const std::vector<IDescriptor *>& GetViewpoint () const; + uint32_t GetId () const; + const std::string& GetLang () const; + const std::string& GetContentType () const; + const std::string& GetPar () const; + + void AddAccessibity (Descriptor *accessibility); + void AddRole (Descriptor *role); + void AddRating (Descriptor *rating); + void AddViewpoint (Descriptor *viewpoint); + void SetId (uint32_t id); + void SetLang (const std::string& lang); + void SetContentType (const std::string& contentType); + void SetPar (const std::string& par); + + private: + std::vector<Descriptor *> accessibility; + std::vector<Descriptor *> role; + std::vector<Descriptor *> rating; + std::vector<Descriptor *> viewpoint; + uint32_t id; + std::string lang; + std::string contentType; + std::string par; + }; + } +} + +#endif /* CONTENTCOMPONENT_H_ */ diff --git a/libdash/source/mpd/Descriptor.cpp b/libdash/source/mpd/Descriptor.cpp new file mode 100644 index 00000000..c6eb787b --- /dev/null +++ b/libdash/source/mpd/Descriptor.cpp @@ -0,0 +1,39 @@ +/* + * Descriptor.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Descriptor.h" + +using namespace dash::mpd; + +Descriptor::Descriptor () : + schemeIdUri (""), + value ("") +{ +} +Descriptor::~Descriptor () +{ +} +const std::string& Descriptor::GetSchemeIdUri () const +{ + return this->schemeIdUri; +} +void Descriptor::SetSchemeIdUri (const std::string& schemeIdUri) +{ + this->schemeIdUri = schemeIdUri; +} +const std::string& Descriptor::GetValue () const +{ + return this->value; +} +void Descriptor::SetValue (const std::string& value) +{ + this->value = value; +} diff --git a/libdash/source/mpd/Descriptor.h b/libdash/source/mpd/Descriptor.h new file mode 100644 index 00000000..5cb66b94 --- /dev/null +++ b/libdash/source/mpd/Descriptor.h @@ -0,0 +1,43 @@ +/* + * Descriptor.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef DESCRIPTOR_H_ +#define DESCRIPTOR_H_ + +#include "config.h" + +#include "IDescriptor.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class Descriptor : public IDescriptor, public AbstractMPDElement + { + public: + Descriptor (); + virtual ~Descriptor (); + + const std::string& GetSchemeIdUri () const; + const std::string& GetValue () const; + + void SetValue (const std::string& value); + void SetSchemeIdUri (const std::string& schemeIdUri); + + private: + std::string schemeIdUri; + std::string value; + }; + } +} + +#endif /* DESCRIPTOR_H_ */ diff --git a/libdash/source/mpd/MPD.cpp b/libdash/source/mpd/MPD.cpp new file mode 100644 index 00000000..84e0e614 --- /dev/null +++ b/libdash/source/mpd/MPD.cpp @@ -0,0 +1,212 @@ +/* + * MPD.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "MPD.h" + +using namespace dash::mpd; +using namespace dash::metrics; + +MPD::MPD () : + id(""), + type("static"), + availabilityStarttime(""), + availabilityEndtime(""), + mediaPresentationDuration(""), + minimumUpdatePeriod(""), + minBufferTime(""), + timeShiftBufferDepth(""), + suggestedPresentationDelay(""), + maxSegmentDuration(""), + maxSubsegmentDuration("") +{ +} +MPD::~MPD () +{ + for(size_t i = 0; i < this->programInformations.size(); i++) + delete(this->programInformations.at(i)); + for(size_t i = 0; i < this->metrics.size(); i++) + delete(this->metrics.at(i)); + for(size_t i = 0; i < this->periods.size(); i++) + delete(this->periods.at(i)); + for(size_t i = 0; i < this->baseUrls.size(); i++) + delete(this->baseUrls.at(i)); +} + +const std::vector<IProgramInformation *>& MPD::GetProgramInformations () const +{ + return (std::vector<IProgramInformation *> &) this->programInformations; +} +void MPD::AddProgramInformation (ProgramInformation *programInformation) +{ + this->programInformations.push_back(programInformation); +} +const std::vector<IBaseUrl*>& MPD::GetBaseUrls () const +{ + return (std::vector<IBaseUrl*> &) this->baseUrls; +} +void MPD::AddBaseUrl (BaseUrl *url) +{ + this->baseUrls.push_back(url); +} +const std::vector<std::string>& MPD::GetLocations () const +{ + return this->locations; +} +void MPD::AddLocation (const std::string& location) +{ + this->locations.push_back(location); +} +const std::vector<IPeriod*>& MPD::GetPeriods () const +{ + return (std::vector<IPeriod*> &) this->periods; +} +void MPD::AddPeriod (Period *period) +{ + this->periods.push_back(period); +} +const std::vector<IMetrics *>& MPD::GetMetrics () const +{ + return (std::vector<IMetrics *> &) this->metrics; +} +void MPD::AddMetrics (Metrics *metrics) +{ + this->metrics.push_back(metrics); +} +const std::string& MPD::GetId () const +{ + return this->id; +} +void MPD::SetId (const std::string& id) +{ + this->id = id; +} +const std::vector<std::string>& MPD::GetProfiles () const +{ + return this->profiles; +} +void MPD::SetProfiles (const std::string& profiles) +{ + dash::helpers::String::Split(profiles, ',', this->profiles); +} +const std::string& MPD::GetType () const +{ + return this->type; +} +void MPD::SetType (const std::string& type) +{ + this->type = type; +} +const std::string& MPD::GetAvailabilityStarttime () const +{ + return this->availabilityStarttime; +} +void MPD::SetAvailabilityStarttime (const std::string& availabilityStarttime) +{ + this->availabilityStarttime = availabilityStarttime; +} +const std::string& MPD::GetAvailabilityEndtime () const +{ + return this->availabilityEndtime; +} +void MPD::SetAvailabilityEndtime (const std::string& availabilityEndtime) +{ + this->availabilityEndtime = availabilityEndtime; +} +const std::string& MPD::GetMediaPresentationDuration () const +{ + return this->mediaPresentationDuration; +} +void MPD::SetMediaPresentationDuration (const std::string& mediaPresentationDuration) +{ + this->mediaPresentationDuration = mediaPresentationDuration; +} +const std::string& MPD::GetMinimumUpdatePeriod () const +{ + return this->minimumUpdatePeriod; +} +void MPD::SetMinimumUpdatePeriod (const std::string& minimumUpdatePeriod) +{ + this->minimumUpdatePeriod = minimumUpdatePeriod; +} +const std::string& MPD::GetMinBufferTime () const +{ + return this->minBufferTime; +} +void MPD::SetMinBufferTime (const std::string& minBufferTime) +{ + this->minBufferTime = minBufferTime; +} +const std::string& MPD::GetTimeShiftBufferDepth () const +{ + return this->timeShiftBufferDepth; +} +void MPD::SetTimeShiftBufferDepth (const std::string& timeShiftBufferDepth) +{ + this->timeShiftBufferDepth = timeShiftBufferDepth; +} +const std::string& MPD::GetSuggestedPresentationDelay () const +{ + return this->suggestedPresentationDelay; +} +void MPD::SetSuggestedPresentationDelay (const std::string& suggestedPresentationDelay) +{ + this->suggestedPresentationDelay = suggestedPresentationDelay; +} +const std::string& MPD::GetMaxSegmentDuration () const +{ + return this->maxSegmentDuration; +} +void MPD::SetMaxSegmentDuration (const std::string& maxSegmentDuration) +{ + this->maxSegmentDuration = maxSegmentDuration; +} +const std::string& MPD::GetMaxSubsegmentDuration () const +{ + return this->maxSubsegmentDuration; +} +void MPD::SetMaxSubsegmentDuration (const std::string& maxSubsegmentDuration) +{ + this->maxSubsegmentDuration = maxSubsegmentDuration; +} +IBaseUrl* MPD::GetMPDPathBaseUrl () const +{ + return this->mpdPathBaseUrl; +} +void MPD::SetMPDPathBaseUrl (BaseUrl *mpdPath) +{ + this->mpdPathBaseUrl = mpdPath; +} +uint32_t MPD::GetFetchTime () const +{ + return this->fetchTime; +} +void MPD::SetFetchTime (uint32_t fetchTimeInSec) +{ + this->fetchTime = fetchTimeInSec; +} + + +const std::vector<ITCPConnection *>& MPD::GetTCPConnectionList () const +{ + return (std::vector<ITCPConnection *> &) this->tcpConnections; +} +void MPD::AddTCPConnection (TCPConnection *tcpConn) +{ + this->tcpConnections.push_back(tcpConn); +} +const std::vector<IHTTPTransaction *>& MPD::GetHTTPTransactionList () const +{ + return (std::vector<IHTTPTransaction *> &) this->httpTransactions; +} +void MPD::AddHTTPTransaction (HTTPTransaction *httpTransAct) +{ + this->httpTransactions.push_back(httpTransAct); +} diff --git a/libdash/source/mpd/MPD.h b/libdash/source/mpd/MPD.h new file mode 100644 index 00000000..9bcb38af --- /dev/null +++ b/libdash/source/mpd/MPD.h @@ -0,0 +1,107 @@ +/* + * MPD.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef MPD_H_ +#define MPD_H_ + +#include "config.h" + +#include "IMPD.h" +#include "ProgramInformation.h" +#include "BaseUrl.h" +#include "Period.h" +#include "Metrics.h" +#include "AbstractMPDElement.h" +#include "../metrics/HTTPTransaction.h" +#include "../metrics/TCPConnection.h" + +namespace dash +{ + namespace mpd + { + class MPD : public IMPD, public AbstractMPDElement + { + public: + MPD (); + virtual ~MPD(); + + const std::vector<IProgramInformation *>& GetProgramInformations () const; + const std::vector<IBaseUrl *>& GetBaseUrls () const; + const std::vector<std::string>& GetLocations () const; + const std::vector<IPeriod *>& GetPeriods () const; + const std::vector<IMetrics *>& GetMetrics () const; + const std::string& GetId () const; + const std::vector<std::string>& GetProfiles () const; + const std::string& GetType () const; + const std::string& GetAvailabilityStarttime () const; + const std::string& GetAvailabilityEndtime () const; + const std::string& GetMediaPresentationDuration () const; + const std::string& GetMinimumUpdatePeriod () const; + const std::string& GetMinBufferTime () const; + const std::string& GetTimeShiftBufferDepth () const; + const std::string& GetSuggestedPresentationDelay () const; + const std::string& GetMaxSegmentDuration () const; + const std::string& GetMaxSubsegmentDuration () const; + IBaseUrl* GetMPDPathBaseUrl () const; + uint32_t GetFetchTime () const; + + const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList () const; + const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList () const; + void AddTCPConnection (dash::metrics::TCPConnection *tcpConn); + void AddHTTPTransaction (dash::metrics::HTTPTransaction *httpTransAct); + + void AddProgramInformation (ProgramInformation *programInformation); + void AddBaseUrl (BaseUrl *url); + void AddLocation (const std::string& location); + void AddPeriod (Period *period); + void AddMetrics (Metrics *metrics); + void SetId (const std::string& id); + void SetProfiles (const std::string& profiles); + void SetType (const std::string& type); + void SetAvailabilityStarttime (const std::string& availabilityStarttime); + void SetAvailabilityEndtime (const std::string& availabilityEndtime); + void SetMediaPresentationDuration (const std::string& mediaPresentationDuration); + void SetMinimumUpdatePeriod (const std::string& minimumUpdatePeriod); + void SetMinBufferTime (const std::string& minBufferTime); + void SetTimeShiftBufferDepth (const std::string& timeShiftBufferDepth); + void SetSuggestedPresentationDelay (const std::string& suggestedPresentationDelay); + void SetMaxSegmentDuration (const std::string& maxSegmentDuration); + void SetMaxSubsegmentDuration (const std::string& maxSubsegmentDuration); + void SetMPDPathBaseUrl (BaseUrl *path); + void SetFetchTime (uint32_t fetchTimeInSec); + + private: + std::vector<ProgramInformation *> programInformations; + std::vector<BaseUrl *> baseUrls; + std::vector<std::string> locations; + std::vector<Period *> periods; + std::vector<Metrics *> metrics; + std::string id; + std::vector<std::string> profiles; + std::string type; + std::string availabilityStarttime; + std::string availabilityEndtime; + std::string mediaPresentationDuration; + std::string minimumUpdatePeriod; + std::string minBufferTime; + std::string timeShiftBufferDepth; + std::string suggestedPresentationDelay; + std::string maxSegmentDuration; + std::string maxSubsegmentDuration; + BaseUrl *mpdPathBaseUrl; + uint32_t fetchTime; + + std::vector<dash::metrics::TCPConnection *> tcpConnections; + std::vector<dash::metrics::HTTPTransaction *> httpTransactions; + }; + } +} +#endif /* MPD_H_ */ diff --git a/libdash/source/mpd/Metrics.cpp b/libdash/source/mpd/Metrics.cpp new file mode 100644 index 00000000..8e64dec4 --- /dev/null +++ b/libdash/source/mpd/Metrics.cpp @@ -0,0 +1,51 @@ +/* + * Metrics.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "../mpd/Metrics.h" + +using namespace dash::mpd; + +Metrics::Metrics () : + metrics("") +{ +} +Metrics::~Metrics () +{ + for(size_t i = 0; i < this->reportings.size(); i++) + delete(this->reportings.at(i)); + for(size_t i = 0; i < this->ranges.size(); i++) + delete(this->ranges.at(i)); +} + +const std::vector<IDescriptor *>& Metrics::GetReportings () const +{ + return (std::vector<IDescriptor *> &)this->reportings; +} +void Metrics::AddReporting (Descriptor *reporting) +{ + this->reportings.push_back(reporting); +} +const std::vector<IRange *>& Metrics::GetRanges () const +{ + return (std::vector<IRange *> &)this->ranges; +} +void Metrics::AddRange (Range *range) +{ + this->ranges.push_back(range); +} +const std::string& Metrics::GetMetrics () const +{ + return this->metrics; +} +void Metrics::SetMetrics (const std::string& metrics) +{ + this->metrics = metrics; +} diff --git a/libdash/source/mpd/Metrics.h b/libdash/source/mpd/Metrics.h new file mode 100644 index 00000000..c879f829 --- /dev/null +++ b/libdash/source/mpd/Metrics.h @@ -0,0 +1,51 @@ +/* + * Metrics.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef METRICS_H_ +#define METRICS_H_ + +#include "config.h" + +#include <string> +#include <vector> + +#include "IMetrics.h" +#include "Descriptor.h" +#include "Range.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class Metrics : public IMetrics, public AbstractMPDElement + { + public: + Metrics (); + virtual ~Metrics (); + + const std::vector<IDescriptor *>& GetReportings () const; + const std::vector<IRange *>& GetRanges () const; + const std::string& GetMetrics () const; + + void AddReporting (Descriptor *reporting); + void AddRange (Range *range); + void SetMetrics (const std::string& metrics); + + private: + std::vector<Descriptor *> reportings; + std::vector<Range *> ranges; + std::string metrics; + }; + } +} + +#endif /* METRICS_H_ */ diff --git a/libdash/source/mpd/MultipleSegmentBase.cpp b/libdash/source/mpd/MultipleSegmentBase.cpp new file mode 100644 index 00000000..ccfba515 --- /dev/null +++ b/libdash/source/mpd/MultipleSegmentBase.cpp @@ -0,0 +1,60 @@ +/* + * MultipleSegmentBase.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "MultipleSegmentBase.h" + +using namespace dash::mpd; + +MultipleSegmentBase::MultipleSegmentBase () : + bitstreamSwitching(NULL), + segmentTimeline(NULL), + duration(0), + startNumber(1) +{ +} +MultipleSegmentBase::~MultipleSegmentBase () +{ + delete(this->segmentTimeline); + delete(this->bitstreamSwitching); +} + +const ISegmentTimeline * MultipleSegmentBase::GetSegmentTimeline () const +{ + return (ISegmentTimeline *) this->segmentTimeline; +} +void MultipleSegmentBase::SetSegmentTimeline (SegmentTimeline *segmentTimeline) +{ + this->segmentTimeline = segmentTimeline; +} +const IURLType* MultipleSegmentBase::GetBitstreamSwitching () const +{ + return this->bitstreamSwitching; +} +void MultipleSegmentBase::SetBitstreamSwitching (URLType *bitstreamSwitching) +{ + this->bitstreamSwitching = bitstreamSwitching; +} +uint32_t MultipleSegmentBase::GetDuration () const +{ + return this->duration; +} +void MultipleSegmentBase::SetDuration (uint32_t duration) +{ + this->duration = duration; +} +uint32_t MultipleSegmentBase::GetStartNumber () const +{ + return this->startNumber; +} +void MultipleSegmentBase::SetStartNumber (uint32_t startNumber) +{ + this->startNumber = startNumber; +} diff --git a/libdash/source/mpd/MultipleSegmentBase.h b/libdash/source/mpd/MultipleSegmentBase.h new file mode 100644 index 00000000..386672ce --- /dev/null +++ b/libdash/source/mpd/MultipleSegmentBase.h @@ -0,0 +1,51 @@ +/* + * MultipleSegmentBase.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef MULTIPLESEGMENTBASE_H_ +#define MULTIPLESEGMENTBASE_H_ + +#include "config.h" + +#include "IMultipleSegmentBase.h" +#include "SegmentBase.h" +#include "SegmentTimeline.h" +#include "URLType.h" + +namespace dash +{ + namespace mpd + { + class MultipleSegmentBase : public virtual IMultipleSegmentBase, public SegmentBase + { + public: + MultipleSegmentBase (); + virtual ~MultipleSegmentBase (); + + const ISegmentTimeline* GetSegmentTimeline () const; + const IURLType* GetBitstreamSwitching () const; + uint32_t GetDuration () const; + uint32_t GetStartNumber () const; + + void SetSegmentTimeline (SegmentTimeline *segmentTimeline); + void SetBitstreamSwitching (URLType *bitstreamSwitching); + void SetDuration (uint32_t duration); + void SetStartNumber (uint32_t startNumber); + + protected: + SegmentTimeline *segmentTimeline; + URLType *bitstreamSwitching; + uint32_t duration; + uint32_t startNumber; + }; + } +} + +#endif /* MULTIPLESEGMENTBASE_H_ */ diff --git a/libdash/source/mpd/Period.cpp b/libdash/source/mpd/Period.cpp new file mode 100644 index 00000000..291677ea --- /dev/null +++ b/libdash/source/mpd/Period.cpp @@ -0,0 +1,137 @@ +/* + * Period.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Period.h" + +using namespace dash::mpd; + +Period::Period () : + segmentBase(NULL), + segmentList(NULL), + segmentTemplate(NULL), + xlinkActuate("onRequest"), + xlinkHref(""), + id(""), + start(""), + duration(""), + isBitstreamSwitching(false) +{ +} +Period::~Period () +{ + for(size_t i = 0; i < this->baseURLs.size(); i++) + delete(this->baseURLs.at(i)); + for(size_t i = 0; i < this->adaptationSets.size(); i++) + delete(this->adaptationSets.at(i)); + for(size_t i = 0; i < this->subsets.size(); i++) + delete(this->subsets.at(i)); + delete(segmentBase); + delete(segmentList); + delete(segmentTemplate); +} + +const std::vector<IBaseUrl *>& Period::GetBaseURLs () const +{ + return (std::vector<IBaseUrl *> &) this->baseURLs; +} +void Period::AddBaseURL (BaseUrl *baseUrl) +{ + this->baseURLs.push_back(baseUrl); +} +ISegmentBase* Period::GetSegmentBase () const +{ + return this->segmentBase; +} +void Period::SetSegmentBase (SegmentBase *segmentBase) +{ + this->segmentBase = segmentBase; +} +ISegmentList* Period::GetSegmentList () const +{ + return this->segmentList; +} +void Period::SetSegmentList (SegmentList *segmentList) +{ + this->segmentList = segmentList; +} +ISegmentTemplate* Period::GetSegmentTemplate () const +{ + return this->segmentTemplate; +} +void Period::SetSegmentTemplate (SegmentTemplate *segmentTemplate) +{ + this->segmentTemplate = segmentTemplate; +} +const std::vector<IAdaptationSet*>& Period::GetAdaptationSets () const +{ + return (std::vector<IAdaptationSet*> &) this->adaptationSets; +} +void Period::AddAdaptationSet (AdaptationSet *adaptationSet) +{ + if(adaptationSet != NULL) + this->adaptationSets.push_back(adaptationSet); +} +const std::vector<ISubset *>& Period::GetSubsets () const +{ + return (std::vector<ISubset *> &) this->subsets; +} +void Period::AddSubset (Subset *subset) +{ + this->subsets.push_back(subset); +} +const std::string& Period::GetXlinkHref () const +{ + return this->xlinkHref; +} +void Period::SetXlinkHref (const std::string& xlinkHref) +{ + this->xlinkHref = xlinkHref; +} +const std::string& Period::GetXlinkActuate () const +{ + return this->xlinkActuate; +} +void Period::SetXlinkActuate (const std::string& xlinkActuate) +{ + this->xlinkActuate = xlinkActuate; +} +const std::string& Period::GetId () const +{ + return this->id; +} +void Period::SetId (const std::string& id) +{ + this->id = id; +} +const std::string& Period::GetStart () const +{ + return this->start; +} +void Period::SetStart (const std::string& start) +{ + this->start = start; +} +const std::string& Period::GetDuration () const +{ + return this->duration; +} +void Period::SetDuration (const std::string& duration) +{ + this->duration = duration; +} +bool Period::GetBitstreamSwitching () const +{ + return this->isBitstreamSwitching; +} +void Period::SetBitstreamSwitching (bool value) +{ + this->isBitstreamSwitching = value; +} diff --git a/libdash/source/mpd/Period.h b/libdash/source/mpd/Period.h new file mode 100644 index 00000000..9e97f0cb --- /dev/null +++ b/libdash/source/mpd/Period.h @@ -0,0 +1,79 @@ +/* + * Period.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef PERIOD_H_ +#define PERIOD_H_ + +#include "config.h" + +#include "IPeriod.h" +#include "BaseUrl.h" +#include "AdaptationSet.h" +#include "Subset.h" +#include "SegmentBase.h" +#include "SegmentList.h" +#include "SegmentTemplate.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class Period : public IPeriod, public AbstractMPDElement + { + public: + Period (); + virtual ~Period (); + + const std::vector<IBaseUrl *>& GetBaseURLs () const; + ISegmentBase* GetSegmentBase () const; + ISegmentList* GetSegmentList () const; + ISegmentTemplate* GetSegmentTemplate () const; + const std::vector<IAdaptationSet *>& GetAdaptationSets () const; + const std::vector<ISubset *>& GetSubsets () const; + const std::string& GetXlinkHref () const; + const std::string& GetXlinkActuate () const; + const std::string& GetId () const; + const std::string& GetStart () const; + const std::string& GetDuration () const; + bool GetBitstreamSwitching () const; + + void AddBaseURL (BaseUrl *baseURL); + void SetSegmentBase (SegmentBase *segmentBase); + void SetSegmentList (SegmentList *segmentList); + void SetSegmentTemplate (SegmentTemplate *segmentTemplate); + void AddAdaptationSet (AdaptationSet *AdaptationSet); + void AddSubset (Subset *subset); + void SetXlinkHref (const std::string& xlinkHref); + void SetXlinkActuate (const std::string& xlinkActuate); + void SetId (const std::string& id); + void SetStart (const std::string& start); + void SetDuration (const std::string& duration); + void SetBitstreamSwitching (bool value); + + private: + std::vector<BaseUrl *> baseURLs; + SegmentBase *segmentBase; + SegmentList *segmentList; + SegmentTemplate *segmentTemplate; + std::vector<AdaptationSet *> adaptationSets; + std::vector<Subset *> subsets; + std::string xlinkHref; + std::string xlinkActuate; + std::string id; + std::string start; + std::string duration; + bool isBitstreamSwitching; + }; + } +} + +#endif /* PERIOD_H_ */ diff --git a/libdash/source/mpd/ProgramInformation.cpp b/libdash/source/mpd/ProgramInformation.cpp new file mode 100644 index 00000000..2ba0d6ff --- /dev/null +++ b/libdash/source/mpd/ProgramInformation.cpp @@ -0,0 +1,67 @@ +/* + * ProgramInformation.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "ProgramInformation.h" + +using namespace dash::mpd; + +ProgramInformation::ProgramInformation () : + title(""), + source(""), + copyright(""), + lang(""), + moreInformationURL("") +{ +} +ProgramInformation::~ProgramInformation () +{ +} + +const std::string& ProgramInformation::GetTitle () const +{ + return this->title; +} +void ProgramInformation::SetTitle (const std::string& title) +{ + this->title = title; +} +const std::string& ProgramInformation::GetSource () const +{ + return this->source; +} +void ProgramInformation::SetSource (const std::string& source) +{ + this->source = source; +} +const std::string& ProgramInformation::GetCopyright () const +{ + return this->copyright; +} +void ProgramInformation::SetCopyright (const std::string& copyright) +{ + this->copyright = copyright; +} +const std::string& ProgramInformation::GetLang () const +{ + return this->lang; +} +void ProgramInformation::SetLang (const std::string& lang) +{ + this->lang = lang; +} +const std::string& ProgramInformation::GetMoreInformationURL () const +{ + return this->moreInformationURL; +} +void ProgramInformation::SetMoreInformationURL (const std::string& moreInfoURL) +{ + this->moreInformationURL = moreInfoURL; +} diff --git a/libdash/source/mpd/ProgramInformation.h b/libdash/source/mpd/ProgramInformation.h new file mode 100644 index 00000000..9b12f33d --- /dev/null +++ b/libdash/source/mpd/ProgramInformation.h @@ -0,0 +1,52 @@ +/* + * ProgramInformation.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef PROGRAMINFORMATION_H_ +#define PROGRAMINFORMATION_H_ + +#include "config.h" + +#include "IProgramInformation.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class ProgramInformation : public IProgramInformation, public AbstractMPDElement + { + public: + ProgramInformation (); + virtual ~ProgramInformation (); + + const std::string& GetTitle () const; + const std::string& GetSource () const; + const std::string& GetCopyright () const; + const std::string& GetLang () const; + const std::string& GetMoreInformationURL () const; + + void SetTitle (const std::string& title); + void SetSource (const std::string& source); + void SetCopyright (const std::string& copyright); + void SetLang (const std::string& lang); + void SetMoreInformationURL (const std::string& moreInformationURL); + + private: + std::string title; + std::string source; + std::string copyright; + std::string lang; + std::string moreInformationURL; + }; + } +} + +#endif /* PROGRAMINFORMATION_H_ */ diff --git a/libdash/source/mpd/Range.cpp b/libdash/source/mpd/Range.cpp new file mode 100644 index 00000000..6f0aed9f --- /dev/null +++ b/libdash/source/mpd/Range.cpp @@ -0,0 +1,40 @@ +/* + * Range.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Range.h" + +using namespace dash::mpd; + +Range::Range () : + starttime(""), + duration("") +{ +} +Range::~Range () +{ +} + +const std::string& Range::GetStarttime () const +{ + return this->starttime; +} +void Range::SetStarttime (const std::string& starttime) +{ + this->starttime = starttime; +} +const std::string& Range::GetDuration () const +{ + return this->duration; +} +void Range::SetDuration (const std::string& duration) +{ + this->duration = duration; +} diff --git a/libdash/source/mpd/Range.h b/libdash/source/mpd/Range.h new file mode 100644 index 00000000..f847b096 --- /dev/null +++ b/libdash/source/mpd/Range.h @@ -0,0 +1,42 @@ +/* + * Range.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef RANGE_H_ +#define RANGE_H_ + +#include "config.h" + +#include "IRange.h" + +namespace dash +{ + namespace mpd + { + class Range : public IRange + { + public: + Range (); + virtual ~Range (); + + const std::string& GetStarttime () const; + const std::string& GetDuration () const; + + void SetStarttime (const std::string& start); + void SetDuration (const std::string& duration); + + private: + std::string starttime; + std::string duration; + }; + } +} + +#endif /* RANGE_H_ */ diff --git a/libdash/source/mpd/Representation.cpp b/libdash/source/mpd/Representation.cpp new file mode 100644 index 00000000..fab7b493 --- /dev/null +++ b/libdash/source/mpd/Representation.cpp @@ -0,0 +1,116 @@ +/* + * Representation.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Representation.h" + +using namespace dash::mpd; + +Representation::Representation () : + segmentBase (NULL), + segmentList (NULL), + segmentTemplate (NULL), + id(""), + bandwidth (0), + qualityRanking (0) +{ +} +Representation::~Representation () +{ + for(size_t i = 0; i < this->baseURLs.size(); i++) + delete(this->baseURLs.at(i)); + for(size_t i = 0; i < this->subRepresentations.size(); i++) + delete(this->subRepresentations.at(i)); + + delete(this->segmentTemplate); + delete(this->segmentBase); + delete(this->segmentList); +} + +const std::vector<IBaseUrl *>& Representation::GetBaseURLs () const +{ + return (std::vector<IBaseUrl *> &) this->baseURLs; +} +void Representation::AddBaseURL (BaseUrl *baseUrl) +{ + this->baseURLs.push_back(baseUrl); +} +const std::vector<ISubRepresentation *>& Representation::GetSubRepresentations () const +{ + return (std::vector<ISubRepresentation *> &) this->subRepresentations; +} +void Representation::AddSubRepresentation (SubRepresentation *subRepresentation) +{ + this->subRepresentations.push_back(subRepresentation); +} +ISegmentBase* Representation::GetSegmentBase () const +{ + return this->segmentBase; +} +void Representation::SetSegmentBase (SegmentBase *segmentBase) +{ + this->segmentBase = segmentBase; +} +ISegmentList* Representation::GetSegmentList () const +{ + return this->segmentList; +} +void Representation::SetSegmentList (SegmentList *segmentList) +{ + this->segmentList = segmentList; +} +ISegmentTemplate* Representation::GetSegmentTemplate () const +{ + return this->segmentTemplate; +} +void Representation::SetSegmentTemplate (SegmentTemplate *segmentTemplate) +{ + this->segmentTemplate = segmentTemplate; +} +const std::string& Representation::GetId () const +{ + return this->id; +} +void Representation::SetId (const std::string &id) +{ + this->id = id; +} +uint32_t Representation::GetBandwidth () const +{ + return this->bandwidth; +} +void Representation::SetBandwidth (uint32_t bandwidth) +{ + this->bandwidth = bandwidth; +} +uint32_t Representation::GetQualityRanking () const +{ + return this->qualityRanking; +} +void Representation::SetQualityRanking (uint32_t qualityRanking) +{ + this->qualityRanking = qualityRanking; +} +const std::vector<std::string>& Representation::GetDependencyId () const +{ + return this->dependencyId; +} +void Representation::SetDependencyId (const std::string &dependencyId) +{ + dash::helpers::String::Split(dependencyId, ' ', this->dependencyId); +} +const std::vector<std::string>& Representation::GetMediaStreamStructureId () const +{ + return this->mediaStreamStructureId; +} +void Representation::SetMediaStreamStructureId (const std::string& mediaStreamStructureId) +{ + dash::helpers::String::Split(mediaStreamStructureId, ' ', this->mediaStreamStructureId); +} diff --git a/libdash/source/mpd/Representation.h b/libdash/source/mpd/Representation.h new file mode 100644 index 00000000..a56f5828 --- /dev/null +++ b/libdash/source/mpd/Representation.h @@ -0,0 +1,75 @@ +/* + * Representation.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef REPRESENTATION_H_ +#define REPRESENTATION_H_ + +#include "config.h" + +#include "IRepresentation.h" +#include "SegmentTemplate.h" +#include "RepresentationBase.h" +#include "BaseUrl.h" +#include "SubRepresentation.h" +#include "SegmentBase.h" +#include "SegmentList.h" +#include "../helpers/String.h" + +namespace dash +{ + namespace mpd + { + class Representation : public IRepresentation, public RepresentationBase + { + public: + Representation (); + virtual ~Representation (); + + const std::vector<IBaseUrl *>& GetBaseURLs () const; + const std::vector<ISubRepresentation *>& GetSubRepresentations () const; + ISegmentBase* GetSegmentBase () const; + ISegmentList* GetSegmentList () const; + ISegmentTemplate* GetSegmentTemplate () const; + const std::string& GetId () const; + uint32_t GetBandwidth () const; + uint32_t GetQualityRanking () const; + const std::vector<std::string>& GetDependencyId () const; + const std::vector<std::string>& GetMediaStreamStructureId () const; + + + void AddBaseURL (BaseUrl *baseURL); + void AddSubRepresentation (SubRepresentation *subRepresentation); + void SetSegmentBase (SegmentBase *segmentBase); + void SetSegmentList (SegmentList *segmentList); + void SetSegmentTemplate (SegmentTemplate *segmentTemplate); + void SetId (const std::string &id); + void SetBandwidth (uint32_t bandwidth); + void SetQualityRanking (uint32_t qualityRanking); + void SetDependencyId (const std::string &dependencyId); + void SetMediaStreamStructureId (const std::string &mediaStreamStructureId); + + private: + std::vector<BaseUrl *> baseURLs; + std::vector<SubRepresentation *> subRepresentations; + SegmentBase *segmentBase; + SegmentList *segmentList; + SegmentTemplate *segmentTemplate; + std::string id; + uint32_t bandwidth; + uint32_t qualityRanking; + std::vector<std::string> dependencyId; + std::vector<std::string> mediaStreamStructureId; + + }; + } +} + +#endif /* REPRESENTATION_H_ */ diff --git a/libdash/source/mpd/RepresentationBase.cpp b/libdash/source/mpd/RepresentationBase.cpp new file mode 100644 index 00000000..f7b8970c --- /dev/null +++ b/libdash/source/mpd/RepresentationBase.cpp @@ -0,0 +1,175 @@ +/* + * RepresentationBase.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "RepresentationBase.h" + +using namespace dash::mpd; + +RepresentationBase::RepresentationBase () : + width(0), + height(0), + sar(""), + frameRate(""), + audioSamplingRate(""), + mimeType(""), + maximumSAPPeriod(0.0), + startWithSAP(0), + maxPlayoutRate(0.0), + codingDependency(false), + scanType("") +{ +} +RepresentationBase::~RepresentationBase () +{ + for(size_t i = 0; i < this->framePacking.size(); i++) + delete(this->framePacking.at(i)); + for(size_t i = 0; i < this->audioChannelConfiguration.size(); i++) + delete(this->audioChannelConfiguration.at(i)); + for(size_t i = 0; i < this->contentProtection.size(); i++) + delete(this->contentProtection.at(i)); +} + +const std::vector<IDescriptor*>& RepresentationBase::GetFramePacking () const +{ + return (std::vector<IDescriptor*> &) this->framePacking; +} +void RepresentationBase::AddFramePacking (Descriptor *framePacking) +{ + this->framePacking.push_back(framePacking); +} +const std::vector<IDescriptor*>& RepresentationBase::GetAudioChannelConfiguration () const +{ + return (std::vector<IDescriptor*> &) this->audioChannelConfiguration; +} +void RepresentationBase::AddAudioChannelConfiguration (Descriptor *audioChannelConfiguration) +{ + this->audioChannelConfiguration.push_back(audioChannelConfiguration); +} +const std::vector<IDescriptor*>& RepresentationBase::GetContentProtection () const +{ + return (std::vector<IDescriptor*> &) this->contentProtection; +} +void RepresentationBase::AddContentProtection (Descriptor *contentProtection) +{ + this->contentProtection.push_back(contentProtection); +} +const std::vector<std::string>& RepresentationBase::GetProfiles () const +{ + return this->profiles; +} +void RepresentationBase::SetProfiles (const std::string& profiles) +{ + dash::helpers::String::Split(profiles, ',', this->profiles); +} +uint32_t RepresentationBase::GetWidth () const +{ + return this->width; +} +void RepresentationBase::SetWidth (uint32_t width) +{ + this->width = width; +} +uint32_t RepresentationBase::GetHeight () const +{ + return this->height; +} +void RepresentationBase::SetHeight (uint32_t height) +{ + this->height = height; +} +std::string RepresentationBase::GetSar () const +{ + return this->sar; +} +void RepresentationBase::SetSar (const std::string& sar) +{ + this->sar = sar; +} +std::string RepresentationBase::GetFrameRate () const +{ + return this->frameRate; +} +void RepresentationBase::SetFrameRate (const std::string& frameRate) +{ + this->frameRate = frameRate; +} +std::string RepresentationBase::GetAudioSamplingRate () const +{ + return this->audioSamplingRate; +} +void RepresentationBase::SetAudioSamplingRate (const std::string& audioSamplingRate) +{ + this->audioSamplingRate = audioSamplingRate; +} +std::string RepresentationBase::GetMimeType () const +{ + return this->mimeType; +} +void RepresentationBase::SetMimeType (const std::string& mimeType) +{ + this->mimeType = mimeType; +} +const std::vector<std::string>& RepresentationBase::GetSegmentProfiles () const +{ + return this->segmentProfiles; +} +void RepresentationBase::SetSegmentProfiles (const std::string& segmentProfiles) +{ + dash::helpers::String::Split(segmentProfiles, ',', this->segmentProfiles); +} +const std::vector<std::string>& RepresentationBase::GetCodecs () const +{ + return this->codecs; +} +void RepresentationBase::SetCodecs (const std::string& codecs) +{ + dash::helpers::String::Split(codecs, ',', this->codecs); +} +double RepresentationBase::GetMaximumSAPPeriod () const +{ + return this->maximumSAPPeriod; +} +void RepresentationBase::SetMaximumSAPPeriod (double maximumSAPPeriod) +{ + this->maximumSAPPeriod = maximumSAPPeriod; +} +uint8_t RepresentationBase::GetStartWithSAP () const +{ + return this->startWithSAP; +} +void RepresentationBase::SetStartWithSAP (uint8_t startWithSAP) +{ + this->startWithSAP = startWithSAP; +} +double RepresentationBase::GetMaxPlayoutRate () const +{ + return this->maxPlayoutRate; +} +void RepresentationBase::SetMaxPlayoutRate (double maxPlayoutRate) +{ + this->maxPlayoutRate = maxPlayoutRate; +} +bool RepresentationBase::HasCodingDependency () const +{ + return this->codingDependency; +} +void RepresentationBase::SetCodingDependency (bool codingDependency) +{ + this->codingDependency = codingDependency; +} +std::string RepresentationBase::GetScanType () const +{ + return this->scanType; +} +void RepresentationBase::SetScanType (const std::string& scanType) +{ + this->scanType = scanType; +} diff --git a/libdash/source/mpd/RepresentationBase.h b/libdash/source/mpd/RepresentationBase.h new file mode 100644 index 00000000..bb7fd287 --- /dev/null +++ b/libdash/source/mpd/RepresentationBase.h @@ -0,0 +1,89 @@ +/* + * RepresentationBase.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef REPRESENTATIONBASE_H_ +#define REPRESENTATIONBASE_H_ + +#include "config.h" + +#include "IRepresentationBase.h" +#include "Descriptor.h" +#include "../helpers/String.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class RepresentationBase : public virtual IRepresentationBase, public AbstractMPDElement + { + public: + RepresentationBase (); + virtual ~RepresentationBase (); + + const std::vector<IDescriptor *>& GetFramePacking () const; + const std::vector<IDescriptor *>& GetAudioChannelConfiguration () const; + const std::vector<IDescriptor *>& GetContentProtection () const; + const std::vector<std::string>& GetProfiles () const; + uint32_t GetWidth () const; + uint32_t GetHeight () const; + std::string GetSar () const; + std::string GetFrameRate () const; + std::string GetAudioSamplingRate () const; + std::string GetMimeType () const; + const std::vector<std::string>& GetSegmentProfiles () const; + const std::vector<std::string>& GetCodecs () const; + double GetMaximumSAPPeriod () const; + uint8_t GetStartWithSAP () const; + double GetMaxPlayoutRate () const; + bool HasCodingDependency () const; + std::string GetScanType () const; + + void AddFramePacking (Descriptor *framePacking); + void AddAudioChannelConfiguration (Descriptor *audioChannelConfiguration); + void AddContentProtection (Descriptor *contentProtection); + void SetProfiles (const std::string& profiles); + void SetWidth (uint32_t width); + void SetHeight (uint32_t height); + void SetSar (const std::string& sar); + void SetFrameRate (const std::string& frameRate); + void SetAudioSamplingRate (const std::string& audioSamplingRate); + void SetMimeType (const std::string& mimeType); + void SetSegmentProfiles (const std::string& segmentProfiles); + void SetCodecs (const std::string& codecs); + void SetMaximumSAPPeriod (double maximumSAPPeroid); + void SetStartWithSAP (uint8_t startWithSAP); + void SetMaxPlayoutRate (double maxPlayoutRate); + void SetCodingDependency (bool codingDependency); + void SetScanType (const std::string& scanType); + + protected: + std::vector<Descriptor *> framePacking; + std::vector<Descriptor *> audioChannelConfiguration; + std::vector<Descriptor *> contentProtection; + std::vector<std::string> profiles; + uint32_t width; + uint32_t height; + std::string sar; + std::string frameRate; + std::string audioSamplingRate; + std::string mimeType; + std::vector<std::string> segmentProfiles; + std::vector<std::string> codecs; + double maximumSAPPeriod; + uint8_t startWithSAP; + double maxPlayoutRate; + bool codingDependency; + std::string scanType; + }; + } +} +#endif /* REPRESENTATIONBASE_H_ */ diff --git a/libdash/source/mpd/Segment.cpp b/libdash/source/mpd/Segment.cpp new file mode 100644 index 00000000..31200762 --- /dev/null +++ b/libdash/source/mpd/Segment.cpp @@ -0,0 +1,138 @@ +/* + * Segment.cpp + ***************************************************************************** + * Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Segment.h" + +using namespace dash::mpd; +using namespace dash::helpers; +using namespace dash::metrics; + +Segment::Segment () : + host(""), + port(0), + path(""), + startByte(0), + endByte(0), + hasByteRange(false) +{ +} +Segment::~Segment () +{ +} + +bool Segment::Init (const std::vector<IBaseUrl *>& baseurls, const std::string &uri, const std::string &range, HTTPTransactionType type) +{ + std::string host = ""; + size_t port = 80; + std::string path = ""; + size_t startByte = 0; + size_t endByte = 0; + + this->absoluteuri = ""; + + for(size_t i = 0; i < baseurls.size(); i++) + this->absoluteuri = Path::CombinePaths(this->absoluteuri, baseurls.at(i)->GetUrl()); + + this->absoluteuri = Path::CombinePaths(this->absoluteuri, uri); + + if (uri != "" && dash::helpers::Path::GetHostPortAndPath(this->absoluteuri, host, port, path)) + { + this->host = host; + this->port = port; + this->path = path; + + if (range != "" && dash::helpers::Path::GetStartAndEndBytes(range, startByte, endByte)) + { + this->range = range; + this->hasByteRange = true; + this->startByte = startByte; + this->endByte = endByte; + } + + this->type = type; + + return true; + } + + return false; +} +std::string& Segment::AbsoluteURI () +{ + return this->absoluteuri; +} +std::string& Segment::Host () +{ + return this->host; +} +size_t Segment::Port () +{ + return this->port; +} +std::string& Segment::Path () +{ + return this->path; +} +std::string& Segment::Range () +{ + return this->range; +} +size_t Segment::StartByte () +{ + return this->startByte; +} +size_t Segment::EndByte () +{ + return this->endByte; +} +bool Segment::HasByteRange () +{ + return this->hasByteRange; +} +void Segment::AbsoluteURI (std::string uri) +{ + this->absoluteuri = uri; +} +void Segment::Host (std::string host) +{ + this->host = host; +} +void Segment::Port (size_t port) +{ + this->port = port; +} +void Segment::Path (std::string path) +{ + this->path = path; +} +void Segment::Range (std::string range) +{ + this->range = range; +} +void Segment::StartByte (size_t startByte) +{ + this->startByte = startByte; +} +void Segment::EndByte (size_t endByte) +{ + this->endByte = endByte; +} +void Segment::HasByteRange (bool hasByteRange) +{ + this->hasByteRange = hasByteRange; +} +HTTPTransactionType Segment::GetType () +{ + return this->type; +} +void Segment::SetType (HTTPTransactionType type) +{ + this->type = type; +} diff --git a/libdash/source/mpd/Segment.h b/libdash/source/mpd/Segment.h new file mode 100644 index 00000000..6f44a6f2 --- /dev/null +++ b/libdash/source/mpd/Segment.h @@ -0,0 +1,69 @@ +/* + * Segment.h + ***************************************************************************** + * Copyright (C) 2013, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENT_H_ +#define SEGMENT_H_ + +#include "config.h" + +#include "../network/AbstractChunk.h" +#include "../helpers/Path.h" +#include "ISegment.h" +#include "IBaseUrl.h" +#include "../metrics/HTTPTransaction.h" + +namespace dash +{ + namespace mpd + { + class Segment : public network::AbstractChunk, public virtual ISegment + { + public: + Segment (); + virtual ~Segment(); + + bool Init (const std::vector<IBaseUrl *>& baseurls, const std::string &uri, + const std::string &range, dash::metrics::HTTPTransactionType type); + std::string& AbsoluteURI (); + std::string& Host (); + size_t Port (); + std::string& Path (); + std::string& Range (); + size_t StartByte (); + size_t EndByte (); + bool HasByteRange (); + dash::metrics::HTTPTransactionType GetType (); + + void AbsoluteURI (std::string uri); + void Host (std::string host); + void Port (size_t port); + void Path (std::string path); + void Range (std::string range); + void StartByte (size_t startByte); + void EndByte (size_t endByte); + void HasByteRange (bool hasByteRange); + void SetType (dash::metrics::HTTPTransactionType type); + + private: + std::string absoluteuri; + std::string host; + size_t port; + std::string path; + std::string range; + size_t startByte; + size_t endByte; + bool hasByteRange; + dash::metrics::HTTPTransactionType type; + }; + } +} + +#endif /* SEGMENT_H_ */ diff --git a/libdash/source/mpd/SegmentBase.cpp b/libdash/source/mpd/SegmentBase.cpp new file mode 100644 index 00000000..b1d890d9 --- /dev/null +++ b/libdash/source/mpd/SegmentBase.cpp @@ -0,0 +1,78 @@ +/* + * SegmentBase.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SegmentBase.h" + +using namespace dash::mpd; + +SegmentBase::SegmentBase () : + initialization(NULL), + representationIndex(NULL), + timescale(1), + presentationTimeOffset(0), + indexRange(""), + indexRangeExact(false) +{ +} +SegmentBase::~SegmentBase () +{ + delete(this->initialization); + delete(this->representationIndex); +} + +const IURLType* SegmentBase::GetInitialization () const +{ + return this->initialization; +} +void SegmentBase::SetInitialization (URLType *initialization) +{ + this->initialization = initialization; +} +const IURLType* SegmentBase::GetRepresentationIndex () const +{ + return this->representationIndex; +} +void SegmentBase::SetRepresentationIndex (URLType *representationIndex) +{ + this->representationIndex = representationIndex; +} +uint32_t SegmentBase::GetTimescale () const +{ + return this->timescale; +} +void SegmentBase::SetTimescale (uint32_t timescale) +{ + this->timescale = timescale; +} +uint32_t SegmentBase::GetPresentationTimeOffset () const +{ + return this->presentationTimeOffset; +} +void SegmentBase::SetPresentationTimeOffset (uint32_t presentationTimeOffset) +{ + this->presentationTimeOffset = presentationTimeOffset; +} +const std::string& SegmentBase::GetIndexRange () const +{ + return this->indexRange; +} +void SegmentBase::SetIndexRange (const std::string& indexRange) +{ + this->indexRange = indexRange; +} +bool SegmentBase::HasIndexRangeExact () const +{ + return this->indexRangeExact; +} +void SegmentBase::SetIndexRangeExact (bool indexRangeExact) +{ + this->indexRangeExact = indexRangeExact; +} diff --git a/libdash/source/mpd/SegmentBase.h b/libdash/source/mpd/SegmentBase.h new file mode 100644 index 00000000..d627eb04 --- /dev/null +++ b/libdash/source/mpd/SegmentBase.h @@ -0,0 +1,56 @@ +/* + * SegmentBase.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENTBASE_H_ +#define SEGMENTBASE_H_ + +#include "config.h" + +#include "ISegmentBase.h" +#include "URLType.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class SegmentBase : public virtual ISegmentBase, public AbstractMPDElement + { + public: + SegmentBase (); + virtual ~SegmentBase (); + + const IURLType* GetInitialization () const; + const IURLType* GetRepresentationIndex () const; + uint32_t GetTimescale () const; + uint32_t GetPresentationTimeOffset () const; + const std::string& GetIndexRange () const; + bool HasIndexRangeExact () const; + + void SetInitialization (URLType *initialization); + void SetRepresentationIndex (URLType *representationIndex); + void SetTimescale (uint32_t timescale); + void SetPresentationTimeOffset (uint32_t presentationTimeOffset); + void SetIndexRange (const std::string& indexRange); + void SetIndexRangeExact (bool indexRangeExact); + + protected: + URLType *initialization; + URLType *representationIndex; + uint32_t timescale; + uint32_t presentationTimeOffset; + std::string indexRange; + bool indexRangeExact; + }; + } +} + +#endif /* SEGMENTBASE_H_ */ diff --git a/libdash/source/mpd/SegmentList.cpp b/libdash/source/mpd/SegmentList.cpp new file mode 100644 index 00000000..d96264cb --- /dev/null +++ b/libdash/source/mpd/SegmentList.cpp @@ -0,0 +1,50 @@ +/* + * SegmentList.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SegmentList.h" + +using namespace dash::mpd; + +SegmentList::SegmentList () : + xlinkHref(""), + xlinkActuate("onRequest") +{ +} +SegmentList::~SegmentList () +{ + for (size_t i = 0; i < segmentURLs.size(); i++) + delete(this->segmentURLs.at(i)); +} + +const std::vector<ISegmentURL*>& SegmentList::GetSegmentURLs () const +{ + return (std::vector<ISegmentURL*> &) this->segmentURLs; +} +void SegmentList::AddSegmentURL (SegmentURL *segmentURL) +{ + this->segmentURLs.push_back(segmentURL); +} +const std::string& SegmentList::GetXlinkHref () const +{ + return this->xlinkHref; +} +void SegmentList::SetXlinkHref (const std::string& xlinkHref) +{ + this->xlinkHref = xlinkHref; +} +const std::string& SegmentList::GetXlinkActuate () const +{ + return this->xlinkActuate; +} +void SegmentList::SetXlinkActuate (const std::string& xlinkActuate) +{ + this->xlinkActuate = xlinkActuate; +} diff --git a/libdash/source/mpd/SegmentList.h b/libdash/source/mpd/SegmentList.h new file mode 100644 index 00000000..b743c009 --- /dev/null +++ b/libdash/source/mpd/SegmentList.h @@ -0,0 +1,47 @@ +/* + * SegmentList.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENTLIST_H_ +#define SEGMENTLIST_H_ + +#include "config.h" + +#include "ISegmentList.h" +#include "MultipleSegmentBase.h" +#include "SegmentURL.h" + +namespace dash +{ + namespace mpd + { + class SegmentList : public ISegmentList, public MultipleSegmentBase + { + public: + SegmentList (); + virtual ~SegmentList (); + + const std::vector<ISegmentURL *>& GetSegmentURLs () const; + const std::string& GetXlinkHref () const; + const std::string& GetXlinkActuate () const; + + void AddSegmentURL (SegmentURL *segmetURL); + void SetXlinkHref (const std::string& xlinkHref); + void SetXlinkActuate (const std::string& xlinkActuate); + + private: + std::vector<SegmentURL *> segmentURLs; + std::string xlinkHref; + std::string xlinkActuate; + }; + } +} + +#endif /* SEGMENTLIST_H_ */ diff --git a/libdash/source/mpd/SegmentTemplate.cpp b/libdash/source/mpd/SegmentTemplate.cpp new file mode 100644 index 00000000..b92c4692 --- /dev/null +++ b/libdash/source/mpd/SegmentTemplate.cpp @@ -0,0 +1,152 @@ +/* + * SegmentTemplate.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SegmentTemplate.h" + +using namespace dash::mpd; +using namespace dash::metrics; + +SegmentTemplate::SegmentTemplate () : + media(""), + index(""), + initialization(""), + bitstreamSwitching("") +{ +} +SegmentTemplate::~SegmentTemplate () +{ +} + +const std::string& SegmentTemplate::Getmedia () const +{ + return this->media; +} +void SegmentTemplate::SetMedia (const std::string& media) +{ + this->media = media; +} +const std::string& SegmentTemplate::Getindex () const +{ + return this->index; +} +void SegmentTemplate::SetIndex (const std::string& index) +{ + this->index = index; +} +const std::string& SegmentTemplate::Getinitialization () const +{ + return this->initialization; +} +void SegmentTemplate::SetInitialization (const std::string& initialization) +{ + this->initialization = initialization; +} +const std::string& SegmentTemplate::GetbitstreamSwitching () const +{ + return this->bitstreamSwitching; +} +void SegmentTemplate::SetBitstreamSwitching (const std::string& bitstreamSwitching) +{ + this->bitstreamSwitching = bitstreamSwitching; +} +ISegment* SegmentTemplate::ToInitializationSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const +{ + return ToSegment(this->initialization, baseurls, representationID, bandwidth, dash::metrics::InitializationSegment); +} +ISegment* SegmentTemplate::ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const +{ + return ToSegment(this->bitstreamSwitching, baseurls, representationID, bandwidth, dash::metrics::BitstreamSwitchingSegment); +} +ISegment* SegmentTemplate::GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const +{ + return ToSegment(this->media, baseurls, representationID, bandwidth, dash::metrics::MediaSegment, number); +} +ISegment* SegmentTemplate::GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const +{ + return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, number); +} +ISegment* SegmentTemplate::GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const +{ + return ToSegment(this->media, baseurls, representationID, bandwidth, dash::metrics::MediaSegment, 0, time); +} +ISegment* SegmentTemplate::GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const +{ + return ToSegment(this->index, baseurls, representationID, bandwidth, dash::metrics::IndexSegment, 0, time); +} +std::string SegmentTemplate::ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const +{ + std::vector<std::string> chunks; + std::string replacedUri = ""; + + dash::helpers::String::Split(uri, '$', chunks); + + if (chunks.size() > 1) + { + for(size_t i = 0; i < chunks.size(); i++) + { + if ( chunks.at(i) == "RepresentationID") { + chunks.at(i) = representationID; + continue; + } + + if (chunks.at(i).find("Bandwidth") == 0) + { + FormatChunk(chunks.at(i), bandwidth); + continue; + } + + if (chunks.at(i).find("Number") == 0) + { + FormatChunk(chunks.at(i), number); + continue; + } + + if (chunks.at(i).find("Time") == 0) + { + FormatChunk(chunks.at(i), time); + continue; + } + } + + for(size_t i = 0; i < chunks.size(); i++) + replacedUri += chunks.at(i); + + return replacedUri; + } + else + { + replacedUri = uri; + return replacedUri; + } +} +void SegmentTemplate::FormatChunk (std::string& uri, uint32_t number) const +{ + char formattedNumber [50]; + size_t pos = 0; + std::string formatTag = "%01d"; + + if ( (pos = uri.find("%0")) != std::string::npos) + formatTag = uri.substr(pos).append("d"); + + sprintf(formattedNumber, formatTag.c_str(), number); + uri = formattedNumber; +} +ISegment* SegmentTemplate::ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, HTTPTransactionType type, uint32_t number, uint32_t time) const +{ + Segment *seg = new Segment(); + + if(seg->Init(baseurls, ReplaceParameters(uri, representationID, bandwidth, number, time), "", type)) + return seg; + + delete(seg); + + return NULL; +}
\ No newline at end of file diff --git a/libdash/source/mpd/SegmentTemplate.h b/libdash/source/mpd/SegmentTemplate.h new file mode 100644 index 00000000..e5782a83 --- /dev/null +++ b/libdash/source/mpd/SegmentTemplate.h @@ -0,0 +1,61 @@ +/* + * SegmentTemplate.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENTTEMPLATE_H_ +#define SEGMENTTEMPLATE_H_ + +#include "config.h" + +#include "ISegmentTemplate.h" +#include "MultipleSegmentBase.h" +#include "../helpers/String.h" + +namespace dash +{ + namespace mpd + { + class SegmentTemplate : public ISegmentTemplate, public MultipleSegmentBase + { + public: + SegmentTemplate (); + virtual ~SegmentTemplate (); + + const std::string& Getmedia () const; + const std::string& Getindex () const; + const std::string& Getinitialization () const; + const std::string& GetbitstreamSwitching () const; + ISegment* ToInitializationSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const; + ISegment* ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const; + ISegment* GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const; + ISegment* GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const; + ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const; + ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const; + + void SetMedia (const std::string& media); + void SetIndex (const std::string& index); + void SetInitialization (const std::string& initialization); + void SetBitstreamSwitching (const std::string& bitstreamSwichting); + + private: + std::string ReplaceParameters (const std::string& uri, const std::string& representationID, uint32_t bandwidth, uint32_t number, uint32_t time) const; + void FormatChunk (std::string& uri, uint32_t number) const; + ISegment* ToSegment (const std::string& uri, const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, + dash::metrics::HTTPTransactionType type, uint32_t number = 0, uint32_t time = 0) const; + + std::string media; + std::string index; + std::string initialization; + std::string bitstreamSwitching; + }; + } +} + +#endif /* SEGMENTTEMPLATE_H_ */ diff --git a/libdash/source/mpd/SegmentTimeline.cpp b/libdash/source/mpd/SegmentTimeline.cpp new file mode 100644 index 00000000..8a55dc46 --- /dev/null +++ b/libdash/source/mpd/SegmentTimeline.cpp @@ -0,0 +1,32 @@ +/* + * SegmentTimeline.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SegmentTimeline.h" + +using namespace dash::mpd; + +SegmentTimeline::SegmentTimeline () +{ +} +SegmentTimeline::~SegmentTimeline () +{ + for (size_t i=0; i < this->timelines.size(); i++) + delete(this->timelines.at(i)); +} + +std::vector<ITimeline *>& SegmentTimeline::GetTimelines () const +{ + return (std::vector<ITimeline*> &) this->timelines; +} +void SegmentTimeline::AddTimeline (Timeline *timeline) +{ + this->timelines.push_back(timeline); +}
\ No newline at end of file diff --git a/libdash/source/mpd/SegmentTimeline.h b/libdash/source/mpd/SegmentTimeline.h new file mode 100644 index 00000000..2d0ff2f8 --- /dev/null +++ b/libdash/source/mpd/SegmentTimeline.h @@ -0,0 +1,40 @@ +/* + * SegmentTimeline.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENTTIMELINE_H_ +#define SEGMENTTIMELINE_H_ + +#include "config.h" + +#include "ISegmentTimeline.h" +#include "AbstractMPDElement.h" +#include "Timeline.h" + +namespace dash +{ + namespace mpd + { + class SegmentTimeline : public ISegmentTimeline, public AbstractMPDElement + { + public: + SegmentTimeline (); + virtual ~SegmentTimeline (); + + std::vector<ITimeline *>& GetTimelines () const; + void AddTimeline (Timeline *timeline); + + private: + std::vector<ITimeline *> timelines; + }; + } +} + +#endif /* SEGMENTTIMELINE_H_ */ diff --git a/libdash/source/mpd/SegmentURL.cpp b/libdash/source/mpd/SegmentURL.cpp new file mode 100644 index 00000000..765cc969 --- /dev/null +++ b/libdash/source/mpd/SegmentURL.cpp @@ -0,0 +1,90 @@ +/* + * SegmentURL.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SegmentURL.h" + +using namespace dash::mpd; +using namespace dash::helpers; + +SegmentURL::SegmentURL () : + mediaURI(""), + mediaRange(""), + indexURI(""), + indexRange(""), + bitrate(0) +{ +} +SegmentURL::~SegmentURL () +{ +} + +const std::string& SegmentURL::GetMediaURI () const +{ + return this->mediaURI; +} +void SegmentURL::SetMediaURI (const std::string& mediaURI) +{ + this->mediaURI = mediaURI; +} +const std::string& SegmentURL::GetMediaRange () const +{ + return this->mediaRange; +} +void SegmentURL::SetMediaRange (const std::string& mediaRange) +{ + this->mediaRange = mediaRange; +} +const std::string& SegmentURL::GetIndexURI () const +{ + return this->indexURI; +} +uint64_t SegmentURL::GetActualRate () +{ + return this->bitrate; +} +void SegmentURL::SetIndexURI (const std::string& indexURI) +{ + this->indexURI = indexURI; +} +const std::string& SegmentURL::GetIndexRange () const +{ + return this->indexRange; +} +void SegmentURL::SetIndexRange (const std::string& indexRange) +{ + this->indexRange = indexRange; +} +void SegmentURL::SetBitrate (const std::string& bitrate) +{ + this->bitrate = atoi(bitrate.c_str()); +} +ISegment* SegmentURL::ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const +{ + Segment *seg = new Segment(); + + if(seg->Init(baseurls, this->mediaURI, this->mediaRange, dash::metrics::MediaSegment)) + return seg; + + delete(seg); + + return NULL; +} +ISegment* SegmentURL::ToIndexSegment (const std::vector<IBaseUrl *>& baseurls) const +{ + Segment *seg = new Segment(); + + if(seg->Init(baseurls, this->indexURI, this->indexRange, dash::metrics::IndexSegment)) + return seg; + + delete(seg); + + return NULL; +} diff --git a/libdash/source/mpd/SegmentURL.h b/libdash/source/mpd/SegmentURL.h new file mode 100644 index 00000000..7dfdb56b --- /dev/null +++ b/libdash/source/mpd/SegmentURL.h @@ -0,0 +1,56 @@ +/* + * SegmentURL.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SEGMENTURL_H_ +#define SEGMENTURL_H_ + +#include "config.h" + +#include "ISegmentURL.h" +#include "../helpers/Path.h" +#include "Segment.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class SegmentURL : public ISegmentURL, public AbstractMPDElement + { + public: + SegmentURL (); + virtual ~SegmentURL(); + + const std::string& GetMediaURI () const; + const std::string& GetMediaRange () const; + const std::string& GetIndexURI () const; + const std::string& GetIndexRange () const; + uint64_t GetActualRate (); + + ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const; + ISegment* ToIndexSegment (const std::vector<IBaseUrl *>& baseurls) const; + + void SetMediaURI (const std::string& mediaURI); + void SetMediaRange (const std::string& mediaRange); + void SetIndexURI (const std::string& indexURI); + void SetIndexRange (const std::string& indexRange); + void SetBitrate (const std::string& bitrate); + private: + std::string mediaURI; + std::string mediaRange; + std::string indexURI; + std::string indexRange; + int bitrate; + }; + } +} + +#endif /* SEGMENTURL_H_ */ diff --git a/libdash/source/mpd/SubRepresentation.cpp b/libdash/source/mpd/SubRepresentation.cpp new file mode 100644 index 00000000..34b11e57 --- /dev/null +++ b/libdash/source/mpd/SubRepresentation.cpp @@ -0,0 +1,55 @@ +/* + * SubRepresentation.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "SubRepresentation.h" + +using namespace dash::mpd; + +SubRepresentation::SubRepresentation () : + level(0), + bandWidth(0) +{ +} +SubRepresentation::~SubRepresentation () +{ +} +uint32_t SubRepresentation::GetLevel () const +{ + return this->level; +} +void SubRepresentation::SetLevel (uint32_t level) +{ + this->level = level; +} +const std::vector<uint32_t>& SubRepresentation::GetDependencyLevel () const +{ + return this->dependencyLevel; +} +void SubRepresentation::SetDependencyLevel (const std::string& dependencyLevel) +{ + dash::helpers::String::Split(dependencyLevel, ' ', this->dependencyLevel); +} +uint32_t SubRepresentation::GetBandWidth () const +{ + return this->bandWidth; +} +void SubRepresentation::SetBandWidth (uint32_t bandWidth) +{ + this->bandWidth = bandWidth; +} +const std::vector<std::string>& SubRepresentation::GetContentComponent () const +{ + return this->contentComponent; +} +void SubRepresentation::SetContentComponent (const std::string& contentComponent) +{ + dash::helpers::String::Split(contentComponent, ' ', this->contentComponent); +} diff --git a/libdash/source/mpd/SubRepresentation.h b/libdash/source/mpd/SubRepresentation.h new file mode 100644 index 00000000..f14fbfae --- /dev/null +++ b/libdash/source/mpd/SubRepresentation.h @@ -0,0 +1,50 @@ +/* + * SubRepresentation.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SUBREPRESENTATION_H_ +#define SUBREPRESENTATION_H_ + +#include "config.h" + +#include "ISubRepresentation.h" +#include "Descriptor.h" +#include "RepresentationBase.h" +#include "../helpers/String.h" + +namespace dash +{ + namespace mpd + { + class SubRepresentation : public ISubRepresentation, public RepresentationBase + { + public: + SubRepresentation (); + virtual ~SubRepresentation (); + + uint32_t GetLevel () const; + const std::vector<uint32_t>& GetDependencyLevel () const; + uint32_t GetBandWidth () const; + const std::vector<std::string>& GetContentComponent () const; + + void SetLevel (uint32_t level); + void SetDependencyLevel (const std::string& dependencyLevel); + void SetBandWidth (uint32_t bandWidth); + void SetContentComponent (const std::string& contentComponent); + + protected: + uint32_t level; + std::vector<uint32_t> dependencyLevel; + uint32_t bandWidth; + std::vector<std::string> contentComponent; + }; + } +} +#endif /* SUBREPRESENTATION_H_ */ diff --git a/libdash/source/mpd/Subset.cpp b/libdash/source/mpd/Subset.cpp new file mode 100644 index 00000000..6b0d2df6 --- /dev/null +++ b/libdash/source/mpd/Subset.cpp @@ -0,0 +1,30 @@ +/* + * Subset.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Subset.h" + +using namespace dash::mpd; + +Subset::Subset () +{ +} +Subset::~Subset () +{ +} + +const std::vector<uint32_t>& Subset::Contains () const +{ + return this->subset; +} +void Subset::SetSubset (const std::string& subset) +{ + dash::helpers::String::Split(subset, ' ', this->subset); +} diff --git a/libdash/source/mpd/Subset.h b/libdash/source/mpd/Subset.h new file mode 100644 index 00000000..c56eb6e2 --- /dev/null +++ b/libdash/source/mpd/Subset.h @@ -0,0 +1,41 @@ +/* + * Subset.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef SUBSET_H_ +#define SUBSET_H_ + +#include "config.h" + +#include "ISubset.h" +#include "../helpers/String.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class Subset : public ISubset, public AbstractMPDElement + { + public: + Subset (); + virtual ~Subset (); + + const std::vector<uint32_t>& Contains () const; + + void SetSubset (const std::string& subset); + + private: + std::vector<uint32_t> subset; + }; + } +} + +#endif /* SUBSET_H_ */ diff --git a/libdash/source/mpd/Timeline.cpp b/libdash/source/mpd/Timeline.cpp new file mode 100644 index 00000000..624c6585 --- /dev/null +++ b/libdash/source/mpd/Timeline.cpp @@ -0,0 +1,49 @@ +/* + * Timeline.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "Timeline.h" + +using namespace dash::mpd; + +Timeline::Timeline () : + startTime(0), + duration(0), + repeatCount(0) +{ +} +Timeline::~Timeline () +{ +} + +uint32_t Timeline::GetStartTime () const +{ + return this->startTime; +} +void Timeline::SetStartTime (uint32_t startTime) +{ + this->startTime = startTime; +} +uint32_t Timeline::GetDuration () const +{ + return this->duration; +} +void Timeline::SetDuration (uint32_t duration) +{ + this->duration = duration; +} +uint32_t Timeline::GetRepeatCount () const +{ + return this->repeatCount; +} +void Timeline::SetRepeatCount (uint32_t repeatCount) +{ + this->repeatCount = repeatCount; +}
\ No newline at end of file diff --git a/libdash/source/mpd/Timeline.h b/libdash/source/mpd/Timeline.h new file mode 100644 index 00000000..3caa331f --- /dev/null +++ b/libdash/source/mpd/Timeline.h @@ -0,0 +1,46 @@ +/* + * Timeline.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef TIMELINE_H_ +#define TIMELINE_H_ + +#include "config.h" + +#include "ITimeline.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class Timeline : public ITimeline, public AbstractMPDElement + { + public: + Timeline (); + virtual ~Timeline (); + + uint32_t GetStartTime () const; + uint32_t GetDuration () const; + uint32_t GetRepeatCount () const; + + void SetStartTime (uint32_t startTime); + void SetDuration (uint32_t duration); + void SetRepeatCount (uint32_t repeatCount); + + private: + uint32_t startTime; + uint32_t duration; + uint32_t repeatCount; + }; + } +} + +#endif /* TIMELINE_H_ */ diff --git a/libdash/source/mpd/URLType.cpp b/libdash/source/mpd/URLType.cpp new file mode 100644 index 00000000..699672e7 --- /dev/null +++ b/libdash/source/mpd/URLType.cpp @@ -0,0 +1,57 @@ +/* + * URLType.cpp + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#include "URLType.h" + +using namespace dash::mpd; +using namespace dash::helpers; +using namespace dash::metrics; + +URLType::URLType () : + sourceURL(""), + range("") +{ +} +URLType::~URLType () +{ +} + +const std::string& URLType::GetSourceURL () const +{ + return this->sourceURL; +} +void URLType::SetSourceURL (const std::string& sourceURL) +{ + this->sourceURL = sourceURL; +} +const std::string& URLType::GetRange () const +{ + return this->range; +} +void URLType::SetRange (const std::string& range) +{ + this->range = range; +} +void URLType::SetType (HTTPTransactionType type) +{ + this->type = type; +} +ISegment* URLType::ToSegment (const std::vector<IBaseUrl *>& baseurls) const +{ + Segment *seg = new Segment(); + + if(seg->Init(baseurls, this->sourceURL, this->range, this->type)) + return seg; + + delete(seg); + + return NULL; +} diff --git a/libdash/source/mpd/URLType.h b/libdash/source/mpd/URLType.h new file mode 100644 index 00000000..1fcd00c7 --- /dev/null +++ b/libdash/source/mpd/URLType.h @@ -0,0 +1,48 @@ +/* + * URLType.h + ***************************************************************************** + * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved + * + * Email: libdash-dev@vicky.bitmovin.net + * + * This source code and its use and distribution, is subject to the terms + * and conditions of the applicable license agreement. + *****************************************************************************/ + +#ifndef URLTYPE_H_ +#define URLTYPE_H_ + +#include "config.h" + +#include "IURLType.h" +#include "Segment.h" +#include "../helpers/Path.h" +#include "AbstractMPDElement.h" + +namespace dash +{ + namespace mpd + { + class URLType : public IURLType, public AbstractMPDElement + { + public: + URLType (); + virtual ~URLType (); + + const std::string& GetSourceURL () const; + const std::string& GetRange () const; + ISegment* ToSegment (const std::vector<IBaseUrl *>& baseurls) const; + + void SetSourceURL (const std::string& sourceURL); + void SetRange (const std::string& range); + void SetType (dash::metrics::HTTPTransactionType type); + + private: + std::string sourceURL; + std::string range; + dash::metrics::HTTPTransactionType type; + }; + } +} + +#endif /* URLTYPE_H_ */ |