summaryrefslogtreecommitdiffstats
path: root/libdash
diff options
context:
space:
mode:
Diffstat (limited to 'libdash')
-rw-r--r--libdash/Authors.txt10
-rw-r--r--libdash/CMakeLists.txt174
-rw-r--r--libdash/include/IAdaptationSet.h367
-rw-r--r--libdash/include/IBaseUrl.h69
-rw-r--r--libdash/include/IChunk.h88
-rw-r--r--libdash/include/IConnection.h69
-rw-r--r--libdash/include/IContentComponent.h83
-rw-r--r--libdash/include/IDASHManager.h45
-rw-r--r--libdash/include/IDASHMetrics.h48
-rw-r--r--libdash/include/IDescriptor.h68
-rw-r--r--libdash/include/IDownloadObserver.h58
-rw-r--r--libdash/include/IDownloadObserver.h.save58
-rw-r--r--libdash/include/IDownloadableChunk.h93
-rw-r--r--libdash/include/IHTTPTransaction.h56
-rw-r--r--libdash/include/IMPD.h207
-rw-r--r--libdash/include/IMPDElement.h77
-rw-r--r--libdash/include/IMetrics.h62
-rw-r--r--libdash/include/IMultipleSegmentBase.h66
-rw-r--r--libdash/include/INode.h97
-rw-r--r--libdash/include/IPeriod.h156
-rw-r--r--libdash/include/IProgramInformation.h69
-rw-r--r--libdash/include/IRange.h53
-rw-r--r--libdash/include/IRepresentation.h159
-rw-r--r--libdash/include/IRepresentationBase.h181
-rw-r--r--libdash/include/ISegment.h86
-rw-r--r--libdash/include/ISegmentBase.h86
-rw-r--r--libdash/include/ISegmentList.h58
-rw-r--r--libdash/include/ISegmentTemplate.h148
-rw-r--r--libdash/include/ISegmentTimeline.h50
-rw-r--r--libdash/include/ISegmentURL.h94
-rw-r--r--libdash/include/ISubRepresentation.h70
-rw-r--r--libdash/include/ISubset.h54
-rw-r--r--libdash/include/ITCPConnection.h40
-rw-r--r--libdash/include/IThroughputMeasurement.h38
-rw-r--r--libdash/include/ITimeline.h66
-rw-r--r--libdash/include/IURLType.h61
-rw-r--r--libdash/include/config.h37
-rw-r--r--libdash/include/libdash.h31
-rw-r--r--libdash/license.txt13
-rw-r--r--libdash/mainpage.dox93
-rw-r--r--libdash/source/defaults.mk7
-rw-r--r--libdash/source/dllmain.cpp33
-rw-r--r--libdash/source/helpers/Block.h59
-rw-r--r--libdash/source/helpers/BlockStream.cpp290
-rw-r--r--libdash/source/helpers/BlockStream.h55
-rw-r--r--libdash/source/helpers/Path.cpp118
-rw-r--r--libdash/source/helpers/Path.h33
-rw-r--r--libdash/source/helpers/String.cpp53
-rw-r--r--libdash/source/helpers/String.h31
-rw-r--r--libdash/source/helpers/SyncedBlockStream.cpp250
-rw-r--r--libdash/source/helpers/SyncedBlockStream.h57
-rw-r--r--libdash/source/helpers/Time.cpp33
-rw-r--r--libdash/source/helpers/Time.h35
-rw-r--r--libdash/source/libdash.cpp20
-rw-r--r--libdash/source/manager/DASHManager.cpp45
-rw-r--r--libdash/source/manager/DASHManager.h35
-rw-r--r--libdash/source/metrics/HTTPTransaction.cpp122
-rw-r--r--libdash/source/metrics/HTTPTransaction.h68
-rw-r--r--libdash/source/metrics/TCPConnection.cpp62
-rw-r--r--libdash/source/metrics/TCPConnection.h49
-rw-r--r--libdash/source/metrics/ThroughputMeasurement.cpp46
-rw-r--r--libdash/source/metrics/ThroughputMeasurement.h43
-rw-r--r--libdash/source/mpd/AbstractMPDElement.cpp41
-rw-r--r--libdash/source/mpd/AbstractMPDElement.h41
-rw-r--r--libdash/source/mpd/AdaptationSet.cpp343
-rw-r--r--libdash/source/mpd/AdaptationSet.h138
-rw-r--r--libdash/source/mpd/BaseUrl.cpp60
-rw-r--r--libdash/source/mpd/BaseUrl.h49
-rw-r--r--libdash/source/mpd/ContentComponent.cpp98
-rw-r--r--libdash/source/mpd/ContentComponent.h62
-rw-r--r--libdash/source/mpd/Descriptor.cpp39
-rw-r--r--libdash/source/mpd/Descriptor.h43
-rw-r--r--libdash/source/mpd/MPD.cpp212
-rw-r--r--libdash/source/mpd/MPD.h107
-rw-r--r--libdash/source/mpd/Metrics.cpp51
-rw-r--r--libdash/source/mpd/Metrics.h51
-rw-r--r--libdash/source/mpd/MultipleSegmentBase.cpp60
-rw-r--r--libdash/source/mpd/MultipleSegmentBase.h51
-rw-r--r--libdash/source/mpd/Period.cpp137
-rw-r--r--libdash/source/mpd/Period.h79
-rw-r--r--libdash/source/mpd/ProgramInformation.cpp67
-rw-r--r--libdash/source/mpd/ProgramInformation.h52
-rw-r--r--libdash/source/mpd/Range.cpp40
-rw-r--r--libdash/source/mpd/Range.h42
-rw-r--r--libdash/source/mpd/Representation.cpp116
-rw-r--r--libdash/source/mpd/Representation.h75
-rw-r--r--libdash/source/mpd/RepresentationBase.cpp175
-rw-r--r--libdash/source/mpd/RepresentationBase.h89
-rw-r--r--libdash/source/mpd/Segment.cpp138
-rw-r--r--libdash/source/mpd/Segment.h69
-rw-r--r--libdash/source/mpd/SegmentBase.cpp78
-rw-r--r--libdash/source/mpd/SegmentBase.h56
-rw-r--r--libdash/source/mpd/SegmentList.cpp50
-rw-r--r--libdash/source/mpd/SegmentList.h47
-rw-r--r--libdash/source/mpd/SegmentTemplate.cpp152
-rw-r--r--libdash/source/mpd/SegmentTemplate.h61
-rw-r--r--libdash/source/mpd/SegmentTimeline.cpp32
-rw-r--r--libdash/source/mpd/SegmentTimeline.h40
-rw-r--r--libdash/source/mpd/SegmentURL.cpp90
-rw-r--r--libdash/source/mpd/SegmentURL.h56
-rw-r--r--libdash/source/mpd/SubRepresentation.cpp55
-rw-r--r--libdash/source/mpd/SubRepresentation.h50
-rw-r--r--libdash/source/mpd/Subset.cpp30
-rw-r--r--libdash/source/mpd/Subset.h41
-rw-r--r--libdash/source/mpd/Timeline.cpp49
-rw-r--r--libdash/source/mpd/Timeline.h46
-rw-r--r--libdash/source/mpd/URLType.cpp57
-rw-r--r--libdash/source/mpd/URLType.h48
-rw-r--r--libdash/source/network/AbstractChunk.cpp271
-rw-r--r--libdash/source/network/AbstractChunk.h100
-rw-r--r--libdash/source/network/DownloadStateManager.cpp100
-rw-r--r--libdash/source/network/DownloadStateManager.h50
-rw-r--r--libdash/source/portable/MultiThreading.cpp112
-rw-r--r--libdash/source/portable/MultiThreading.h70
-rw-r--r--libdash/source/portable/Networking.h27
-rw-r--r--libdash/source/sublibs.mk23
-rw-r--r--libdash/source/targetver.h18
-rw-r--r--libdash/source/xml/DOMHelper.cpp54
-rw-r--r--libdash/source/xml/DOMHelper.h35
-rw-r--r--libdash/source/xml/DOMParser.cpp160
-rw-r--r--libdash/source/xml/DOMParser.h56
-rw-r--r--libdash/source/xml/Node.cpp1029
-rw-r--r--libdash/source/xml/Node.h105
123 files changed, 10755 insertions, 0 deletions
diff --git a/libdash/Authors.txt b/libdash/Authors.txt
new file mode 100644
index 00000000..3e02b3d6
--- /dev/null
+++ b/libdash/Authors.txt
@@ -0,0 +1,10 @@
+ *****************************************************************************
+ * Copyright (C) 2012, bitmovin Softwareentwicklung OG, All Rights Reserved
+ *
+ * Authors:
+ * Christopher Mueller <christopher.mueller@bitmovin.net>
+ * Joerg Poecher <joerg.poecher@bitmovin.net>
+ *
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ ****************************************************************************** \ No newline at end of file
diff --git a/libdash/CMakeLists.txt b/libdash/CMakeLists.txt
new file mode 100644
index 00000000..92ca8d57
--- /dev/null
+++ b/libdash/CMakeLists.txt
@@ -0,0 +1,174 @@
+cmake_minimum_required(VERSION 3.5)
+project(libdash)
+set(CMAKE_CXX_FLAGS "-std=c++0x -g -DLOG_BUILD")
+set(DEBUG_BUILD FALSE)
+set(HEADER_FILES
+ include/config.h
+ include/IAdaptationSet.h
+ include/IBaseUrl.h
+ include/IChunk.h
+ include/IConnection.h
+ include/IContentComponent.h
+ include/IDASHManager.h
+ include/IDASHMetrics.h
+ include/IDescriptor.h
+ include/IDownloadableChunk.h
+ include/IDownloadObserver.h
+ include/IHTTPTransaction.h
+ include/IMetrics.h
+ include/IMPD.h
+ include/IMPDElement.h
+ include/IMultipleSegmentBase.h
+ include/INode.h
+ include/IPeriod.h
+ include/IProgramInformation.h
+ include/IRange.h
+ include/IRepresentation.h
+ include/IRepresentationBase.h
+ include/ISegment.h
+ include/ISegmentBase.h
+ include/ISegmentList.h
+ include/ISegmentTemplate.h
+ include/ISegmentTimeline.h
+ include/ISegmentURL.h
+ include/ISubRepresentation.h
+ include/ISubset.h
+ include/ITCPConnection.h
+ include/IThroughputMeasurement.h
+ include/ITimeline.h
+ include/IURLType.h
+ include/libdash.h)
+
+set(SOURCE_FILES
+ include/config.h
+ include/IAdaptationSet.h
+ include/IBaseUrl.h
+ include/IChunk.h
+ include/IConnection.h
+ include/IContentComponent.h
+ include/IDASHManager.h
+ include/IDASHMetrics.h
+ include/IDescriptor.h
+ include/IDownloadableChunk.h
+ include/IDownloadObserver.h
+ include/IHTTPTransaction.h
+ include/IMetrics.h
+ include/IMPD.h
+ include/IMPDElement.h
+ include/IMultipleSegmentBase.h
+ include/INode.h
+ include/IPeriod.h
+ include/IProgramInformation.h
+ include/IRange.h
+ include/IRepresentation.h
+ include/IRepresentationBase.h
+ include/ISegment.h
+ include/ISegmentBase.h
+ include/ISegmentList.h
+ include/ISegmentTemplate.h
+ include/ISegmentTimeline.h
+ include/ISegmentURL.h
+ include/ISubRepresentation.h
+ include/ISubset.h
+ include/ITCPConnection.h
+ include/IThroughputMeasurement.h
+ include/ITimeline.h
+ include/IURLType.h
+ include/libdash.h
+ source/helpers/Block.h
+ source/helpers/BlockStream.cpp
+ source/helpers/BlockStream.h
+ source/helpers/Path.cpp
+ source/helpers/Path.h
+ source/helpers/String.cpp
+ source/helpers/String.h
+ source/helpers/SyncedBlockStream.cpp
+ source/helpers/SyncedBlockStream.h
+ source/helpers/Time.cpp
+ source/helpers/Time.h
+ source/manager/DASHManager.cpp
+ source/manager/DASHManager.h
+ source/metrics/HTTPTransaction.cpp
+ source/metrics/HTTPTransaction.h
+ source/metrics/TCPConnection.cpp
+ source/metrics/TCPConnection.h
+ source/metrics/ThroughputMeasurement.cpp
+ source/metrics/ThroughputMeasurement.h
+ source/mpd/AbstractMPDElement.cpp
+ source/mpd/AbstractMPDElement.h
+ source/mpd/AdaptationSet.cpp
+ source/mpd/AdaptationSet.h
+ source/mpd/BaseUrl.cpp
+ source/mpd/BaseUrl.h
+ source/mpd/ContentComponent.cpp
+ source/mpd/ContentComponent.h
+ source/mpd/Descriptor.cpp
+ source/mpd/Descriptor.h
+ source/mpd/Metrics.cpp
+ source/mpd/Metrics.h
+ source/mpd/MPD.cpp
+ source/mpd/MPD.h
+ source/mpd/MultipleSegmentBase.cpp
+ source/mpd/MultipleSegmentBase.h
+ source/mpd/Period.cpp
+ source/mpd/Period.h
+ source/mpd/ProgramInformation.cpp
+ source/mpd/ProgramInformation.h
+ source/mpd/Range.cpp
+ source/mpd/Range.h
+ source/mpd/Representation.cpp
+ source/mpd/Representation.h
+ source/mpd/RepresentationBase.cpp
+ source/mpd/RepresentationBase.h
+ source/mpd/Segment.cpp
+ source/mpd/Segment.h
+ source/mpd/SegmentBase.cpp
+ source/mpd/SegmentBase.h
+ source/mpd/SegmentList.cpp
+ source/mpd/SegmentList.h
+ source/mpd/SegmentTemplate.cpp
+ source/mpd/SegmentTemplate.h
+ source/mpd/SegmentTimeline.cpp
+ source/mpd/SegmentTimeline.h
+ source/mpd/SegmentURL.cpp
+ source/mpd/SegmentURL.h
+ source/mpd/SubRepresentation.cpp
+ source/mpd/SubRepresentation.h
+ source/mpd/Subset.cpp
+ source/mpd/Subset.h
+ source/mpd/Timeline.cpp
+ source/mpd/Timeline.h
+ source/mpd/URLType.cpp
+ source/mpd/URLType.h
+ source/network/AbstractChunk.cpp
+ source/network/AbstractChunk.h
+ source/network/DownloadStateManager.cpp
+ source/network/DownloadStateManager.h
+ source/portable/MultiThreading.cpp
+ source/portable/MultiThreading.h
+ source/portable/Networking.h
+ source/xml/DOMHelper.cpp
+ source/xml/DOMHelper.h
+ source/xml/DOMParser.cpp
+ source/xml/DOMParser.h
+ source/xml/Node.cpp
+ source/xml/Node.h
+ source/dllmain.cpp
+ source/libdash.cpp
+ source/targetver.h)
+
+find_package(LibXml2 REQUIRED)
+find_package(ZLIB REQUIRED)
+find_package(CURL REQUIRED)
+include_directories(${LIBXML2_INCLUDE_DIR})
+include_directories(${WLIB_INCLUDE_DIRS})
+include_directories(${CURL_INCLUDE_DIRS})
+include_directories(include)
+
+add_library(dash SHARED ${SOURCE_FILES})
+set_target_properties(dash PROPERTIES LINKER_LANGUAGE CXX)
+target_link_libraries(dash ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES})
+message("libxml ${LIBXML2_LIBRARIES} ${LIBXML2_INCLUDE_DIR}")
+install(TARGETS dash DESTINATION ${CMAKE_INSTALL_PREFIX}/lib PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ)
+install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/libdash)
+
diff --git a/libdash/include/IAdaptationSet.h b/libdash/include/IAdaptationSet.h
new file mode 100644
index 00000000..eff9c7ec
--- /dev/null
+++ b/libdash/include/IAdaptationSet.h
@@ -0,0 +1,367 @@
+/**
+ * @class dash::mpd::IAdaptationSet
+ * @brief This interface is needed for accessing the attributes and elements of the <b><tt>AdaptationSet</tt></b> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.3.2, table 5
+ * @details Each Period consists of one or more Adaptation Sets. An Adaptation Set is described by an <b><tt>AdaptationSet</tt></b> element.
+ * <b><tt>AdaptationSet</tt></b> elements are contained in a <b><tt>Period</tt></b> element.\n\n
+ * An Adaptation Set contains alternate Representations, i.e. only one Representation within an Adaptation Set is expected to be presented at a time.
+ * All Representations contained in one Adaptation Set represent the same media content components and therefore contain media streams that are considered to be perceptually equivalent.\n\n
+ * Representations are arranged into Adaptation Sets according to the media content component properties of the media content components present in the Representations, namely
+ * <ul>
+ * <li>the language as described by the \c \@lang attribute,
+ * <li>the media component type described by the \c \@contentType attribute,
+ * <li>the picture aspect ratio as described by the \c \@par attribute,
+ * <li>the role property as described by the <b><tt>Role</tt></b> elements,
+ * <li>the accessibility property as described by the <b><tt>Accessibility</tt></b> elements,
+ * <li>the viewpoint property as described by the <b><tt>Viewpoint</tt></b> elements,
+ * <li>the rating property as described by the <b><tt>Rating</tt></b> elements.
+ * </ul>
+ * Representations shall appear in the same Adaptation Set if and only if they have identical values for all of these media content component properties for each media content component.\n\n
+ * The values for the elements <b><tt>Role</tt></b>, <b><tt>Accessibility</tt></b>, <b><tt>Viewpoint</tt></b> and <b><tt>Rating</tt></b> are generally not provided
+ * within the scope of this part of ISO/IEC 23009. However, a number of simple schemes are defined in section 5.8.5. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.\n\n
+ * If there exist multiple media content components then the properties of each media content component shall be described by a separate ContentComponent element as defined in 5.5.4.
+ * The ContentComponent element shares common elements and attributes with the <b><tt>AdaptationSet</tt></b> element. Default values, or values applicable to all media content components,
+ * may be provided directly in the <b><tt>AdaptationSet</tt></b> element. Attributes present in the <b><tt>AdaptationSet</tt></b> shall not be repeated in the ContentComponent element.\n\n
+ * The <b><tt>AdaptationSet</tt></b> element may contain default values for elements and attributes associated to the contained Representations.
+ * The list of possible present elements and attributes that are common to <b><tt>AdaptationSet</tt></b> and <b><tt>Representation</tt></b> (and also <b><tt>SubRepresentation</tt></b>)
+ * are collected in 5.3.7. Any of the common attributes shall only be present either in the <b><tt>AdaptationSet</tt></b> element or in the <b><tt>Representation</tt></b> element,
+ * but not in both.\n\n
+ * The <b><tt>AdaptationSet</tt></b> element also supports the description of ranges for the \c \@bandwidth, \c \@width, \c \@height and \c \@frameRate attributes
+ * associated to the contained Representations, which provide a summary of all values for all the Representations within this Adaptation Set.
+ * The Representations contained within an Adaptation Set shall not contain values outside the ranges documented for that Adaptation Set. \n\n
+ * Adaptation Sets may be further arranged into groups using the \c \@group attribute. The semantics of this grouping is that the media content within one Period is represented by:
+ * <ol>
+ * <li>either one Representation from group 0, if present,
+ * <li>or the combination of at most one Representation from each non-zero group.
+ * </ol>
+ * If the <tt><b>AdaptationSet</b>\@group</tt> attribute is not present then all Representations in this Adaptation Set are assigned to a non-zero group specific to this Adaptation Set.
+ * @see dash::mpd::IDescriptor dash::mpd::IContentComponent dash::mpd::IBaseUrl dash::mpd::ISegmentBase dash::mpd::ISegmentList dash::mpd::ISegmentTemplate dash::mpd::IRepresentation
+ * dash::mpd::IRepresentationBase
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IADAPTATIONSET_H_
+#define IADAPTATIONSET_H_
+
+#include "config.h"
+
+#include "IDescriptor.h"
+#include "IContentComponent.h"
+#include "IBaseUrl.h"
+#include "ISegmentBase.h"
+#include "ISegmentList.h"
+#include "ISegmentTemplate.h"
+#include "IRepresentation.h"
+#include "IRepresentationBase.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IAdaptationSet : public virtual IRepresentationBase
+ {
+ public:
+ virtual ~IAdaptationSet(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specify information about accessibility scheme.\n
+ * For more details refer to sections 5.8.1 and 5.8.4.3. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetAccessibility () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specify information on role annotation scheme.
+ * For more details refer to sections 5.8.1 and 5.8.4.2. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetRole () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specify information on rating scheme.\n
+ * For more details refer to sections 5.8.1 and 5.8.4.4. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetRating () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specify information on viewpoint annotation scheme.\n
+ * For more details refer to sections 5.8.1 and 5.8.4.5. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetViewpoint () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IContentComponent objects that specifies the properties
+ * of one media content component contained in this Adaptation Set.\n
+ * For more details refer to section 5.3.4. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IContentComponent objects
+ */
+ virtual const std::vector<IContentComponent *>& GetContentComponent () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IBaseUrl objects that specify base URLs that can be used for reference resolution and alternative URL selection.\n
+ * For more details refer to the description in section 5.6. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IBaseUrl objects
+ */
+ virtual const std::vector<IBaseUrl *>& GetBaseURLs () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentBase object that specifies default Segment Base information.\n
+ * Information in this element is overridden by information in the <tt><b>Representation.SegmentBase</b></tt>, if present.\n
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentBase object
+ */
+ virtual ISegmentBase* GetSegmentBase () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentList object that specifies default Segment List information.\n
+ * Information in this element is overridden by information in the <tt><b>Representation.SegmentList</b></tt>, if present.\n
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentList object
+ */
+ virtual ISegmentList* GetSegmentList () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentTemplate object that specifies default Segment Template information.\n
+ * Information in this element is overridden by information in the <tt><b>Representation.SegmentTemplate</b></tt>, if present.\n
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentTemplate object
+ */
+ virtual ISegmentTemplate* GetSegmentTemplate () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IRepresentation objects that specifies a Representation.\n
+ * At least one Representation element shall be present in each Adaptation Set. The actual element may however be part of a remote element.\n
+ * For more details refer to section 5.3.5. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IRepresentation objects
+ */
+ virtual const std::vector<IRepresentation *>& GetRepresentation () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies a reference to external <tt><b>AdaptationSet</b></tt> element.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkHref () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the processing instructions, which can be either \c \"onLoad\" or \c \"onRequest\".
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkActuate () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies an unique identifier for this Adaptation Set in the scope of the Period.
+ * The attribute shall be unique in the scope of the containing Period. \n\n
+ * The attribute shall not be present in a remote element.\n\n
+ * If not present, no identifier for the Adaptation Set is specified.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetId () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies an identifier for the group that is unique in the scope of the containing Period.\n
+ * For details refer to section 5.3.3.1. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetGroup () const = 0;
+
+ /**
+ * Returns a reference to a string that declares the language code for this Adaptation Set. The syntax and semantics according to IETF RFC 5646 shall be used.\n
+ * If not present, the language code may be defined for each media component or it may be unknown.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetLang () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the media content component type for this Adaptation Set.
+ * A value of the top-level Content-type 'type' value as defined in RFC1521, Clause 4 shall be taken.\n
+ * If not present, the media content component type may be defined for each media component or it may be unknown.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetContentType () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the picture aspect ratio of the video media component type,
+ * in the form of a string consisting of two integers separated by ':', e.g., \c \"16:9\". When this attribute is present,
+ * and the attributes \c \@width and \c \@height for the set of Representations are also present, the picture aspect ratio as specified by this attribute shall be the same
+ * as indicated by the values of \c \@width, \c \@height, and \c \@sar, i.e. it shall express the same ratio as (\c \@width * \em sarx): (\c \@height * \em sary),
+ * with \em sarx the first number in \c \@sar and \em sary the second number.\n
+ * If not present, the picture aspect ratio may be defined for each media component or it may be unknown.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetPar () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies the minimum \c \@bandwidth value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@bandwidth attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMinBandwidth () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies the maximum \c \@bandwidth value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@bandwidth attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMaxBandwidth () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies the minimum \c \@width value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@width attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMinWidth () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies the maximum \c \@width value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@width attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMaxWidth () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies specifies the minimum \c \@height value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@height attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMinHeight () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies specifies the maximum \c \@height value in all Representations in this Adaptation Set.
+ * This value has the same units as the \c \@height attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetMaxHeight () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the minimum \c \@framerate value in all Representations in this Adaptation Set.
+ * This value is encoded in the same format as the \c \@frameRate attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMinFramerate () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the maximum \c \@framerate value in all Representations in this Adaptation Set.
+ * This value is encoded in the same format as the \c \@frameRate attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMaxFramerate () const = 0;
+
+ /**
+ * Because of the fact that the type of the attribute \em segmentAlignment is a union of \c xs:unsignedInt and \c xs:boolean this method is needed to determine
+ * whether its value is of type bool or integer.\n
+ * If and only if \c 'true' is returned, an invocation of HasSegmentAlignment() is neccessary to retrieve the bool value.\n
+ * If and only if \c 'false' is returned, an invocation of GetSegmentAlignment() is neccessary to retrieve the integer value.
+ * @return a bool value
+ */
+ virtual bool SegmentAlignmentIsBoolValue () const = 0;
+
+ /**
+ * If the return value of SegmentAlignmentIsBoolValue() equals \c 'true' the bool value returned by this method
+ * specifies whether Segment Alignment is used or not. This is only valid for Adaptation Sets containing Representations with multiple media content components.
+ * If \c 'true' is returned, this specifies that for any two Representations,
+ * X and Y, within the same Adaptation Set, the <em>m</em>-th Segment of X and the <em>n</em>-th Segment of Y
+ * are non-overlapping (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>) whenever \em m is not equal to \em n.
+ * @return a bool value
+ */
+ virtual bool HasSegmentAlignment () const = 0;
+
+ /**
+ * If the return value of SegmentAlignmentIsBoolValue() equals \c 'false' this specifies that for any two Representations,
+ * X and Y, within the same Adaptation Set, the <em>m</em>-th Segment of X and the <em>n</em>-th Segment of Y
+ * are non-overlapping (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>) whenever \em m is not equal to \em n.\n\n
+ * For Adaptation Sets containing Representations with a single media content component, when two <b><tt>AdaptationSet</tt></b> elements within a Period share the same
+ * integer value for this attribute - <b>which is the return value of this method</b>, then for any two Representations, X and Y, within the union of the two Adaptation Sets,
+ * the <em>m</em>-th Segment of X and the <em>n</em>-th Segment of Y are non-overlapping (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>)
+ * whenever \em m is not equal to \em n.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetSegmentAligment () const = 0;
+
+ /**
+ * Because of the fact that the type of the attribute \em subsegmentAlignment is a union of \c xs:unsignedInt and \c xs:boolean this method is needed to determine
+ * whether its value is of type bool or integer.\n
+ * If and only if \c 'true' is returned, an invocation of HasSubsegmentAlignment() is neccessary to retrieve the bool value.\n
+ * If and only if \c 'false' is returned, an invocation of GetSubsegmentAlignment() is neccessary to retrieve the integer value.
+ * @return a bool value
+ */
+ virtual bool SubsegmentAlignmentIsBoolValue () const = 0;
+
+ /**
+ * If and only if the return value of SubsegmentAlignmentIsBoolValue() equals \c 'true' the bool value returned by this method
+ * specifies whether Subsegment Alignment is used or not.
+ * If \c 'true' is returned, the following conditions shall be satisfied:
+ * <ul>
+ * <li>Each Media Segment shall be indexed (i.e. either it contains a Segment index or there is an Index Segment providing an index for the Media Segment)
+ * <li>For any two Representations, X and Y, within the same Adaptation Set, the <em>m</em>-th Subsegment of X and the <em>n</em>-th Subsegment of Y are
+ * non-overlapping (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>) whenever \em m is not equal to \em n.
+ * </ul>
+ * @return a bool value
+ */
+ virtual bool HasSubsegmentAlignment () const = 0;
+
+ /**
+ * If the return value of SubsegmentAlignmentIsBoolValue() equals \c 'false' the following conditions shall be satisfied:
+ * <ul>
+ * <li>Each Media Segment shall be indexed (i.e. either it contains a Segment index or there is an Index Segment providing an index for the Media Segment)
+ * <li>For any two Representations, X and Y, within the same Adaptation Set, the <em>m</em>-th Subsegment of X and the <em>n</em>-th Subsegment of Y are
+ * non-overlapping (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>) whenever \em m is not equal to \em n.
+ * <li>For Adaptation Sets containing Representations with a single media content component, when two <tt><b>AdaptationSet</b></tt> elements within a Period share
+ * the same integer value for this attribute - <b>which is the return value of this method</b>, then for any two Representations, X and Y,
+ * within the union of the two Adaptation Sets, the <em>m</em>-th Subsegment of X and the <em>n</em>-th Subsegment of Y are non-overlapping
+ * (as defined in section 4.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>) whenever m is not equal to n.
+ * </ul>
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetSubsegmentAlignment () const = 0;
+
+ /**
+ * Returns a unsigned integer that when greater than 0, specifies that each Subsegment with \c SAP_type greater than 0 starts with a SAP of type
+ * less than or equal to the value of \c \@subsegmentStartsWithSAP. A Subsegment starts with SAP when the Subsegment contains a SAP,
+ * and for the first SAP, I<sub>SAU</sub> is the index of the first access unit that follows I<sub>SAP</sub> , and I<sub>SAP</sub> is contained in the Subsegment.\n
+ * The semantics of \c \@subsegmentStartsWithSAP equal to 0 are unspecified.
+ * @return an unsigned integer
+ */
+ virtual uint8_t GetSubsegmentStartsWithSAP () const = 0;
+
+ /**
+ * Returns a bool value that when true, the following applies:
+ * <ul>
+ * <li>All Representations in the Adaptation Set shall have the same number \em M of Media Segments;
+ * <li>Let \em R<sub>1</sub> , \em R<sub>2</sub> , ..., \em R<sub>N</sub> be all the Representations within the Adaptation Set.
+ * <li>Let
+ * <ul>
+ * <li><em>S<sub>i,j</sub></em> , for \em j > 0, be the \em j<sup>th</sup> Media Segment in the \em i<sup>th</sup> Representation (i.e., \em R<sub>i</sub> )
+ * <li>if present, let <em>S<sub>i,0</sub></em> be the Initialization Segment in the \em i<sup>th</sup> Representation, and
+ * <li>if present, let \em B<sub>i</sub> be the Bitstream Switching Segment in the \em i<sup>th</sup> Representation.
+ * </ul>
+ * <li>The sequence of
+ * <ul>
+ * <li>any Initialization Segment, if present, in the Adaptation Set, with,
+ * <li> if Bitstream Switching Segments are present, \n
+ * <em> B<sub>i(1)</sub>, S<sub>i(1),1</sub>, B<sub>i(2)</sub>, S<sub>i(2),2</sub>, ...,
+ * B<sub>i(k)</sub>, S<sub>i(k),k</sub>, ..., B<sub>i(M)</sub>, S<sub>i(M),M</sub> </em>
+ * <li>else \n
+ * S<sub>i(1),1</sub>, S<sub>i(2),2</sub>, ..., S<sub>i(k),k</sub>, ..., S<sub>i(M),M</sub>,
+ * </ul>
+ * wherein any \em i(k) for all \em k values in the range of 1 to \em M, respectively, is an integer value in the range of 1 to \em N,
+ * results in a \"conforming Segment sequence\" as defined in section 4.5.3 of <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * with the media format as specified in the \c \@mimeType attribute.
+ * </ul>
+ * More detailed rules may be defined for specific media formats.
+ * @return a bool value
+ */
+ virtual bool GetBitstreamSwitching () const = 0;
+ };
+ }
+}
+
+#endif /* IADAPTATIONSET_H_ */ \ No newline at end of file
diff --git a/libdash/include/IBaseUrl.h b/libdash/include/IBaseUrl.h
new file mode 100644
index 00000000..206ad14b
--- /dev/null
+++ b/libdash/include/IBaseUrl.h
@@ -0,0 +1,69 @@
+/**
+ * @class dash::mpd::IBaseUrl
+ * @brief This interface is needed for accessing the attributes and the content of <tt><b>BaseURL</b></tt> elements
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.6
+ * @details The BaseURL element may be used to specify one or more common locations for Segments and other resources.\n
+ * A URL that can be used as Base URL. The content of this element is a URI string as described in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.6.4
+ * @see dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IBASEURL_H_
+#define IBASEURL_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "ISegment.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IBaseUrl : public virtual IMPDElement
+ {
+ public:
+ virtual ~IBaseUrl(){}
+
+ /**
+ * Returns the reference to a string representing a BaseURL
+ * @return a reference to a string
+ */
+ virtual const std::string& GetUrl () const = 0;
+
+ /**
+ * Returns the reference to a string that specifies a relationship between Base URLs such that \c <b>BaseURL</b> elements with the same
+ * \c \@serviceLocation value are likely to have their URLs resolve to services at a common network location, for example a common Content Delivery Network
+ * @return a reference to a string
+ */
+ virtual const std::string& GetServiceLocation () const = 0;
+
+ /**
+ * Returns the reference to a string that represents a byte range. \n
+ * If present specifies HTTP partial GET requests may alternatively be issued by adding the byte range into a
+ * regular HTTP-URL based on the value of this attribute and the construction rules in Annex E.2. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.\n
+ * If not present, HTTP partial GET requests may not be converted into regular GET requests. \n
+ * \b NOTE: Such alternative requests are expected to not be used unless the DASH application requires this. For more details refer to Annex E.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetByteRange () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object which represents a media segment that can be downloaded. Should be used for single base urls inside
+ * a representation.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the media segment
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const = 0;
+ };
+ }
+}
+
+#endif /* IBASEURL_H_ */ \ No newline at end of file
diff --git a/libdash/include/IChunk.h b/libdash/include/IChunk.h
new file mode 100644
index 00000000..76b3314b
--- /dev/null
+++ b/libdash/include/IChunk.h
@@ -0,0 +1,88 @@
+/**
+ * @class dash::network::IChunk
+ * @brief This interface is needed for accessing the information belonging to a dash::network::IChunk object
+ * @details Provides specific information of a chunk, e.g., URI, Hostname, Port, Path and optional Range that
+ * that are needed to download this chunk.
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ICHUNK_H_
+#define ICHUNK_H_
+
+#include "config.h"
+#include "IHTTPTransaction.h"
+
+namespace dash
+{
+ namespace network
+ {
+ class IChunk
+ {
+ public:
+ virtual ~IChunk(){}
+
+ /**
+ * Returns a reference to a string that specifies the absolute URI to this chunk
+ * @return a reference to a string
+ */
+ virtual std::string& AbsoluteURI () = 0;
+
+ /**
+ * Returns a reference to a string that specifies the host of this chunk
+ * @return a reference to a string
+ */
+ virtual std::string& Host () = 0;
+
+ /**
+ * Returns an unsigned integer representing the port belonging to this chunk
+ * @return an unsigned integer
+ */
+ virtual size_t Port () = 0;
+
+ /**
+ * Returns a reference to a string that specifies the path to this chunk
+ * @return a reference to a string
+ */
+ virtual std::string& Path () = 0;
+
+ /**
+ * Returns a reference to a string that specifies the byte range belonging to this chunk
+ * @return a reference to a string
+ */
+ virtual std::string& Range () = 0;
+
+ /**
+ * Returns an unsigned integer representing the start byte of the byte range that belongs to this chunk
+ * @return an unsigned integer
+ */
+ virtual size_t StartByte () = 0;
+
+ /**
+ * Returns an unsigned integer representing the end byte of the byte range that belongs to this chunk
+ * @return an unsigned integer
+ */
+ virtual size_t EndByte () = 0;
+
+ /**
+ * Returns a bool value that represents whether this chunk has a byte range or not
+ * @return a bool value
+ */
+ virtual bool HasByteRange () = 0;
+
+ /**
+ * Returns the type of a <b>HTTP Request/Response Transaction</b> in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.3, Table D.2
+ * @return a dash::metrics::HTTPTransactionType
+ */
+ virtual dash::metrics::HTTPTransactionType GetType () = 0;
+ };
+ }
+}
+
+#endif /* ICHUNK_H_ */ \ No newline at end of file
diff --git a/libdash/include/IConnection.h b/libdash/include/IConnection.h
new file mode 100644
index 00000000..4150d562
--- /dev/null
+++ b/libdash/include/IConnection.h
@@ -0,0 +1,69 @@
+/**
+ * @class dash::network::IConnection
+ * @brief The connection interface can be used to enable the download of segments through external connections.
+ * @details This interface enables the extension of libdash to download segment through, e.g., SPDY, CCN etc.
+ * @see dash::network::IChunk
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ICONNECTION_H_
+#define ICONNECTION_H_
+
+#include "config.h"
+
+#include "IChunk.h"
+#include "IDASHMetrics.h"
+
+namespace dash
+{
+ namespace network
+ {
+ class IConnection : public virtual dash::metrics::IDASHMetrics
+ {
+ public:
+ virtual ~IConnection(){}
+
+ /**
+ * This function should read a block of bytes from the specified chunk.
+ * @param data pointer to a block of memory
+ * @param len size of the memory block that can be used by the method
+ * @param chunk the dash::network::IChunk object from which data should be read
+ * @return amount of data that has been read
+ */
+ virtual int Read (uint8_t *data, size_t len, IChunk *chunk) = 0;
+
+ /**
+ * This function should peek a block of bytes from the specified chunk.
+ * @param data pointer to a block of memory
+ * @param len size of the memory block that can be used by the method
+ * @param chunk the dash::network::IChunk object from which data should be peeked
+ * @return amount of data that has been peeked
+ */
+ virtual int Peek (uint8_t *data, size_t len, IChunk *chunk) = 0;
+
+ /**
+ * This function should get the average speed of download for the specified chunk.
+ * It should be called after the whole chunk has been downloaded.
+ * @return average speed of download in bps.
+ */
+ virtual double GetAverageDownloadingSpeed () = 0;
+
+ /**
+ * This function should get the time taken for the download of the specified chunk.
+ * It should be called after the whole chunk has been downloaded.
+ * @return average time of download in seconds.
+ */
+ virtual double GetDownloadingTime () = 0;
+
+ };
+ }
+}
+
+#endif /* ICONNECTION_H_ */
diff --git a/libdash/include/IContentComponent.h b/libdash/include/IContentComponent.h
new file mode 100644
index 00000000..9f3be97f
--- /dev/null
+++ b/libdash/include/IContentComponent.h
@@ -0,0 +1,83 @@
+/**
+ * @class dash::mpd::IContentComponent
+ * @brief This interface is needed for accessing the attributes and elements of the <b><tt>ContentComponent</tt></b> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.4.2, table 6
+ * @details Each Adaptation Set contains one or more media content components. The properties of each media content
+ * component are described by a <b><tt>ContentComponent</tt></b> element or may be described directly on the <b><tt>AdaptationSet</tt></b> element
+ * if only one media content component is present in the Adaptation Set. <b><tt>ContentComponent</tt></b> elements are contained in an <b><tt>AdaptationSet</tt></b> element.
+ * @see dash::mpd::IMPDElement dash::mpd::IDescriptor dash::mpd::IAdaptationSet
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ICONTENTCOMPONENT_H_
+#define ICONTENTCOMPONENT_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IDescriptor.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IContentComponent : public virtual IMPDElement
+ {
+ public:
+ virtual ~IContentComponent(){}
+
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetAccessibility()
+ */
+ virtual const std::vector<IDescriptor *>& GetAccessibility () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetRole()
+ */
+ virtual const std::vector<IDescriptor *>& GetRole () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetRating()
+ */
+ virtual const std::vector<IDescriptor *>& GetRating () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetViewpoint()
+ */
+ virtual const std::vector<IDescriptor *>& GetViewpoint () const = 0;
+
+ /**
+ * Returns an unsigned integer that specifies an identifier for this media component.
+ * The attribute shall be unique in the scope of the containing Adaptation Set.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetId () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetLang()
+ */
+ virtual const std::string& GetLang () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetContentType()
+ */
+ virtual const std::string& GetContentType () const = 0;
+
+ /**
+ * @copydoc dash::mpd::IAdaptationSet::GetPar()
+ */
+ virtual const std::string& GetPar () const = 0;
+
+ };
+ }
+}
+
+#endif /* ICONTENTCOMPONENT_H_ */ \ No newline at end of file
diff --git a/libdash/include/IDASHManager.h b/libdash/include/IDASHManager.h
new file mode 100644
index 00000000..5e4688fb
--- /dev/null
+++ b/libdash/include/IDASHManager.h
@@ -0,0 +1,45 @@
+/**
+ * @class dash::IDASHManager
+ * @brief This interface is needed for generating an IMPD object from the information found in a MPD file
+ * @details By invoking the method Open(char *path) all the information found in the MPD file specified by \em path is mapped to corresponding IMPD objects.
+ * @see dash::mpd::IMPD
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDASHMANAGER_H_
+#define IDASHMANAGER_H_
+
+#include "config.h"
+
+#include "IMPD.h"
+#include "IConnection.h"
+
+namespace dash
+{
+ class IDASHManager
+ {
+ public:
+ virtual ~IDASHManager(){}
+
+ /**
+ * Returns a pointer to dash::mpd::IMPD object representing the the information found in the MPD file specified by \em path
+ * @param path A URI to a MPD file
+ * @return a pointer to an dash::mpd::IMPD object
+ */
+ virtual mpd::IMPD* Open (char *path, std::string mURL = "") = 0;
+
+ /**
+ * Frees allocated memory and deletes the DashManager
+ */
+ virtual void Delete () = 0;
+ };
+}
+
+#endif /* IDASHMANAGER_H_ */
diff --git a/libdash/include/IDASHMetrics.h b/libdash/include/IDASHMetrics.h
new file mode 100644
index 00000000..748af7a5
--- /dev/null
+++ b/libdash/include/IDASHMetrics.h
@@ -0,0 +1,48 @@
+/**
+ * @class dash::metrics::IDASHMetrics
+ * @brief The connection interface can be used to retrieve DASH Metrics.
+ * @details The <em>TCP Connection</em> list and <em>HTTP Request/Response Transactions</em> can be retrieved. \n
+ * This basically corresponds to the information neeed for <tt>Observation point 1</tt> as defined in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.3.2.
+ * @see dash::metrics::ITCPConnection dash::metrics::IHTTPConnection
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDASHMETRICS_H_
+#define IDASHMETRICS_H_
+
+#include "config.h"
+#include "IHTTPTransaction.h"
+#include "ITCPConnection.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class IDASHMetrics
+ {
+ public:
+ virtual ~IDASHMetrics(){}
+
+ /**
+ * This function returns a list of DASH Metrics as defined in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.2.
+ * @return a list of dash::metrics::ITCPConnection Metrics Objects
+ */
+ virtual const std::vector<ITCPConnection *>& GetTCPConnectionList () const = 0;
+
+ /**
+ * This function returns a list of DASH Metrics as defined in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.3.
+ * @return a list of dash::metrics::IHTTPConnection Metrics Objets
+ */
+ virtual const std::vector<IHTTPTransaction *>& GetHTTPTransactionList () const = 0;
+ };
+ }
+}
+
+#endif /* IDASHMETRICS_H_ */
diff --git a/libdash/include/IDescriptor.h b/libdash/include/IDescriptor.h
new file mode 100644
index 00000000..3983e41e
--- /dev/null
+++ b/libdash/include/IDescriptor.h
@@ -0,0 +1,68 @@
+/**
+ * @class dash::mpd::IDescriptor
+ * @brief This interface is needed for accessing the attributes of the <tt><b>Descriptor</b></tt> type as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.8.2, table 21
+ * @details The MPD may contain descriptors that make use of a common syntax as defined in this subclause.
+ * The elements of type \c DescriptorType provide a flexible mechanism for DASH content authors to annotate
+ * and extend the \c <b>MPD</b>, \c <b>Period</b>, \c <b>AdaptationSet</b> and \c <b>Representation</b> elements.\n
+ * The descriptor elements are all structured in the same way, namely they contain a \c \@schemeIdUri attribute that provides a URI to identify the scheme and
+ * an optional attribute \c \@value. The semantics of the element are specific to the scheme employed. The URI identifying the scheme may be a URN or a URL.\n
+ * In <em>ISO/IEC 23009-1, Part 1, 2012</em>, specific elements for descriptors are defined in section 5.8.4.\n
+ * The MPD does not provide any specific information on how to use these elements. It is up to the application that employs DASH formats
+ * to instantiate the description elements with appropriate scheme information. However, this part of ISO/IEC 23009 defines some specific schemes in 5.8.5.\n
+ * DASH applications that use one of these elements must first define a Scheme Identifier in the form of a URI and must then define the value space
+ * for the element when that Scheme Identifier is used. The Scheme Identifier appears in the \c \@schemeIdUri attribute.
+ * In the case that a simple set of enumerated values are required, a text string may be defined for each value and this string must be included
+ * in the \c \@value attribute. If structured data is required then any extension element or attribute may be defined in a separate namespace.\n
+ * Two elements of type DescriptorType are equivalent, if the element name, the value of the \c \@schemeIdUri and the value of the \c \@value attribute are equivalent.
+ * If the \c \@schemeIdUri is a URN, then equivalence shall refer to lexical equivalence as defined in clause 5 of RFC 2141. If the \c \@schemeIdUri is a URL,
+ * then equivalence shall refer to equality on a character-for-character basis as defined in clause 6.2.1 of RFC3986.
+ * If the \c \@value attribute is not present, equivalence is determined by the equivalence for \c \@schemeIdUri only.
+ * Attributes and element in extension namespaces are not used for determining equivalence.
+ * @see dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDESCRIPTOR_H_
+#define IDESCRIPTOR_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IDescriptor : public virtual IMPDElement
+ {
+ public:
+ virtual ~IDescriptor(){}
+
+ /**
+ * Returns a reference to a string that specifies a URI to identify the scheme. \n
+ * The semantics of this element are specific to the scheme specified by this attribute.
+ * The \c \@schemeIdUri may be a URN or URL. When a URL is used, it should also contain a month-date in the form
+ * mmyyyy; the assignment of the URL must have been authorized by the owner of the domain name in that URL on
+ * or very close to that date, to avoid problems when domain names change ownership.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetSchemeIdUri () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the value for the descriptor element. \n
+ * The value space and semantics must be defined by the owners of the scheme identified in the \c \@schemeIdUri attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetValue () const = 0;
+ };
+ }
+}
+
+#endif /* IDESCRIPTOR_H_ */ \ No newline at end of file
diff --git a/libdash/include/IDownloadObserver.h b/libdash/include/IDownloadObserver.h
new file mode 100644
index 00000000..b78198d4
--- /dev/null
+++ b/libdash/include/IDownloadObserver.h
@@ -0,0 +1,58 @@
+/**
+ * @class dash::network::IDownloadObserver
+ * @brief This interface is needed for informing the application of the state of the download process.
+ * @details Informs the application about the download rate and the state of the download.
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDOWNLOADOBSERVER_H_
+#define IDOWNLOADOBSERVER_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace network
+ {
+ enum DownloadState
+ {
+ NOT_STARTED = 0,
+ IN_PROGRESS = 1,
+ REQUEST_ABORT = 2,
+ ABORTED = 3,
+ COMPLETED = 4
+ };
+ class IDownloadObserver
+ {
+ public:
+ virtual ~IDownloadObserver(){}
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the download rate has changed.
+ * @param bytesDownloaded the number of downloaded bytes
+ */
+ virtual void OnDownloadRateChanged (uint64_t bytesDownloaded) = 0;
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the downloading time has changed.
+ * @param downloadingTime the time taken for the downloading of this segment in seconds
+ */
+ virtual void OnDownloadTimeChanged (double downloadingTime) = 0;
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the download state has changed.
+ * @param state the download state
+ */
+ virtual void OnDownloadStateChanged (DownloadState state) = 0;
+ };
+ }
+}
+
+#endif /* IDOWNLOADOBSERVER_H_ */
diff --git a/libdash/include/IDownloadObserver.h.save b/libdash/include/IDownloadObserver.h.save
new file mode 100644
index 00000000..0d67c852
--- /dev/null
+++ b/libdash/include/IDownloadObserver.h.save
@@ -0,0 +1,58 @@
+/**
+ * @class dash::network::IDownloadObserver
+ * @brief This interface is needed for informing the application of the state of the download process.
+ * @details Informs the application about the download rate and the state of the download.
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDOWNLOADOBSERVER_H_
+#define IDOWNLOADOBSERVER_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace network
+ {
+ enum DownloadState
+ {
+ NOT_STARTED = 0,
+ IN_PROGRESS = 1,
+ REQUEST_ABORT = 2,
+ ABORTED = 3,
+ COMPLETED = 4
+ };
+ class IDownloadObserver
+ {
+ public:
+ virtual ~IDownloadObserver(){}
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the download rate has changed.
+ * @param bytesDownloaded the number of downloaded bytes
+ */
+ virtual void OnDownloadRateChanged (uint64_t bytesDownloaded) = 0;
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the download rate has changed.
+ * @param bytesDownloaded the number of downloaded bytes
+ */
+ virtual void OnDownloadTimeChanged (double ) = 0;
+
+ /**
+ * Informs the dash::network::IDownloadObserver object that the download state has changed.
+ * @param state the download state
+ */
+ virtual void OnDownloadStateChanged (DownloadState state) = 0;
+ };
+ }
+}
+
+#endif /* IDOWNLOADOBSERVER_H_ */
diff --git a/libdash/include/IDownloadableChunk.h b/libdash/include/IDownloadableChunk.h
new file mode 100644
index 00000000..d7189cd2
--- /dev/null
+++ b/libdash/include/IDownloadableChunk.h
@@ -0,0 +1,93 @@
+/**
+ * @class dash::network::IDownloadableChunk
+ * @brief This interface is needed for starting and abortinng downloads, reading, peeking and attaching dash::network::IDownloadObservers to this Chunk
+ * @details Enables the download of media segments with the internal libcurl connection or with external connections that can be passed to this interface
+ * @see dash::network::IDownloadObserver dash::network::IConnection dash::network::IChunk
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IDOWNLOADABLECHUNK_H_
+#define IDOWNLOADABLECHUNK_H_
+
+#include "config.h"
+
+#include "IDownloadObserver.h"
+#include "IConnection.h"
+#include "IChunk.h"
+#include "IDASHMetrics.h"
+
+namespace dash
+{
+ namespace network
+ {
+ class IDownloadableChunk : public IChunk, public dash::metrics::IDASHMetrics
+ {
+ public:
+ virtual ~IDownloadableChunk(){}
+
+ /**
+ * Starts the download of this chunk and returns a bool value whether the starting of the download was possible or not
+ * @return a bool value
+ */
+ virtual bool StartDownload () = 0;
+
+ /**
+ * Starts the download of this chunk and returns a bool value whether the starting of the download was possible or not
+ * @param connection the dash::network::IConnection that shall be used for downloading
+ * @return a bool value
+ */
+ virtual bool StartDownload (IConnection *connection) = 0;
+
+ /**
+ * Aborts the download of a chunk
+ */
+ virtual void AbortDownload () = 0;
+
+ /**
+ * Reads
+ * @param data pointer to a block of memory
+ * @param len size of the memory block that can be used by the method
+ * @return amount of data that has been read
+ */
+ virtual int Read (uint8_t *data, size_t len) = 0;
+
+ /**
+ * Reads
+ * @param data pointer to a block of memory
+ * @param len size of the memory block that can be used by the method
+ * @return amount of data that has been peeked
+ */
+ virtual int Peek (uint8_t *data, size_t len) = 0;
+
+ /**
+ * Reads
+ * @param data pointer to a block of memory
+ * @param len size of the memory block that can be used by the method
+ * @param offset the offset to start with
+ * @return amount of data that has been peeked
+ */
+ virtual int Peek (uint8_t *data, size_t len, size_t offset) = 0;
+
+ /**
+ * Attaches a dash::network::IDownloadObserver to this Chunk
+ * @param observer a dash::network::IDownloadObserver
+ */
+ virtual void AttachDownloadObserver (IDownloadObserver *observer) = 0;
+
+ /**
+ * Detaches a dash::network::IDownloadObserver from this Chunk
+ * @param observer a dash::network::IDownloadObserver
+ */
+ virtual void DetachDownloadObserver (IDownloadObserver *observer) = 0;
+ };
+ }
+}
+
+#endif /* IDOWNLOADABLECHUNK_H_ */ \ No newline at end of file
diff --git a/libdash/include/IHTTPTransaction.h b/libdash/include/IHTTPTransaction.h
new file mode 100644
index 00000000..756a1550
--- /dev/null
+++ b/libdash/include/IHTTPTransaction.h
@@ -0,0 +1,56 @@
+/**
+ * @class dash::metrics::IHTTPTransaction
+ * @brief This interface is needed for accessing the attributes and the content of a <tt><b>HTTP Request/Response Transaction</b></tt>
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.3
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IHTTPTRANSACTION_H_
+#define IHTTPTRANSACTION_H_
+
+#include "config.h"
+#include "IThroughputMeasurement.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ enum HTTPTransactionType
+ {
+ MPD,
+ XLinkEpansion,
+ InitializationSegment,
+ IndexSegment,
+ MediaSegment,
+ BitstreamSwitchingSegment,
+ Other
+ };
+
+ class IHTTPTransaction
+ {
+ public:
+ virtual ~IHTTPTransaction (){}
+
+ virtual uint32_t TCPId () const = 0;
+ virtual HTTPTransactionType Type () const = 0;
+ virtual const std::string& OriginalUrl () const = 0;
+ virtual const std::string& ActualUrl () const = 0;
+ virtual const std::string& Range () const = 0;
+ virtual const std::string& RequestSentTime () const = 0;
+ virtual const std::string& ResponseReceivedTime () const = 0;
+ virtual uint16_t ResponseCode () const = 0;
+ virtual uint64_t Interval () const = 0;
+ virtual const std::vector<IThroughputMeasurement *>& ThroughputTrace () const = 0;
+ virtual const std::string& HTTPHeader () const = 0;
+ };
+ }
+}
+
+#endif /* IHTTPTRANSACTION_H_ */
diff --git a/libdash/include/IMPD.h b/libdash/include/IMPD.h
new file mode 100644
index 00000000..7e69eecf
--- /dev/null
+++ b/libdash/include/IMPD.h
@@ -0,0 +1,207 @@
+/**
+ * @class dash::mpd::IMPD
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>MPD</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.1.2, table 3
+ * @details A Media Presentation as described in the <tt><b>MPD</b></tt> consists of (all sections refer to <em>ISO/IEC 23009-1, Part 1, 2012</em>)
+ * <ul>
+ * <li>A sequence of one or more Periods as described in section 5.3.2.
+ * <li>Each Period contains one or more Adaptation Sets as described in 5.3.3.
+ * In case an Adaptation Set contains multiple media content components, then each media content component is described individually
+ * as defined in 5.3.4.
+ * <li>Each Adaptation Set contains one or more Representations as described in 5.3.5.
+ * <li>A Representation may contain one or more Sub-Representations as described in 5.3.6.
+ * <li>Adaptation Sets, Representations and Sub-Representations share common attributes and elements that are described in 5.3.7.
+ * <li>Each Period may contain one or more Subsets that restrict combination of Adaptation Sets for presentation. Subsets are described in 5.3.8.
+ * <li>Each Representation consists of one or more Segments described in 6. Segment Information is introduced in 5.3.9.
+ * Segments contain media data and/or metadata to access, decode and present the included media content.
+ * Representations may also include Sub-Representations as defined in 5.3.6 to describe and extract partial information from a Representation.
+ * <li>Each Segment consists of one or more Subsegments. Subsegments are described in 6.2.3.2.
+ * </ul>
+ * @see dash::mpd::IMPDElement dash::mpd::IProgramInformation dash::mpd::IBaseUrl dash::mpd::IPeriod dash::mpd::IMetrics
+ * dash::mpd::IRepresentationBase
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IMPD_H_
+#define IMPD_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IProgramInformation.h"
+#include "IBaseUrl.h"
+#include "IPeriod.h"
+#include "IMetrics.h"
+#include "IDASHMetrics.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IMPD : public virtual IMPDElement, public dash::metrics::IDASHMetrics
+ {
+ public:
+ virtual ~IMPD(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IProgramInformation objects that specify descriptive information about the program.\n
+ * For more details refer to the description in section 5.7. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IProgramInformation objects
+ */
+ virtual const std::vector<IProgramInformation *>& GetProgramInformations () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IBaseUrl objects that specify Base URLs that can be used for reference resolution
+ * and alternative URL selection. \n
+ * For more details refer to the description in section 5.6. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IBaseUrl objects
+ */
+ virtual const std::vector<IBaseUrl *>& GetBaseUrls () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specify locations at which the MPD is available.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetLocations () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IPeriod objects that specify the information of a Period.\n
+ * For more details refer to the description in section 5.3.2. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IPeriod objects
+ */
+ virtual const std::vector<IPeriod *>& GetPeriods () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IMetrics objects that specify the DASH Metrics.\n
+ * For more details see section 5.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IPeriod objects
+ */
+ virtual const std::vector<IMetrics *>& GetMetrics () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies an identifier for the Media Presentation. It is recommended to use an identifier that is unique within
+ * the scope in which the Media Presentation is published. \n
+ * If not specified, no MPD-internal identifier is provided. However, for example the URL to the MPD may be used as an identifier for the Media Presentation.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetId () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies a list of Media Presentation profiles as described in section 8 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.\n
+ * The contents of this attribute shall conform to either the \c pro-simple or \c pro-fancy productions of RFC6381, Section 4.5, without the enclosing \c DQUOTE characters,
+ * i.e. including only the \c unencodedv or \c encodedv elements respectively.
+ * As profile identifier the URI defined for the conforming Media Presentation profiles as described in section 8 shall be used.
+ * @return a reference to a vector of pointers to dash::mpd::IProgramInformation objects
+ */
+ virtual const std::vector<std::string>& GetProfiles () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies whether the Media Presentation Description may be updated (<tt>\@type=\"dynamic\"</tt>) or not (<tt>\@type=\"static\"</tt>).\n
+ * \b NOTE: Static MPDs are typically used for On-Demand services, whereas dynamic MPDs are used for live services.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetType () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies
+ * <ul>
+ * <li>the anchor for the computation of the earliest availability time (in UTC) for any Segment in the Media Presentation if <tt>\@type=\"dynamic\"</tt>.
+ * <li>the Segment availability start time for all Segments referred to in this MPD if <tt>\@type=\"static\"</tt>.
+ * </ul>
+ * If not present, all Segments described in the MPD shall become available at the time the MPD becomes available.\n
+ * For <tt>\@type=\"dynamic\"</tt> this attribute shall be present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetAvailabilityStarttime () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the latest Segment availability end time for any Segment in the Media Presentation. When not present, the value is unknown.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetAvailabilityEndtime () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the duration of the entire Media Presentation. If the attribute is not present, the duration of the Media Presentation is unknown.
+ * In this case the attribute <tt><b>MPD</b>\@minimumUpdatePeriod</tt> shall be present.\n
+ * This attribute shall be present when the attribute <tt><b>MPD</b>\@minimumUpdatePeriod</tt> is not present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMediaPresentationDuration () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the smallest period between potential changes to the MPD.
+ * This can be useful to control the frequency at which a client checks for updates. \n
+ * If this attribute is not present it indicates that the MPD does not change.
+ * If <tt><b>MPD</b>\@type</tt> is \c \"static\", \c \@minimumUpdatePeriod shall not be present.\n
+ * Details on the use of the value of this attribute are specified in section 5.4. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMinimumUpdatePeriod () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies a common duration used in the definition of the Representation data rate
+ * (see \c \@bandwidth attribute in section 5.3.5.2 of <em>ISO/IEC 23009-1, Part 1, 2012</em>).
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMinBufferTime () const = 0;
+
+
+ /**
+ * Returns a reference to a string that specifies the duration of the time shifting buffer that is guaranteed to be available for a Media Presentation
+ * with type \c \"dynamic\". When not present, the value is infinite. This value of the attribute is undefined if the type attribute is equal to \c \"static\".
+ * @return a reference to a string
+ */
+ virtual const std::string& GetTimeShiftBufferDepth () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies
+ * <ul>
+ * <li>when \c \@type is \c \"dynamic\", a fixed delay offset in time from the presentation time of each access unit that is suggested to be used for presentation of each access unit.\n
+ For more details refer to 7.2.1. \n
+ When not specified, then no value is provided and the client is expected to choose a suitable value.
+ <li>when \c \@type is \c \"static\" the value of the attribute is undefined and may be ignored.
+ </ul>
+ * @return a reference to a string
+ */
+ virtual const std::string& GetSuggestedPresentationDelay () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the maximum duration of any Segment in any Representation in the Media Presentation,
+ * i.e. documented in this MPD and any future update of the MPD. If not present, then the maximum Segment duration shall be the maximum duration of any Segment documented in this MPD.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMaxSegmentDuration () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the maximum duration of any Media Subsegment in any Representation in the Media Presentation.
+ * If not present, the same value as for the maximum Segment duration is implied.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMaxSubsegmentDuration () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::IBaseUrl that specifies the absolute path to the MPD file. \n
+ * This absolute path is needed if there is no BaseURL specified and all other BaseURLs are relative.
+ * @return a pointer to a dash::mpd::IBaseUrl
+ */
+ virtual IBaseUrl* GetMPDPathBaseUrl () const = 0;
+
+ /**
+ * Returns the UTC time in seconds when the MPD was fetched.\n
+ * It is up to the client to check that this value has been set accordingly. \n
+ * See SetFetchTime() for further details.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetFetchTime () const = 0;
+ };
+ }
+}
+
+#endif /* IMPD_H_ */ \ No newline at end of file
diff --git a/libdash/include/IMPDElement.h b/libdash/include/IMPDElement.h
new file mode 100644
index 00000000..616b5448
--- /dev/null
+++ b/libdash/include/IMPDElement.h
@@ -0,0 +1,77 @@
+/**
+ * @class dash::mpd::IMPDElement
+ * @brief This interface is needed for accessing additional nested <em>XML Elements</em> and <em>XML Attributes</em> of some MPD Classes.
+ * @details Due to the fact that some MPD classes may contain additional <em>XML Elements</em>, which are not specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * but are attached to them, this interface is needed for retrieving these <em>XML Elements</em>. \n\n
+ * See example below for clarification (inspired by the example from section G.7 of <em>ISO/IEC 23009-1, Part 1, 2012</em>).\n
+ * \code{.xml}
+ * <ContentProtection schemeIdUri="http://example.net/052011/drm" additionalAttribute="abc">
+ * <drm:License>http://MoviesSP.example.com/protect?license=kljklsdfiowek</drm:License>
+ * <drm:Content>http://MoviesSP.example.com/protect?content=oyfYvpo8yFyvyo8f</drm:Content>
+ * </ContentProtection>
+ * \endcode
+ * \em ContentProtection is of type <tt><b>DescriptorType</b></tt> which is defined in section 5.8.3 of <em>ISO/IEC 23009-1, Part 1, 2012</em> as follows:
+ * \code{.xml}
+ * <!-- Descriptor -->
+ * <xs:complexType name="DescriptorType">
+ * <xs:sequence>
+ * <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ * </xs:sequence>
+ * <xs:attribute name="schemeIdUri" type="xs:anyURI" use="required"/>
+ * <xs:attribute name="value" type="xs:string"/>
+ * <xs:anyAttribute namespace="##other" processContents="lax"/>
+ * </xs:complexType>
+ * \endcode
+ * So <tt><b>ContentProtection</b></tt> can contain additional <em>XML Elements</em> - here <tt><b>License</b></tt> and <tt><b>Content</b></tt> -
+ * which are of type dash::xml::INode and can be retrieved by calling GetAdditionalSubNodes(). \n
+ * Similarly additional <em>XML Attributes</em> that are not specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * can be retrieved by calling GetRawAttributes(), but please mind that all attributes
+ * of the Element are returned, not just the additional ones. So in the example above both
+ * attributes \c schemeIDUri (which is specified) and \c additionalAttribute (which is not) are returned.
+ * @see dash::xml::INode
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IMPDELEMENT_H_
+#define IMPDELEMENT_H_
+
+#include "config.h"
+
+#include "INode.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IMPDElement
+ {
+ public:
+ virtual ~IMPDElement (){}
+
+ /**
+ * This method returns a vector of pointers to dash::xml::INode objects which correspond to additional <em>XML Elements</em> of certain
+ * MPD elements. These <em>XML Elements</em> are not specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>. \n
+ * See the example in the class description for details.
+ * @return a vector of pointers to dash::xml::INode objects
+ */
+ virtual const std::vector<xml::INode *> GetAdditionalSubNodes () const = 0;
+
+ /**
+ * This method returns a map with key values and mapped values of type std::string of all <em>XML Attributes</em> of certain MPD elements. \n
+ * Some of these <em>XML Attributes</em> are not specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>. \n
+ * See the example in the class description for details.
+ * @return a map with key values and mapped values, both of type std::string
+ */
+ virtual const std::map<std::string, std::string> GetRawAttributes () const = 0;
+ };
+ }
+}
+
+#endif /* IMPDELEMENT_H_ */
diff --git a/libdash/include/IMetrics.h b/libdash/include/IMetrics.h
new file mode 100644
index 00000000..c1498727
--- /dev/null
+++ b/libdash/include/IMetrics.h
@@ -0,0 +1,62 @@
+/**
+ * @class dash::mpd::IMetrics
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>Metrics</b></tt> element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.9.2, table 23
+ * @details This part of <em>ISO/IEC 23009</em> does not define mechanisms for reporting metrics, however it does define a set of metrics and a mechanism
+ * that may be used by the service provider to trigger metric collection and reporting at the clients, should a reporting mechanism be available.
+ * The trigger mechanism is based on the <tt><b>Metrics</b></tt> element in the MPD. The element contains the list of DASH Metrics for which the measurements are desired,
+ * the time interval and the granularity for the measurements, as well as the scheme according to which the metric reporting is desired.
+ * @see dash::mpd::IDescriptor dash::mpd::IRange dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IMETRICS_H_
+#define IMETRICS_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IDescriptor.h"
+#include "IRange.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IMetrics : public virtual IMPDElement
+ {
+ public:
+ virtual ~IMetrics(){}
+
+ /**
+ * Returns a refernce to a vector of pointers to dash::mpd::IDescriptor objects that specify information about the requested reporting method and formats.\n
+ * For more details refer to section 5.9.4. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetReportings () const = 0;
+
+ /**
+ * Returns a refernce to a vector of pointers to dash::mpd::IRange objects that specify the time period during which DASH Metrics collection is requested.
+ * When not present, DASH Metrics reporting is requested for the whole duration of the content.
+ * @return a reference to a vector of pointers to dash::mpd::IRange objects
+ */
+ virtual const std::vector<IRange *>& GetRanges () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies all DASH Metrics (as a list of DASH Metric keys as defined in Annex D of <em>ISO/IEC 23009-1, Part 1, 2012</em>, separated by a comma)
+ * that the client is desired to report.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMetrics () const = 0;
+
+ };
+ }
+}
+
+#endif /* IMETRICS_H_ */ \ No newline at end of file
diff --git a/libdash/include/IMultipleSegmentBase.h b/libdash/include/IMultipleSegmentBase.h
new file mode 100644
index 00000000..06d0dff3
--- /dev/null
+++ b/libdash/include/IMultipleSegmentBase.h
@@ -0,0 +1,66 @@
+/**
+ * @class dash::mpd::IMultipleSegmentBase
+ * @brief This interface is needed for accessing the common elements and attributes for the <tt><b>MultipleBaseInformation</b></tt> type
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.2.2, table 12
+ * @details It specifies multiple Segment base information
+ * @see dash::mpd::ISegmentTimeline dash::mpd::ISegmentBase dash::mpd::IURLType
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IMULTIPLESEGMENTBASE_H_
+#define IMULTIPLESEGMENTBASE_H_
+
+#include "config.h"
+
+#include "ISegmentTimeline.h"
+#include "ISegmentBase.h"
+#include "IURLType.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IMultipleSegmentBase : public virtual ISegmentBase
+ {
+ public:
+ virtual ~IMultipleSegmentBase(){}
+
+ /**
+ * Return a pointer to a dash::mpd::ISegmentTimeline object
+ * @return a pointer to a dash::mpd::ISegmentTimeline object
+ */
+ virtual const ISegmentTimeline* GetSegmentTimeline () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::IURLType object that specifies the URL including a possible byte range for the Bitstream Switching Segment.
+ * @return a pointer to a dash::mpd::IURLType object
+ */
+ virtual const IURLType* GetBitstreamSwitching () const = 0;
+
+ /**
+ * Returns a integer specifying the constant approximate Segment duration. \n
+ * All Segments within this Representation element have the same duration unless it is the last Segment within the Period, which could be significantly shorter.\n
+ * The value of the duration in seconds is the division of the value of this attribute and the value of the \c \@timescale attribute associated to the containing Representation.\n
+ * For more details refer to section 5.3.9.5.3. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetDuration () const = 0;
+
+ /**
+ * Returns a integer specifying the number of the first Media Segment in this Representation in the Period.\n
+ * For more details refer to 5.3.9.5.3. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetStartNumber () const = 0;
+ };
+ }
+}
+
+#endif /* IMULTIPLESEGMENTBASE_H_ */ \ No newline at end of file
diff --git a/libdash/include/INode.h b/libdash/include/INode.h
new file mode 100644
index 00000000..96bc6e88
--- /dev/null
+++ b/libdash/include/INode.h
@@ -0,0 +1,97 @@
+/**
+ * @class dash::xml::INode
+ * @brief This interface defines the access to class members of <em>XML Elements</em>.
+ * @details Due to the fact that some MPD elements may contain additional <em>XML Elements</em>, which are not specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * but are attached to them, this interface is needed to access such an <em>XML Element</em>. \n\n
+ * For clarification see the example in dash::mpd::IMPDElement
+ * @see dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef INODE_H_
+#define INODE_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace xml
+ {
+ class INode
+ {
+ public:
+ virtual ~INode (){}
+
+ /**
+ * Returns a reference to a vector of pointers to nested dash::xml::INode objects.
+ * @return a reference to a vector containing pointers to dash::xml::INode objects.
+ */
+ virtual const std::vector<INode *>& GetNodes () const = 0;
+
+ /**
+ * Returns a vector of attribute names belonging to this <em>XML Element</em>
+ * @return a vector of strings
+ */
+ virtual std::vector<std::string> GetAttributeKeys () const = 0;
+
+ /**
+ * Returns the name of this <em>XML Element</em>
+ * @return a reference to string
+ */
+ virtual const std::string& GetName () const = 0;
+
+ /**
+ * Returns the text contained in this <em>XML Element</em>
+ * @return a string
+ */
+ virtual std::string GetText () const = 0;
+
+ /**
+ * Returns a std::map of key value / mapped value pairs corresponding to the <em>XML Attributes</em> and their values of this <em>XML Element</em>
+ * @return a reference to a map with key values and mapped values, both of type std::string
+ */
+ virtual const std::map<std::string, std::string>& GetAttributes () const = 0;
+
+ /**
+ * Returns the type of this <em>XML Element</em> represented by an integer
+ * \code
+ * Start = 1
+ * End = 15
+ * WhiteSpace = 14
+ * Text = 3
+ * \endcode
+ * @return an integer
+ */
+ virtual int GetType () const = 0;
+
+ /**
+ * Returns the value belonging to the <em>XML Attribute</em> specified by key
+ * @param key the name of the desired <em>XML Attribute</em>
+ * @return a reference to a string
+ */
+ virtual const std::string& GetAttributeValue (std::string key) const = 0;
+
+ /**
+ * Returns a bool value determininig whether the <em>XML Attribute</em> name is contained in this <em>XML Element</em> or not.
+ * @param name the name of the desired <em>XML Attribute</em>
+ * @return a bool value
+ */
+ virtual bool HasAttribute (const std::string& name) const = 0;
+
+ /**
+ * Returns a bool value determining whether the <em>XML Element</em> has text or not.
+ * @return a bool value
+ */
+ virtual bool HasText () const = 0;
+ };
+ }
+}
+
+#endif /* INODE_H_ */
diff --git a/libdash/include/IPeriod.h b/libdash/include/IPeriod.h
new file mode 100644
index 00000000..10ec9244
--- /dev/null
+++ b/libdash/include/IPeriod.h
@@ -0,0 +1,156 @@
+/**
+ * @class dash::mpd::IPeriod
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>Period</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.2.2, table 4
+ * @details A Media Presentation consists of one or more Periods. A Period is defined by a <tt><b>Period</b></tt> element in the <tt><b>MPD</b></tt> element. \n
+ * The type of the Period, either a regular Period or an Early Available Period, as well as the \em PeriodStart time of a regular Period is determined as follows:
+ * <ul>
+ * <li>If the attribute \c \@start is present in the Period, then the Period is a regular <tt><b>Period</b></tt> and the \em PeriodStart is equal to the value of this attribute.
+ * <li>If the \c \@start attribute is absent, but the previous <tt><b>Period</b></tt> element contains a \c \@duration attribute then then this new Period is also a regular Period.
+ * The start time of the new Period \em PeriodStart is the sum of the start time of the previous Period \em PeriodStart and
+ * the value of the attribute \c \@duration of the previous Period.
+ * <li>If \em (i) \c \@start attribute is absent, and \em (ii) the <tt><b>Period</b></tt> element is the first in the MPD,
+ * and \em (iii) the <tt><b>MPD</b>\@type</tt> is \c 'static', then the \em PeriodStart time shall be set to zero.
+ * <li>If \em (i) \c \@start attribute is absent, and \em (ii) the previous Period element does not contain a \c \@duration attribute or
+ * the <tt><b>Period</b></tt> element is the first in the MPD, and (iii) the <tt><b>MPD</b>\@type</tt> is \c 'dynamic',
+ * then this Period is an Early Available Period (see below for details).
+ * </ul>
+ * For any regular Period the following holds: \em PeriodStart reflects the actual time that should elapse after playing the media of all prior Periods in this Media Presentation
+ * relative to the \em PeriodStart time of the first Period in the Media Presentation. The Period extends until the \em PeriodStart of the next Period, or until the end of the
+ * Media Presentation in the case of the last Period. More specifically, the difference between the \em PeriodStart time of a Period and
+ * either the \em PeriodStart time of the following Period, if this is not the last Period, or the value of the <tt><b>MPD</b>\@mediaPresentationDuration</tt> if this is the last one,
+ * is the presentation duration in Media Presentation time of the media content represented by the Representations in this Period. \n\n
+ * Early Available Periods may be used to advertise initialization of other non-media data before the media data itself is available.
+ * <tt><b>Period</b></tt> elements documenting early available Periods shall not occur before any Period element documenting a regular Period. For Early Available Periods,
+ * any resources that are announced in such a Period element shall be available. Such a <tt><b>Period</b></tt> element shall not contain URLs to Media Segments.
+ * The data contained in such a <tt><b>Period</b></tt> element does not represent a Period in the Media Presentation. Only when the \em PeriodStart time becomes known
+ * through an update of the MPD, such a <tt><b>Period</b></tt> element represents a regular Period. However, an update of the MPD may even remove a <tt><b>Period</b></tt> element
+ * representing an Early Available Period in later updates of the MPD as long as no \em PeriodStart time is associated with the Period. \n\n
+ * To avoid dereferencing of a remote element containing a <tt><b>Period</b></tt> element solely to determine the Period timeline, e.g. in case of seeking,
+ * <tt><b>Period</b>\@start</tt> or previous Period's <tt><b>Period</b>\@duration</tt> should be present in the MPD.
+ * @see dash::mpd::IMPDElement dash::mpd::BaseUrl dash::mpd::IAdaptationSet dash::mpd::ISegmentBase dash::mpd::ISegmentList dash::mpd::ISegmentTemplate dash::mpd::ISubset
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IPERIOD_H_
+#define IPERIOD_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IBaseUrl.h"
+#include "ISegmentBase.h"
+#include "ISegmentList.h"
+#include "ISegmentTemplate.h"
+#include "IAdaptationSet.h"
+#include "ISubset.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IPeriod : public virtual IMPDElement
+ {
+ public:
+ virtual ~IPeriod(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IBaseUrl objects that specify base URLs that can be used for reference resolution and alternative URL selection.\n
+ * For more details refer to the description in section 5.6. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IBaseUrl objects
+ */
+ virtual const std::vector<IBaseUrl *>& GetBaseURLs () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentBase object that specifies default Segment Base information.\n
+ * Information in this element is overridden by information in <tt><b>AdapationSet.SegmentBase</b></tt> and <tt><b>Representation.SegmentBase</b></tt>, if present.\n
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentBase object
+ */
+ virtual ISegmentBase* GetSegmentBase () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentList object that specifies default Segment List information.\n
+ * Information in this element is overridden by information in <tt><b>AdapationSet.SegmentList</b></tt> and <tt><b>Representation.SegmentList</b></tt>, if present.\n
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentList object
+ */
+ virtual ISegmentList* GetSegmentList () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentTemplate object that specifies default Segment Template information.\n
+ * Information in this element is overridden by information in <tt><b>AdapationSet.SegmentTemplate</b></tt> and <tt><b>Representation.SegmentTemplate</b></tt>, if present.
+ * For more details see section 5.3.9. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentTemplate object
+ */
+ virtual ISegmentTemplate* GetSegmentTemplate () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IAdaptationSet objects that specify Adapatation Sets.\n
+ * At least one Adaptation Set shall be present in each Period. However, the actual element may be present only in a remote element if xlink is in use.\n
+ * For more details see section 5.3.3. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IAdaptationSet objects
+ */
+ virtual const std::vector<IAdaptationSet *>& GetAdaptationSets () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::ISubset objects that specify Subsets.\n
+ * For more details see section 5.3.8. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::ISubset objects
+ */
+ virtual const std::vector<ISubset *>& GetSubsets () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies a reference to an external <tt><b>Period</b></tt> element.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkHref () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the processing instructions, which can be either \c \"onLoad\" or \c \"onRequest\".\n
+ * This attribute shall not be present if the \c \@xlink:href attribute is not present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkActuate () const = 0;
+
+ /**
+ * Returns an reference to a string that specifies an identifier for this Period.
+ * The attribute shall be unique in the scope of the Media Presentation.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetId () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the \em PeriodStart time of the Period.The \em PeriodStart time is used as an anchor to determine the MPD start
+ * time of each Media Segment as well as to determine the presentation time of each each access unit in the Media Presentation timeline.\n
+ * If not present, refer to the details in section 5.3.2.1. of <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * @return a reference to a string
+ */
+ virtual const std::string& GetStart () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the duration of the Period to determine the \em PeriodStart time of the next Period.\n
+ * If not present, refer to the details in section 5.3.2.1. of <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * @return a reference to a string
+ */
+ virtual const std::string& GetDuration () const = 0;
+
+ /**
+ * When set to \c 'true', this is equivalent as if the <tt><b>AdaptationSet</b>\@bitstreamSwitching</tt> for each Adaptation Set contained in this Period is set to \c 'true'.
+ * In this case, the <tt><b>AdaptationSet</b>\@bitstreamSwitching</tt> attribute shall not be set to \c 'false' for any Adaptation Set in this Period.
+ * @return a bool value
+ */
+ virtual bool GetBitstreamSwitching () const = 0;
+
+ };
+ }
+}
+
+#endif /* IPERIOD_H_ */ \ No newline at end of file
diff --git a/libdash/include/IProgramInformation.h b/libdash/include/IProgramInformation.h
new file mode 100644
index 00000000..58c03750
--- /dev/null
+++ b/libdash/include/IProgramInformation.h
@@ -0,0 +1,69 @@
+/**
+ * @class dash::mpd::IProgramInformation
+ * @brief This interface is needed for accessing the attributes and elements of the Program Information element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.7.2, table 20
+ * @details Descriptive information on the program may be provided for a Media Presentation within the <tt><b>ProgramInformation</b></tt> element.
+ * When multiple <tt><b>ProgramInformation</b></tt> elements are present, the \c \@lang attribute shall be present and
+ * each element shall describe the Media Presentation sufficiently in the language defined by the value of the \c \@lang attribute.
+ * For each language, the program information may specify title, source of the program, copyright information, and a URL to more information.
+ * @see dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IPROGRAMINFORMATION_H_
+#define IPROGRAMINFORMATION_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IProgramInformation : public virtual IMPDElement
+ {
+ public:
+ virtual ~IProgramInformation(){}
+
+ /**
+ * Returns a reference to a string that specifies the title for the Media Presentation.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetTitle () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies information about the original source (for example content provider) of the Media Presentation.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetSource () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies a copyright statement for the Media Presentation, usually starting with the copyright symbol, unicode \c U+00A9.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetCopyright () const = 0;
+
+ /**
+ * Returns a reference to a string that declares the language code(s) for this Program Information. The syntax and semantics according to <em>IETF RFC 5646</em> shall be applied.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetLang () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies an absolute URL which provides more information about the Media Presentation.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMoreInformationURL () const = 0;
+
+ };
+ }
+}
+
+#endif /* IPROGRAMINFORMATION_H_ */ \ No newline at end of file
diff --git a/libdash/include/IRange.h b/libdash/include/IRange.h
new file mode 100644
index 00000000..0f85f98d
--- /dev/null
+++ b/libdash/include/IRange.h
@@ -0,0 +1,53 @@
+/**
+ * @class dash::mpd::IRange
+ * @brief This interface is needed for accessing the attributes and elements of the Metrics <tt><b>Range</b></tt> element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.9.2, table 23
+ * @details It specifies the time period during which DASH Metrics collection is requested.
+ * @see dash::mpd::IMetrics
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IRANGE_H_
+#define IRANGE_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IRange
+ {
+ public:
+ virtual ~IRange(){}
+
+ /**
+ * Returns a reference to a string that specifies the start time of the DASH Metrics collection operation.
+ * When not present, DASH Metrics collection is requested from the beginning of content consumption.
+ * For services with <tt><b>MPD</b>\@type='dynamic'</tt>, the start time is indicated in wallclock time by adding the value of this
+ * attribute to the value of the <tt><b>MPD</b>\@availabilityStartTime</tt> attribute.
+ * For services with <tt><b>MPD</b>\@type='static'</tt>, the start time is indicated in Media Presentation time and is relative to the
+ * PeriodStart time of the first Period in this MPD.
+ * \b NOTE: For example, if <tt><b>MPD</b>\@availabilityStartTime</tt> is 14:30 and the metrics collection is intended to start at 14:45, then \c \@starttime is 0:15.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetStarttime () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the duration of the DASH metrics collection interval. The value of the attribute expresses in Media Presentation time.
+ * If not present, the value is identical to the Media Presentation duration.
+ * @return a reference to string
+ */
+ virtual const std::string& GetDuration () const = 0;
+
+ };
+ }
+}
+
+#endif /* IRANGE_H_ */ \ No newline at end of file
diff --git a/libdash/include/IRepresentation.h b/libdash/include/IRepresentation.h
new file mode 100644
index 00000000..0762d870
--- /dev/null
+++ b/libdash/include/IRepresentation.h
@@ -0,0 +1,159 @@
+/**
+ * @class dash::mpd::IRepresentation
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>Representation</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.5.2, table 7
+ * @details Representations are described by the <tt><b>Representation</b></tt> element. <tt><b>Representation</b></tt> elements are contained in an <tt><b>AdaptationSet</b></tt> element.\n
+ * A Representation is one of the alternative choices of the complete set or subset of media content components comprising the media content during the defined Period.\n
+ * A Representation starts at the start of the Period \em PeriodStart and continues to the end of the Period, i.e. the start of the next Period or the end of the Media Presentation.\n
+ * Each Representation includes one or more media streams, where each media stream is an encoded version of one media content component.\n
+ * A Representation consists of one or more Segments.\n
+ * Each Representation either shall contain an Initialization Segment or each Media Segment in the Representation shall be self-initializing,
+ * i.e. the Media Segment itself conforms to the media type as specified in the \c \@mimeType attribute for this Representation. \n
+ * When a Representation is not a dependent Representation, i.e. the \c \@dependencyId attribute is absent, then concatenation of the Initialization Segment,
+ * if present, and all consecutive Media Segments in one Representation shall represent a conforming Segment sequence as defined in section 4.5.3 of <em>ISO/IEC 23009-1, Part 1, 2012</em>
+ * conforming to the media type as specified in the \c \@mimeType attribute for this Representation.\n
+ * Dependent Representations are described by a <tt><b>Representation</b></tt> element that contains a \c \@dependencyId attribute.
+ * Dependent Representations are regular Representations except that they depend on a set of complementary Representations for decoding and/or presentation.
+ * The \c \@dependencyId contains the values of the \c \@id attribute of all the complementary Representations, i.e. Representations that are necessary to
+ * present and/or decode the media content components contained in this dependent Representation.\n
+ * For any dependent Representation X that depends on complementary Representation Y, the <em>m</em>-th Subsegment of X and the <em>n</em>-th Subsegment of Y
+ * shall be non-overlapping (as defined in 4.5.3) whenever \em m is not equal to \em n. For dependent Representations the concatenation of the Initialization Segment with the
+ * sequence of Subsegments of the dependent Representations, each being preceded by the corresponding Subsegment of each of the complementary Representations
+ * in order as provided in the \c \@dependencyId attribute shall represent a conforming Subsegment sequence as defined in 4.5.3 conforming to the media
+ * format as specified in the \c \@mimeType attribute for this dependent Representation.\n\n
+ * \b NOTE: When decoding of a dependent Representation is started from a SAP in the (Sub)Segment with number \em i, the decoding process does not need to access
+ * data from the complementary Representation(s) from any earlier (sub)segments than (sub)Segment with number i of the complementary Representation(s).
+ * @see dash::mpd::IRepresentationBase dash::mpd::ISegmentBase dash::mpd::ISegmentList dash::mpd::ISegmentTemplate dash::mpd::IBaseUrl dash::mpd::ISubRepresentation
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IREPRESENTATION_H_
+#define IREPRESENTATION_H_
+
+#include "config.h"
+
+#include "IBaseUrl.h"
+#include "ISubRepresentation.h"
+#include "ISegmentBase.h"
+#include "ISegmentList.h"
+#include "ISegmentTemplate.h"
+#include "IRepresentationBase.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IRepresentation : public virtual IRepresentationBase
+ {
+ public:
+ virtual ~IRepresentation(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IBaseUrl objects that specifies Base URLs that can be used for reference resolution and alternative URL selection.\n
+ * For more details refer to the description in section 5.6. of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IBaseUrl objects
+ */
+ virtual const std::vector<IBaseUrl *>& GetBaseURLs () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::ISubRepresentation objects that specifies information about Sub-Representations
+ * that are embedded in the containing Representation.
+ * For more detail see section 5.3.6 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::ISubRepresentation objects
+ */
+ virtual const std::vector<ISubRepresentation *>& GetSubRepresentations () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentBase object that specifies default Segment Base information.
+ * For more detail see section 5.3.9 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentBase object
+ */
+ virtual ISegmentBase* GetSegmentBase () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentList object that specifies the Segment List information.
+ * For more detail see section 5.3.9 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentList object
+ */
+ virtual ISegmentList* GetSegmentList () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegmentTemplate object that specifies the Segment Template information.
+ * For more detail see section 5.3.9 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a pointer to a dash::mpd::ISegmentTemplate object
+ */
+ virtual ISegmentTemplate* GetSegmentTemplate () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies an identifier for this Representation. The identifier shall be unique within a Period
+ * unless the Representation is functionally identically to another Representation in the same Period. \n
+ * The identifier shall not contain whitespace characters. \n
+ * If used in the template-based URL construction as defined in 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>,
+ * the string shall only contain characters that are permitted within an HTTP-URL according to RFC 1738.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetId () const = 0;
+
+ /**
+ * Returns an integer that specifies a bandwidth in bits per seconds (bps).\n
+ * If the Representation is continuously delivered at this bitrate, starting at any SAP that is indicated either by \c \@startWithSAP
+ * or by any Segment Index box, a client can be assured of having enough data for continuous playout providing playout begins after
+ * \c \@minBufferTime * \c \@bandwidth bits have been received (i.e. at time \c \@minBufferTime after the first bit is received).\n\n
+ * For dependent Representations this value shall specify the minimum bandwidth as defined above of this Representation and all complementary Representations.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetBandwidth () const = 0;
+
+ /**
+ * Returns an integer that specifies a quality ranking of the Representation relative to other Representations in the same Adaptation Set.
+ * Lower values represent higher quality content.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetQualityRanking () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies all complementary Representations the Representation depends on in the decoding and/or
+ * presentation process as values of \c \@id attributes.\n
+ * If not present, the Representation can be decoded and presented independently of any other Representation. \n
+ * This attribute shall not be present where there are no dependencies.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetDependencyId () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies media stream structure identifier values.\n
+ * The attribute may be present for Representations containing video and its semantics are unspecified for any other type of Representations.\n
+ * If present, the attribute \c \@mediaStreamStructureId specifies a whitespace-separated list of media stream structure identifier values.
+ * If media streams share the same media stream structure identifier value, the media streams shall have the following characteristics:
+ * <ul>
+ * <li> The media streams have the same number of Stream Access Points of type 1 to 3.
+ * <li> The values of T<sub>SAP</sub>, T<sub>DEC</sub>, T<sub>EPT</sub>, and T<sub>PTF</sub> of the <em>i</em>-th SAP of type 1 to 3 in one media stream are identical
+ * to the values of T<sub>SAP</sub>, T<sub>DEC</sub>, T<sub>EPT</sub>, and T<sub>PTF</sub>, respectively, of the <em>i</em>-th SAP of type 1 to 3
+ * in the other media streams for any value of \em i from 1 to the number of SAPs of type 1 to 3 in any of the media streams.
+ * <li> A media stream formed by concatenating the media stream of a first Representation until I<sub>SAU</sub> (exclusive) of the <em>i</em>-th SAP of type 1 to 3 and the
+ * media stream of a second Representation (having the same media stream structure identifier value as for the first Representation) starting from the I<sub>SAU</sub>
+ * (inclusive) of the <em>i</em>-th SAP of type 1 to 3 conforms to the specification in which the media stream format is specified for any value of \em i from 1 to the number
+ * of SAPs of type 1 to 3 in either media stream. Furthermore, the decoded pictures have an acceptable quality regardless of type of the Stream Access Point access unit used.
+ * </ul>
+ * All media stream structure identifier values for one Adaptation Set shall differ from those of another Adaptation Set.\n
+ * If not present, then for this Representation no similarities to other Representations are known.
+ * \b NOTE Indicating multiple media stream structure identifier values for a Representation can be useful in cases where switching between Representations A and B
+ * as well as between Representations B and C is allowed at non-IDR intra pictures, but switching between Representations A and C would cause too
+ * severe a degradation in the quality of the leading pictures and is hence not allowed. To indicate these permissions and restrictions,
+ * Representation A would contain \c \@mediaStreamStructureId equal to \"1"\", Representation B would contain \c \@mediaStreamStructureId equal to \"1 2\",
+ * and Representation C would contain \c \@mediaStreamStructureId equal to \"2\".
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetMediaStreamStructureId () const = 0;
+ };
+ }
+}
+
+#endif /* IREPRESENTATION_H_ */
diff --git a/libdash/include/IRepresentationBase.h b/libdash/include/IRepresentationBase.h
new file mode 100644
index 00000000..e7b7e688
--- /dev/null
+++ b/libdash/include/IRepresentationBase.h
@@ -0,0 +1,181 @@
+/**
+ * @class dash::mpd::IRepresentationBase
+ * @brief This interface is needed for accessing the common attributes and elements of the certain MPD element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.7
+ * @details The elements \c <b>AdaptationSet</b>, \c <b>Representation</b> and \c <b>SubRepresentation</b> have assigned common attributes and elements that are specified in
+ * <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.7.2, table 9
+ * @see dash::mpd::IDescriptor dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IREPRESENTATIONBASE_H_
+#define IREPRESENTATIONBASE_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IDescriptor.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IRepresentationBase : public virtual IMPDElement
+ {
+ public:
+ virtual ~IRepresentationBase(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specifies frame-packing arrangement information of the video media component type.\n
+ * When no <tt><b>FramePacking</b></tt> element is provided for a video component, frame-packing shall not used for the video media component.\n
+ * For further details see sections 5.8.1 and 5.8.4.6 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetFramePacking () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specifies the audio channel configuration of the audio media component type.\n
+ * For further details see sections 5.8.1 and 5.8.4.7 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetAudioChannelConfiguration () const = 0;
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::IDescriptor objects that specifies information about content protection schemes used for the associated Representations.\n
+ * For further details see sections 5.8.1 and 5.8.4.1 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a vector of pointers to dash::mpd::IDescriptor objects
+ */
+ virtual const std::vector<IDescriptor *>& GetContentProtection () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies the profiles which the associated Representation(s)
+ * conform to of the list of Media Presentation profiles as described in section 8 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * The value shall be a subset of the respective value in any higher level of the document hierarchy (Representation, Adaptation Set, MPD).\n
+ * If not present, the value is inferred to be the same as in the next higher level of the document hierarchy.
+ * For example, if the value is not present for a Representation, then \c \@profiles at the Adaptation Set level is valid for the Representation.\n
+ * The same syntax as defined in 5.3.1.2 shall be used.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetProfiles () const = 0;
+
+ /**
+ * Returns an integer that specifies the horizontal visual presentation size of the video
+ * media type on a grid determined by the \c \@sar attribute. \n\n
+ * In the absence of \c \@sar width and height are specified as if the value of \c \@sar were \"1:1\".\n
+ * \b NOTE: The visual presentation size of the video is equal to the number of horizontal and vertical samples used for presentation
+ * after encoded samples are cropped in response to encoded cropping parameters, “overscan” signaling, or “pan/scan” display parameters, e.g. SEI messages.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetWidth () const = 0;
+
+ /**
+ * Returns an integer that specifies the vertical visual presentation size of the video
+ * media type, on a grid determined by the \c \@sar attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetHeight () const = 0;
+
+ /**
+ * Returns a string that specifies the sample aspect ratio of the video media component type,
+ * in the form of a string consisting of two integers separated by ':', e.g., \"10:11\".
+ * The first number specifies the horizontal size of the encoded video pixels (samples) in arbitrary units.
+ * The second number specifies the vertical size of the encoded video pixels (samples) in same units as the horizontal size.
+ * @return a string
+ */
+ virtual std::string GetSar () const = 0;
+
+ /**
+ * Returns a string that specifies the output frame rate (or in the case of interlaced, half the output field rate)
+ * of the video media type in the Representation. If the frame or field rate is varying, the value is the average frame
+ * or half the average field rate field rate over the entire duration of the Representation.\n
+ * The value is coded as a string, either containing two integers separated by a \"/\", (\"F/D\"), or a single integer \"F\".
+ * The frame rate is the division F/D, or F, respectively, per second (i.e. the default value of D is \"1\").
+ * @return a string
+ */
+ virtual std::string GetFrameRate () const = 0;
+
+ /**
+ * Returns a string that represents an audio sampling rate. \n
+ * Either a single decimal integer value specifying the sampling rate or a whitespace separated pair of decimal integer
+ * values specifying the minimum and maximum sampling rate of the audio media component type. The values are in samples per second.
+ * @return a string
+ */
+ virtual std::string GetAudioSamplingRate () const = 0;
+
+ /**
+ * Returns a string that specifies the MIME type of the concatenation of the Initialization Segment, if present,
+ * and all consecutive Media Segments in the Representation.
+ * @return a string
+ */
+ virtual std::string GetMimeType () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies the profiles of Segments that are essential to process the Representation.
+ * The detailed semantics depend on the value of the \c \@mimeType attribute. The contents of this attribute shall conform to either the
+ * \c pro-simple or \c pro-fancy productions of RFC6381, Section 4.5, without the enclosing \c DQUOTE characters,
+ * i.e. including only the \c unencodedv or \c encodedv elements respectively.
+ * As profile identifier the brand identifier for the Segment as defined in section 6 of <em>ISO/IEC 23009-1, Part 1, 2012</em> shall be used.\n
+ * If not present on any level, the value may be deducted from the value of the\c \@profiles attribute.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetSegmentProfiles () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies the codecs present within the Representation.
+ * The codec parameters shall also include the profile and level information where applicable. \n
+ * The contents of this attribute shall conform to either the \c simp-list or \c fancy-list productions of RFC6381, Section 3.2,
+ * without the enclosing \c DQUOTE characters. The codec identifier for the Representation's media format,
+ * mapped into the name space for codecs as specified in RFC6381, Section 3.3, shall be used.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetCodecs () const = 0;
+
+ /**
+ * Returns a double value specifying the maximum SAP interval in seconds of all contained media streams,
+ * where the SAP interval is the maximum time interval between the T<sub>SAP</sub> of any two successive SAPs of types 1 to 3
+ * inclusive of one media stream in the associated Representations.
+ * @return a double
+ */
+ virtual double GetMaximumSAPPeriod () const = 0;
+
+ /**
+ * Returns an unsigned integer that (when greater than 0) specifies that in the associated Representations,
+ * each Media Segment starts with a SAP of type less than or equal to the value of this attribute value in each media stream.
+ * @return an unsigned integer
+ */
+ virtual uint8_t GetStartWithSAP () const = 0;
+
+ /**
+ * Returns a double that specifies the maximum playout rate as a multiple of the regular playout rate,
+ * which is supported with the same decoder profile and level requirements as the normal playout rate.
+ * @return a double
+ */
+ virtual double GetMaxPlayoutRate () const = 0;
+
+ /**
+ * Returns a bool value that informs about coding dependency.\n
+ * If \c 'true', for all contained media streams, specifies that there is at least one access unit that depends on one or more other access units for decoding.
+ * If \c 'false', for any contained media stream, there is no access unit that depends on any other access unit for decoding (e.g. for video all the pictures are intra coded). \n
+ * If not specified on any level, there may or may not be coding dependency between access units.
+ * @return a bool value
+ */
+ virtual bool HasCodingDependency () const = 0;
+
+ /**
+ * Returns a string that specifies the scan type of the source material of the video media component type.
+ * The value may be equal to one of \c \"progressive\", \c \"interlaced\" and \c \"unknown\".
+ * @return a string
+ */
+ virtual std::string GetScanType () const = 0;
+
+ };
+ }
+}
+
+#endif /* IREPRESENTATIONBASE_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegment.h b/libdash/include/ISegment.h
new file mode 100644
index 00000000..32355ef5
--- /dev/null
+++ b/libdash/include/ISegment.h
@@ -0,0 +1,86 @@
+/**
+ * @class dash::mpd::ISegment
+ * @brief This interface is needed for setting values of a Segment
+ * @details Several methods for setting the values of member variables are provided. \n\n
+ * These are only needed in case you do not want to use the values provided by the MPD.
+ * @see dash::network::IDownloadableChunk dash::network::IChunk
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISEGMENT_H_
+#define ISEGMENT_H_
+
+#include "config.h"
+
+#include "IDownloadableChunk.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegment : public virtual network::IDownloadableChunk
+ {
+ public:
+ virtual ~ISegment(){}
+
+ /**
+ * This method allows you to specify an absolute URI for this Segment
+ * @param uri a string representing an URI
+ */
+ virtual void AbsoluteURI (std::string uri) = 0;
+
+ /**
+ * This method allows you to specify a host for this Segment
+ * @param host a string representing an host
+ */
+ virtual void Host (std::string host) = 0;
+
+ /**
+ * This method allows you to specify a port for this Segment
+ * @param port an integer representing a portnumber
+ */
+ virtual void Port (size_t port) = 0;
+
+ /**
+ * This method allows you to specify a path for this Segment
+ * @param path a string representing a path
+ */
+ virtual void Path (std::string path) = 0;
+
+ /**
+ * This method allows you to specify a byte range for this Segment
+ * @param range a string representing a byte range as definend in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.2.2, table 13:\n
+ <em>The byte range shall be expressed and formatted as a \c byte-range-spec as defined in RFC 2616, Clause 14.35.1.
+ It is restricted to a single expression identifying a contiguous range of bytes.</em>
+ */
+ virtual void Range (std::string range) = 0;
+
+ /**
+ * This method allows you to specify the start byte for this Segment
+ * @param startByte an integer representing the start byte
+ */
+ virtual void StartByte (size_t startByte) = 0;
+
+ /**
+ * This method allows you to specify the end byte for this Segment
+ * @param endByte an integer representing the end byte
+ */
+ virtual void EndByte (size_t endByte) = 0;
+
+ /**
+ * This method allows you to specify whether this Segment has a byte range or not
+ * @param hasByteRange a bool value, \c true to specify that this Segment has a byte range, \c false otherwise
+ */
+ virtual void HasByteRange (bool hasByteRange) = 0;
+ };
+ }
+}
+
+#endif /* ISEGMENT_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegmentBase.h b/libdash/include/ISegmentBase.h
new file mode 100644
index 00000000..a29a4eab
--- /dev/null
+++ b/libdash/include/ISegmentBase.h
@@ -0,0 +1,86 @@
+/**
+ * @class dash::mpd::ISegmentBase
+ * @brief This interface is needed for accessing the common elements and attributes of <tt><b>SegmentBase</b></tt>
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.2.2, table 11
+ * @details It specifies Semgent base elements as well as the type for the Segment base information. \n
+ * The <tt><b>SegmentBase</b></tt> is sufficient if only a single Media Segment is provided per Representation and the Media Segment URL is included in the BaseURL element.\n
+ * In case multiple Media Segments are present, either a <tt><b>SegmentList</b></tt> or a <tt><b>SegmentTemplate</b></tt> is used
+ * that share the multiple Segment base information as provided in 5.3.9.2.3, Table 12. \n
+ * If the Representation contains more than one Media Segment, then either the attribute \c \@duration or the element <tt><b>SegmentTimeline</b></tt> shall be present.
+ * The attribute \c \@duration and the element <tt><b>SegmentTimeline</b></tt> shall not be present at the same time.
+ * Segments described by the Segment base information are referenced by an HTTP-URL conforming to the type URLType as defined in Table 13.
+ * @see dash::mpd::IURLType dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISEGMENTBASE_H_
+#define ISEGMENTBASE_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "IURLType.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegmentBase : public virtual IMPDElement
+ {
+ public:
+ virtual ~ISegmentBase(){}
+
+ /**
+ * Returns a pointer to a dash::mpd::IURLType object that specifies the URL including a possible byte range for the Initialization Segment.
+ * @return a pointer to dash::mpd::IURLType object
+ */
+ virtual const IURLType* GetInitialization () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::IURLType object that specifies the URL including a possible byte range for the Representation Index Segment.
+ * @return a pointer to dash::mpd::IURLType object
+ */
+ virtual const IURLType* GetRepresentationIndex () const = 0;
+
+ /**
+ * Returns an integer representing a timescale that specifies the timescale in units per seconds
+ * to be used for the derivation of different real-time duration values in the Segment Information.\n
+ * \b NOTE: This may be any frequency but typically is the media clock frequency of one of the media streams (or a positive integer multiple thereof).
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetTimescale () const = 0;
+
+ /**
+ * Returns an integer that specifies the presentation time offset of the Representation relative to the start of the Period.\n
+ * The value of the presentation time offset in seconds is the division of the value of this attribute and the value of the \c \@timescale attribute.\n
+ * If not present on any level, the value of the presentation time offset is 0.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetPresentationTimeOffset () const = 0;
+
+ /**
+ * Returns a string that specifies the byte range that contains the Segment Index in all Media Segments of the Representation.\n
+ * The byte range shall be expressed and formatted as a \c byte-range-spec as defined in RFC 2616, Clause 14.35.1.
+ * It is restricted to a single expression identifying a contiguous range of bytes.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetIndexRange () const = 0;
+
+ /**
+ * When set to \c 'true' specifies that for all Segments in the Representation, the data outside the prefix defined by \c \@indexRange contains the data
+ * needed to access all access units of all media streams syntactically and semantically.
+ * @return a bool value
+ */
+ virtual bool HasIndexRangeExact () const = 0;
+ };
+ }
+}
+
+#endif /* ISEGMENTBASE_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegmentList.h b/libdash/include/ISegmentList.h
new file mode 100644
index 00000000..803df66d
--- /dev/null
+++ b/libdash/include/ISegmentList.h
@@ -0,0 +1,58 @@
+/**
+ * @class dash::mpd::ISegmentList
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>SegmentList</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.3.2, table 14
+ * @details The Segment list is defined by one or more <tt><b>SegmentList</b></tt> elements. Each <tt><b>SegmentList</b></tt> element itself contains a list of <tt><b>SegmentURL</b></tt> elements
+ * for a consecutive list of Segment URLs. Each Segment URL may contain the Media Segment URL and possibly a byte range.
+ * The Segment URL element may also contain an Index Segment.
+ * @see dash::mpd::ISegmentURL dash::mpd::IMultipleSegmentBase
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISEGMENTLIST_H_
+#define ISEGMENTLIST_H_
+
+#include "config.h"
+
+#include "ISegmentURL.h"
+#include "IMultipleSegmentBase.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegmentList : public virtual IMultipleSegmentBase
+ {
+ public:
+ virtual ~ISegmentList(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::ISegmentURL objects that are contained in this SegmentList.
+ * @return a reference to a vector of pointers to dash::mpd::ISegmentURL objects
+ */
+ virtual const std::vector<ISegmentURL *>& GetSegmentURLs () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies a reference to an external <tt><b>SegmentList</b></tt> element.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkHref () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the processing set - can be either \c \"onLoad\" or \c \"onRequest\".
+ * @return a reference to a string
+ */
+ virtual const std::string& GetXlinkActuate () const = 0;
+
+ };
+ }
+}
+
+#endif /* ISEGMENTLIST_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegmentTemplate.h b/libdash/include/ISegmentTemplate.h
new file mode 100644
index 00000000..d7072956
--- /dev/null
+++ b/libdash/include/ISegmentTemplate.h
@@ -0,0 +1,148 @@
+/**
+ * @class dash::mpd::ISegmentTemplate
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>SegmentTemplate</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.4.2, table 15
+ * @details The Segment template is defined by the <tt><b>SegmentTemplate</b></tt> element. In this case, specific identifiers that are substituted by dynamic values assigned to Segments,
+ * to create a list of Segments. The substitution rules are provided in section 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @see dash::mpd::ISegment dash::mpd::IMultipleSegmentBase
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+
+#ifndef ISEGMENTTEMPLATE_H_
+#define ISEGMENTTEMPLATE_H_
+
+#include "config.h"
+
+#include "IMultipleSegmentBase.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegmentTemplate : public virtual IMultipleSegmentBase
+ {
+ public:
+ virtual ~ISegmentTemplate(){}
+
+ /**
+ * Returns a reference to a string that specifies the template to create the Media Segment List.\n
+ * For more details on template-based segment URL construction refer to section 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a string
+ */
+ virtual const std::string& Getmedia () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the template to create the Index Segment List. If neither the \em \$Number\$ nor the \em \$Time\$ identifier
+ * is included, this provides the URL to a Representation Index. \n
+ * For more details on template-based segment URL construction refer to section 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a string
+ */
+ virtual const std::string& Getindex () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the template to create the Initialization Segment. Neither \em \$Number\$ nor the \em \$Time\$ identifier
+ * shall be included. \n
+ * For more details on template-based segment URL construction refer to section 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a string
+ */
+ virtual const std::string& Getinitialization () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the template to create the Bitstream Switching Segment. Neither \em \$Number\$ nor the \em \$Time\$ identifier shall be included.\n
+ * For more details on template-based segment URL construction refer to section 5.3.9.4.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em>.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetbitstreamSwitching () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents an initialization segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Initialization Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Initialization template. \n
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the initialization template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier. \n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToInitializationSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents a Bitstream Switching Segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Bitstream Switching Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Bitstream Switching template. \n
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the Bitstream Switching template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier.\n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToBitstreamSwitchingSegment (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents a Media Segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Media Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Media template.\n
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the Media template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier. \n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @param number an integer specifying the desired Segment number that will replace the identifier \em \$Number\$ in the Media template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Number\$ identifier.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* GetMediaSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents a Index Segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Index Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Index template.\n
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the Index template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier.\n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @param number an integer specifying the desired Segment number that will replace the identifier \em \$Number\$ in the Index template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Number\$ identifier.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* GetIndexSegmentFromNumber (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t number) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents a Media Segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Media Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Media template.
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the Media template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier.\n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @param time an integer corresponding to the <tt><b>SegmentTimeline</b>\@t</tt> attribute that will replace the identifier \em \$Time\$ in the Media template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Time\$ identifier.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* GetMediaSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents a Index Segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the Index Segment (template).
+ * @param representationID a string containing the representation ID that will replace the identifier \em \$RepresentationID\$ in the Index template.\n
+ * \b NOTE: If there is no identifier \em \$RepresentationID\$ in the template then this parameter will not be used and can be set to \"\".
+ * @param bandwidth an integer specifying the bandwidth that will replace the identifier \em \$Bandwidth\$ in the Index template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Bandwidth\$ identifier.\n
+ * \b NOTE: If there is no identifier \em \$bandwidth\$ in the template then this parameter will not be used and can be set to 0.
+ * @param time an integer corresponding to the <tt><b>SegmentTimeline</b>\@t</tt> attribute that will replace the identifier \em \$Time\$ in the Index template.
+ * This integer will be formated according to a possibly contained format tag in the \em \$Time\$ identifier.
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* GetIndexSegmentFromTime (const std::vector<IBaseUrl *>& baseurls, const std::string& representationID, uint32_t bandwidth, uint32_t time) const = 0;
+ };
+ }
+}
+
+#endif /* ISEGMENTTEMPLATE_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegmentTimeline.h b/libdash/include/ISegmentTimeline.h
new file mode 100644
index 00000000..809ee735
--- /dev/null
+++ b/libdash/include/ISegmentTimeline.h
@@ -0,0 +1,50 @@
+/**
+ * @class dash::mpd::ISegmentTimeline
+ * @brief This interface is needed for accessing the subelements of the <tt><b>SegmentTimeline</b></tt> element, as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.6
+ * @details The <tt><b>SegmentTimeline</b></tt> element expresses the earliest presentation time and presentation duration (in units based on the \c \@timescale attribute)
+ * for each Segment in the Representation. The use is an alternative to providing the \c \@duration attribute and provides three additional features:
+ * <ul>
+ * <li> the specification of arbitrary Segment durations,
+ * <li> the specification of accurate Segment durations for one media stream where the duration expresses presentation duration of the Segment, and
+ * <li> the signalling of discontinuities of the Media Presentation timeline for which no Segment data are present in a specific Representation.
+ * </ul>
+ * For compactness the syntax of this element includes run-length compression to express a sequence of Segments having constant duration.\n\n
+ * The <tt><b>SegmentTimeline</b></tt> element shall contain a list of <tt><b>S</b></tt> elements each of which describes a sequence of contiguous segments of identical MPD duration.
+ * @see dash::mpd::ITimeline dash::mpd::IMultipleSegmentBase dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISEGMENTTIMELINE_H_
+#define ISEGMENTTIMELINE_H_
+
+#include "config.h"
+
+#include "ITimeline.h"
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegmentTimeline : public virtual IMPDElement
+ {
+ public:
+ virtual ~ISegmentTimeline(){}
+
+ /**
+ * Returns a reference to a vector of pointers to dash::mpd::ITimeline objects, that correspond to the to <b><tt>S</tt></b> elements.
+ * @return a reference to vector of pointers to dash::mpd::ITimeline objects
+ */
+ virtual std::vector<ITimeline *>& GetTimelines () const = 0;
+ };
+ }
+}
+
+#endif /* ISEGMENTTIMELINE_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISegmentURL.h b/libdash/include/ISegmentURL.h
new file mode 100644
index 00000000..236dc923
--- /dev/null
+++ b/libdash/include/ISegmentURL.h
@@ -0,0 +1,94 @@
+/**
+ * @class dash::mpd::ISegmentURL
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>SegmentURL</b></tt> element
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.3.2, table 14
+ * @details Each Segment URL may contain the Media Segment URL and possibly a byte range. The Segment URL element may also contain an Index Segment.
+ * @see dash::mpd::ISegment dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISEGMENTURL_H_
+#define ISEGMENTURL_H_
+
+#include "config.h"
+
+#include "ISegment.h"
+#include "IBaseUrl.h"
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISegmentURL : public virtual IMPDElement
+ {
+ public:
+ virtual ~ISegmentURL(){}
+
+ /**
+ * Returns a reference to a string that in combination with the \c \@mediaRange attribute specifies the HTTP-URL for the Media Segment.\n
+ * It shall be formated as an \c <absolute-URI> according to RFC 3986, Clause 4.3, with a fixed scheme of \"http\" or \"https\" or
+ * as a \c <relative-ref> according to RFC 3986, Clause 4.2.\n
+ * If not present, then any <tt><b>BaseURL</b></tt> element is mapped to the \c \@media attribute and the range attribute shall be present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMediaURI () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the byte range within the resource identified by the \c \@media corresponding to the Media Segment.
+ * The byte range shall be expressed and formatted as a \c byte-range-spec as defined in RFC 2616, Clause 14.35.1.
+ * It is restricted to a single expression identifying a contiguous range of bytes.\n
+ * If not present, the Media Segment is the entire resource referenced by the \c \@media attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetMediaRange () const = 0;
+
+ /**
+ * Returns a reference to a string that in combination with the \c \@indexRange attribute specifies the HTTP-URL for the Index Segment.
+ * It shall be formated as an \c <absolute-URI> according to RFC 3986, Clause 4.3, with a fixed scheme of \"http\" or \"https\" or
+ * as a \c <relative-ref> according to RFC 3986, Clause 4.2. \n
+ * If not present and the \c \@indexRange not present either, then no Index Segment information is provided for this Media Segment.\n
+ * If not present and the \c \@indexRange present, then the \c \@media attribute is mapped to the \c \@index. If the \c \@media attribute is not present either,
+ * then any <tt><b>BaseURL</b></tt> element is mapped to the \c \@index attribute and the \c \@indexRange attribute shall be present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetIndexURI () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the byte range within the resource identified by the \c \@index corresponding to the Index Segment.
+ * If \c \@index is not present, it specifies the byte range of the Segment Index in Media Segment.\n
+ * The byte range shall be expressed and formatted as a \c byte-range-spec as defined in RFC 2616, Clause 14.35.1. It is restricted to a single
+ * expression identifying a contiguous range of bytes. \n
+ * If not present, the Index Segment is the entire resource referenced by the \c \@index attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetIndexRange () const = 0;
+
+ virtual uint64_t GetActualRate () = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object which represents a media segment that can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the media segment
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToMediaSegment (const std::vector<IBaseUrl *>& baseurls) const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object that represents an index segment and can be downloaded.
+ * @param baseurls a vector of pointers to dash::mpd::IBaseUrl objects that represent the path to the index segment
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToIndexSegment (const std::vector<IBaseUrl *>& baseurls) const = 0;
+
+ };
+ }
+}
+
+#endif /* ISEGMENTURL_H_ */
diff --git a/libdash/include/ISubRepresentation.h b/libdash/include/ISubRepresentation.h
new file mode 100644
index 00000000..a93605c2
--- /dev/null
+++ b/libdash/include/ISubRepresentation.h
@@ -0,0 +1,70 @@
+/**
+ * @class dash::mpd::ISubRepresentation
+ * @brief This interface is needed for accessing the attributes and elements of the <tt><b>SubRepresentation</b></tt> element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.6.2, table 8
+ * @details Sub-Representations are embedded in regular Representations and are described by the <tt><b>SubRepresentation</b></tt> element.
+ * <tt><b>SubRepresentation</b></tt> elements are contained in a <tt><b>Representation</b></tt> element.\n
+ * The SubRepresentation element describes properties of one or several media content components that are embedded in the Representation.
+ * It may for example describe the exact properties of an embedded audio component (e.g., codec, sampling rate, etc.),
+ * an embedded sub-title (e.g., codec) or it may describe some embedded lower quality video layer (e.g. some lower frame rate, etc.).
+ * @see dash::mpd::IRepresentationBase
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISUBREPRESENTATION_H_
+#define ISUBREPRESENTATION_H_
+
+#include "config.h"
+
+#include "IRepresentationBase.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISubRepresentation : public virtual IRepresentationBase
+ {
+ public:
+ virtual ~ISubRepresentation(){}
+
+ /**
+ * Returns an integer that specifies the Sub-Representation level. If \c \@level attribute is present and for media formats used in this Part of ISO/IEC 23009,
+ * a Subsegment Index as defined in section 6.3.2.4 of <em>ISO/IEC 23009-1, Part 1, 2012</em> shall be available for each Media Segment in the containing Representation.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetLevel () const = 0;
+
+ /**
+ * Returns a reference to a vector of unsigned integers that specifies the set of Sub-Representations within this Representation that this Sub-Representation depends on
+ * in the decoding and/or presentation process as a list of \c \@level values.\n
+ * If not present, the Sub-Representation can be decoded and presented independently of any other Representation.
+ * @return a reference to a vector of unsigned integers
+ */
+ virtual const std::vector<uint32_t>& GetDependencyLevel () const = 0;
+
+ /**
+ * Returns an integer that is identical to the \c \@bandwidth definition in Representation, but applied to this Sub-Representation.
+ * This attribute shall be present if the \c \@level attribute is present.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetBandWidth () const = 0;
+
+ /**
+ * Returns a reference to a vector of strings that specifies the set of all media content components
+ * that are contained in this Sub-Representation as <tt><b>ContentComponent</b>\@id</tt> values. \n
+ * If not present, the Sub-Representation is not assigned to a media content component.
+ * @return a reference to a vector of strings
+ */
+ virtual const std::vector<std::string>& GetContentComponent () const = 0;
+
+ };
+ }
+}
+
+#endif /* ISUBREPRESENTATION_H_ */ \ No newline at end of file
diff --git a/libdash/include/ISubset.h b/libdash/include/ISubset.h
new file mode 100644
index 00000000..6d5c8566
--- /dev/null
+++ b/libdash/include/ISubset.h
@@ -0,0 +1,54 @@
+/**
+ * @class dash::mpd::ISubset
+ * @brief This interface is needed for accessing the attributes of the <tt><b>Subset</b></tt> element as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.8.2, table 10
+ * @details Subsets are described by the <tt><b>Subset</b></tt> element contained in the <tt><b>Period</b></tt> element. \n
+ * Subsets provide a mechanism to restrict the combination of active Adaptation Sets where an active Adaptation Set is one
+ * for which the DASH client is presenting at least one of the contained Representations.\n
+ * A Subset defines a set of one or more Adaptation Sets. The presence of a <tt><b>Subset</b></tt> element within a <tt><b>Period</b></tt> element expresses
+ * the intention of the creator of the Media Presentation that a client should act as follows:
+ * At any time, the set of active Adaptation Sets shall be a subset of the Adaptation Sets of one of the specified Subsets.
+ * Any Adaptation Set not explicitly contained in any Subset element is implicitly contained in all specified Subsets.\n
+ * This implies that
+ * <ul>
+ * <li>Empty Subsets are not allowed.
+ * <li>No Subset should contain all the Adaptation Sets.
+ * </ul>
+ * Each Adaptation Set for which the value of the \c \@id is provided in the \c \@contains attribute is contained in this Subset.
+ * @see dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ISUBSET_H_
+#define ISUBSET_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ISubset : public virtual IMPDElement
+ {
+ public:
+ virtual ~ISubset(){}
+
+ /**
+ * Returns a reference to a vector of unsigned integers specifying the Adaptation Sets contained in a Subset by providing
+ * the \c \@id values of the contained Adaptation Sets.
+ * @return a reference to a vector of unsigned integers
+ */
+ virtual const std::vector<uint32_t>& Contains () const = 0;
+ };
+ }
+}
+
+#endif /* ISUBSET_H_ */ \ No newline at end of file
diff --git a/libdash/include/ITCPConnection.h b/libdash/include/ITCPConnection.h
new file mode 100644
index 00000000..3d4f4867
--- /dev/null
+++ b/libdash/include/ITCPConnection.h
@@ -0,0 +1,40 @@
+/**
+ * @class dash::metrics::ITCPConnection
+ * @brief This interface is needed for accessing the attributes and the content of a <tt><b>TCP Connection</b></tt>
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.2
+ * @see
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ITCTPCONNECTION_H_
+#define ITCTPCONNECTION_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class ITCPConnection
+ {
+ public:
+ virtual ~ITCPConnection (){}
+
+ virtual uint32_t TCPId () const = 0;
+ virtual const std::string& DestinationAddress () const = 0;
+ virtual const std::string& ConnectionOpenedTime () const = 0;
+ virtual const std::string& ConnectionClosedTime () const = 0;
+ virtual uint64_t ConnectionTime () const = 0;
+
+ };
+ }
+}
+
+#endif /* ITCTPCONNECTION_H_ */
diff --git a/libdash/include/IThroughputMeasurement.h b/libdash/include/IThroughputMeasurement.h
new file mode 100644
index 00000000..c35cb9ae
--- /dev/null
+++ b/libdash/include/IThroughputMeasurement.h
@@ -0,0 +1,38 @@
+/**
+ * @class dash::metrics::IThroughputMeasurement
+ * @brief This interface is needed for accessing the attributes and the content of a single <tt><b>Throughput Measurment</b></tt> entry
+ * as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, annex D.4.3 (part of the HTTP Request/Response Transaction)
+ * @see dash::metrics::IHTTPTransaction
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ITHROUGHPUTMEASUREMENT_H_
+#define ITHROUGHPUTMEASUREMENT_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class IThroughputMeasurement
+ {
+ public:
+ virtual ~IThroughputMeasurement (){}
+
+ virtual const std::string& StartOfPeriod () const = 0;
+ virtual uint64_t DurationOfPeriod () const = 0;
+ virtual const std::vector<uint32_t>& ReceivedBytesPerTrace () const = 0;
+
+ };
+ }
+}
+
+#endif /* ITHROUGHPUTMEASUREMENT_H_ */
diff --git a/libdash/include/ITimeline.h b/libdash/include/ITimeline.h
new file mode 100644
index 00000000..e1f8e953
--- /dev/null
+++ b/libdash/include/ITimeline.h
@@ -0,0 +1,66 @@
+/**
+ * @class dash::mpd::ITimeline
+ * @brief This interface is needed for accessing the attributes of <b><tt>S</tt></b> elements, as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.6.1
+ * @details dash::mpd::ITimeline objects correspond to <b><tt>S</tt></b> elements of the <tt><b>SegmentTimeline</b></tt> \n \n
+ * The <b><tt>S</tt></b> element contains a mandatory \c \@d attribute specifying the MPD duration,
+ * an optional \c \@r repeat count attribute specifying the number of contiguous Segments with identical MPD duration minus one
+ * and an optional \c \@t time attribute specifying the MPD start time of the first Segment in the series.
+ * @see dash::mpd::ISegmentTimeline dash::mpd::IMultipleSegmentBase dash::mpd::IMPDElement
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef ITIMELINE_H_
+#define ITIMELINE_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class ITimeline : public virtual IMPDElement
+ {
+ public:
+ virtual ~ITimeline(){}
+
+ /**
+ * Returns an integer that specifies the MPD start time, in \c \@timescale units, the first Segment in the series starts relative to the beginning of the Period.\n
+ * The value of this attribute must be equal to or greater than the sum of the previous <tt><b>S</b></tt> element earliest presentation time and
+ * the sum of the contiguous Segment durations. \n
+ * If the value of the attribute is greater than what is expressed by the previous <tt><b>S</b></tt> element, it expresses discontinuities in the timeline.\n
+ * If not present then the value shall be assumed to be zero for the first S element and for the subsequent <tt><b>S</b></tt> elements,
+ * the value shall be assumed to be the sum of the previous <tt><b>S</b></tt> element's earliest presentation time and contiguous duration
+ * (i.e. previous <tt><b>S</b>\@t</tt> + \c \@d * (\c \@r + 1)).\n\n
+ * \em StartTime corresponds to the \c \@t attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetStartTime () const = 0;
+
+ /**
+ * Returns the integer that specifies the Segment duration, in units of the value of the \c \@timescale. \n\n
+ * \em Duration corresponds to the \c \@d attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetDuration () const = 0;
+
+ /**
+ * Returns an integer that specifies the repeat count of the number of following contiguous Segments with the same duration expressed by the value of \c \@d.
+ * This value is zero-based (e.g. a value of three means four Segments in the contiguous series). \n\n
+ * \em RepeatCount corresponds to the \c \@r attribute.
+ * @return an unsigned integer
+ */
+ virtual uint32_t GetRepeatCount () const = 0;
+ };
+ }
+}
+
+#endif /* ITIMELINE_H_ */ \ No newline at end of file
diff --git a/libdash/include/IURLType.h b/libdash/include/IURLType.h
new file mode 100644
index 00000000..67f893b5
--- /dev/null
+++ b/libdash/include/IURLType.h
@@ -0,0 +1,61 @@
+/**
+ * @class dash::mpd::IURLType
+ * @brief This interface is needed for accessing the attributes of <tt><b>URLType</b></tt> elements, as specified in <em>ISO/IEC 23009-1, Part 1, 2012</em>, section 5.3.9.2.2, table 13
+ * @details This object defines an HTTP-URL\n
+ * @see dash::mpd::IBaseUrl dash::mpd::IMPDElement dash::mpd::ISegment
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef IURLTYPE_H_
+#define IURLTYPE_H_
+
+#include "config.h"
+
+#include "IMPDElement.h"
+#include "ISegment.h"
+#include "IBaseUrl.h"
+
+namespace dash
+{
+ namespace mpd
+ {
+ class IURLType : public virtual IMPDElement
+ {
+ public:
+ virtual ~IURLType(){}
+
+ /**
+ * Returns a reference to a string that pecifies the source URL part and shall be formated either as an \c <absolute-URI> according to RFC 3986, Clause 4.3,
+ * with a fixed scheme of \"http\" or \"https\" or as a \c <relative-ref> according to RFC 3986, Clause 4.2.\n
+ * If not present, then any <tt><b>BaseURL</b></tt> element is mapped to the \c \@sourceURL attribute and the range attribute shall be present.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetSourceURL () const = 0;
+
+ /**
+ * Returns a reference to a string that specifies the byte range restricting the above HTTP-URL.\n
+ * The byte range shall be expressed and formatted as a byte-range-spec as defined in RFC 2616, Clause 14.35.1. It is restricted to a single expression identifying a
+ * contiguous range of bytes.\n
+ * If not present, the element refers to the entire resource referenced in the \c \@sourceURL attribute.
+ * @return a reference to a string
+ */
+ virtual const std::string& GetRange () const = 0;
+
+ /**
+ * Returns a pointer to a dash::mpd::ISegment object, that can be downloaded
+ * @param baseurls a reference to a vector of pointers to dash::mpd::IBaseUrl objects representing the path to \c \@sourceURL
+ * @return a pointer to a dash::mpd::ISegment object
+ */
+ virtual ISegment* ToSegment (const std::vector<IBaseUrl *>& baseurls) const = 0;
+ };
+ }
+}
+
+#endif /* IURLTYPE_H_ */ \ No newline at end of file
diff --git a/libdash/include/config.h b/libdash/include/config.h
new file mode 100644
index 00000000..951c7e12
--- /dev/null
+++ b/libdash/include/config.h
@@ -0,0 +1,37 @@
+/**
+ * config.h
+ *
+ * @brief Standard includes that are used by the library
+ * @details ...
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef CONFIG_H_
+#define CONFIG_H_
+
+/********************************
+ * Pragmas
+ ********************************/
+#pragma warning( disable : 4250 ) // virtual inheritance
+/********************************
+ * Standard includes
+ ********************************/
+#include <stdlib.h>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <stdint.h>
+#include <map>
+#include <deque>
+#include <iostream>
+#include <cstdlib>
+#include <string.h>
+
+#endif /* CONFIG_H_ */
diff --git a/libdash/include/libdash.h b/libdash/include/libdash.h
new file mode 100644
index 00000000..01b80bbd
--- /dev/null
+++ b/libdash/include/libdash.h
@@ -0,0 +1,31 @@
+/**
+ * libdash.h
+ *
+ * @brief The main interface to the libary that should be used to create a IDASHManager
+ * @details ...
+ *
+ * @author bitmovin Softwareentwicklung OG \n
+ * Email: libdash-dev@vicky.bitmovin.net
+ * @version 2.1
+ * @date 2013
+ * @copyright bitmovin Softwareentwicklung OG, All Rights Reserved \n\n
+ * This source code and its use and distribution, is subject to the terms
+ * and conditions of the applicable license agreement.
+ */
+
+#ifndef LIBDASH_H_
+#define LIBDASH_H_
+
+#include "config.h"
+
+#if defined _WIN32 || defined _WIN64
+#else
+#define __declspec(dllexport)
+#define __cdecl
+#endif
+
+#include "IDASHManager.h"
+
+__declspec(dllexport) dash::IDASHManager* __cdecl CreateDashManager();
+
+#endif /* LIBDASH_H_ */
diff --git a/libdash/license.txt b/libdash/license.txt
new file mode 100644
index 00000000..fee56851
--- /dev/null
+++ b/libdash/license.txt
@@ -0,0 +1,13 @@
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA \ No newline at end of file
diff --git a/libdash/mainpage.dox b/libdash/mainpage.dox
new file mode 100644
index 00000000..1a718a6e
--- /dev/null
+++ b/libdash/mainpage.dox
@@ -0,0 +1,93 @@
+/**
+\mainpage libdash 2.1
+
+libdash is a library that provides an object orient (OO) interface to the MPEG-DASH standard.
+
+## Features
+
+- Cross platform build system based on cmake that includes Windows, Linux and Mac.
+- Open source available and licensed under the LGPL.
+- Implements the full MPEG-DASH standard according to ISO/IEC 23009-1, Information Technology Dynamic Adaptive Streaming over HTTP (DASH) Part 1: Media Presentation Description and Segment Formats
+- Handles the download and xml parsing of the MPD. Based on that it provides an OO based interface to the MPD.
+- Media elements, e.g., SegmentURL, SegmentTemplate, etc., are downloadable in that OO based structure and can be downloaded through libdash, which internally uses libcurl.
+- Therefore basically all protocols that libcurl supports, e.g., HTTP, FTP, etc. are supported by libdash.
+- However it also provides a configurable download interface, which enables the use of external connections that can be implemented by the user of the library for the download of media segments.
+- The use of such external connections will be shown in the libdash_networkpart_test project which is part of libdash solution and also part of the cross platform cmake system and therefore usable on Windows, Linux and Mac.
+- The project contains a sample multimedia player that is based on ffmpeg which uses libdash for the playback of one of our dataset MPDs.
+- The development is based on Windows, therefore the code contains a VS10 solution with additional tests and the sample multimedia player.
+
+## Architecture
+<p align="justify">The general architecture of MPEG-DASH is depicted in the figure below where the orange parts are standardized, i.e., the MPD and segment formats. The delivery of the MPD, the control heuristics and the media player itself, are depicted in blue in the figure. These parts are not standardized and allow the differentiation of industry solutions due to the performance or different features that can be integrated at that level. libdash is also depicted in blue and encapsulates the MPD parsing and HTTP part, which will be handled by the library. Therefore the library provides interfaces for the DASH Streaming Control and the Media Player to access MPDs and downloadable media segments. The download order of such media segments will not be handled by the library this is left to the DASH Streaming Control, which is an own component in this architecture but it could also be included in the Media Player.
+</p>
+<p align="justify">
+In a typical deployment, a DASH server provides segments in several bitrates and resolutions. The client initially receives the MPD through libdash which provides a convenient object orient interface to that MPD. The MPD contains the temporal relationships for the various qualities and segments. Based on that information the client can download individual media segments through libdash at any point in time. Therefore varying bandwidth conditions can be handled by switching to the corresponding quality level at segment boundaries in order to provide a smooth streaming experience. This adaptation is not part of libdash and the MPEG-DASH standard and will be left to the application which is using libdash.
+</p>
+
+
+![libdash architecture](http://www.bitmovin.net/wp-content/uploads/2013/01/libdash_arch-1024x483.png "libdash arch")
+
+## Mailinglist
+
+We offer a public accessible mailing list for discussions, questions, announcements, bug-reports, etc. around libdash. Everybody is invited to join, you can find the registration at:
+
+[libdash-dev] (http://vicky.bitmovin.net/mailman/listinfo/libdash-dev)
+
+There are a lot of things to do! So everybody is invited to contribute, to get involved in and exited about DASH!
+
+## Sources and Binaries
+
+You can find the latest sources and binaries in our [download section] (http://www.bitmovin.net/?page_id=851) and on github.
+
+## How to use
+
+### Windows
+1. Download the tarball or clone the repository from gitlab (git://github.com/bitmovin/libdash.git)
+2. Open the libdash.sln with Visual Studio 2010
+3. Build the solution
+4. After that all files will be provided in the bin folder
+5. You can test the library with the sampleplayer.exe. This application simply downloads the lowest representation of one of our dataset MPDs.
+
+### Ubuntu 12.04
+1. sudo apt-get install git-core build-essential cmake libxml2-dev libcurl4-openssl-dev
+2. git clone git://github.com/bitmovin/libdash.git
+3. cd libdash/libdash
+4. mkdir build
+5. cd build
+6. cmake ../
+7. make
+8. cd bin
+9. The library and a simple test of the network part of the library should be available now. You can test the network part of the library with
+10. ./libdash_networpart_test
+
+## License
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+## Professional Services
+
+In addition to the public available open source resources and the mailing list support, we provide professional development and integration services, consulting, high-quality streaming componentes/logics, etc. based on your individual needs. Feel free to contact us via sales@bitmovin.net so we can discuss your requirements and provide you an offer.
+
+## Acknowledgements
+
+We specially want to thank our passionate developers at [bitmovin](http://www.bitmovin.net/) as well as the researchers at the [Institute of Information Technology](http://www-itec.aau.at/dash/) (ITEC) from the Alpen Adria Universitaet Klagenfurt (AAU)!
+
+Furthermore we want to thank the [Netidee](http://www.netidee.at) initiative from the [Internet Foundation Austria](http://www.nic.at/ipa) for partially funding the open source development of libdash.
+
+## Citation of libdash
+We kindly ask you to refer the following paper in any publication mentioning libdash:
+
+Christopher Mueller and Christian Timmerer. 2011. A VLC media player plugin enabling dynamic adaptive streaming over HTTP. In Proceedings of the 19th ACM international conference on Multimedia (MM '11). ACM, New York, NY, USA, 723-726. DOI=10.1145/2072298.2072429 [[pdf]](http://doi.acm.org/10.1145/2072298.2072429)
+
+*/ \ No newline at end of file
diff --git a/libdash/source/defaults.mk b/libdash/source/defaults.mk
new file mode 100644
index 00000000..d446c620
--- /dev/null
+++ b/libdash/source/defaults.mk
@@ -0,0 +1,7 @@
+LIBNAME=libdash
+CC=g++
+AR=ar
+LD=g++
+ARFLAGS=-cr
+CFLAGS=-fPIC -c -Wall #-DDEBUG
+LDFLAGS=-shared -Wl,-soname,$(LIBNAME).so
diff --git a/libdash/source/dllmain.cpp b/libdash/source/dllmain.cpp
new file mode 100644
index 00000000..b624228b
--- /dev/null
+++ b/libdash/source/dllmain.cpp
@@ -0,0 +1,33 @@
+/*
+ * dllmain.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.
+ *****************************************************************************/
+
+#if defined _WIN32 || defined _WIN64
+
+#include "targetver.h"
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+#endif
diff --git a/libdash/source/helpers/Block.h b/libdash/source/helpers/Block.h
new file mode 100644
index 00000000..c71462e8
--- /dev/null
+++ b/libdash/source/helpers/Block.h
@@ -0,0 +1,59 @@
+/*
+ * Block.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 __BLOCK_H__
+#define __BLOCK_H__
+
+#include "config.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ struct block_t
+ {
+ uint8_t *data;
+ size_t len;
+ float millisec;
+ size_t offset;
+ };
+
+ static inline block_t* AllocBlock (size_t len)
+ {
+ block_t *block = (block_t *)malloc(sizeof(block_t));
+ block->data = new uint8_t[len];
+ block->len = len;
+ block->millisec = 0;
+ block->offset = 0;
+ return block;
+ }
+ static inline void DeleteBlock (block_t *block)
+ {
+ if(block)
+ {
+ delete [] block->data;
+ free(block);
+ block = NULL;
+ }
+ }
+ static inline block_t* DuplicateBlock (block_t *block)
+ {
+ block_t *ret = AllocBlock(block->len);
+ ret->offset = block->offset;
+
+ memcpy(ret->data, block->data, ret->len);
+
+ return block;
+ }
+ }
+}
+
+#endif
diff --git a/libdash/source/helpers/BlockStream.cpp b/libdash/source/helpers/BlockStream.cpp
new file mode 100644
index 00000000..fd34f88e
--- /dev/null
+++ b/libdash/source/helpers/BlockStream.cpp
@@ -0,0 +1,290 @@
+/*
+ * BlockStream.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 "BlockStream.h"
+#include <limits>
+
+using namespace dash::helpers;
+
+BlockStream::BlockStream () :
+ length (0)
+{
+}
+BlockStream::~BlockStream ()
+{
+ this->Clear();
+}
+
+void BlockStream::PopAndDeleteFront ()
+{
+ if(this->blockqueue.empty())
+ return;
+
+ this->length -= this->blockqueue.front()->len;
+ DeleteBlock(this->blockqueue.front());
+ this->blockqueue.pop_front();
+}
+void BlockStream::PushBack (block_t *block)
+{
+ this->length += block->len;
+ this->blockqueue.push_back(block);
+}
+void BlockStream::PushFront (block_t *block)
+{
+ this->length += block->len;
+ this->blockqueue.push_front(block);
+}
+const block_t* BlockStream::GetBytes (uint32_t len)
+{
+ /* Performance Intensive */
+ if(this->length < len)
+ return NULL;
+
+ block_t *block = AllocBlock(len);
+ this->BlockQueueGetBytes(block->data, block->len);
+
+ this->length -= len;
+
+ return block;
+}
+size_t BlockStream::GetBytes (uint8_t *data, size_t len)
+{
+ /* Performance Intensive */
+ if(len > this->length)
+ len = (size_t) this->length;
+
+ this->BlockQueueGetBytes(data, len);
+
+ this->length -= len;
+
+ return len;
+}
+size_t BlockStream::PeekBytes (uint8_t *data, size_t len)
+{
+ /* Performance Intensive */
+ if(len > this->length)
+ len = (size_t) this->length;
+
+ this->BlockQueuePeekBytes(data, len, 0);
+
+ return len;
+}
+size_t BlockStream::PeekBytes (uint8_t *data, size_t len, size_t offset)
+{
+ /* Performance Intensive */
+ if(len > this->length)
+ len = (size_t) this->length;
+
+ if (offset + len > this->length)
+ len = (size_t) (this->length - offset);
+
+ this->BlockQueuePeekBytes(data, len, offset);
+
+ return len;
+}
+uint64_t BlockStream::Length () const
+{
+ return this->length;
+}
+const block_t* BlockStream::GetFront ()
+{
+ if(this->blockqueue.empty())
+ return NULL;
+
+ const block_t* ret = this->blockqueue.front();
+ this->length -= ret->len;
+ this->blockqueue.pop_front();
+
+ return ret;
+}
+const block_t* BlockStream::Front () const
+{
+ if(this->blockqueue.empty())
+ return NULL;
+
+ return this->blockqueue.front();
+}
+bool BlockStream::BlockQueueGetBytes (uint8_t *data, uint32_t len)
+{
+ uint32_t pos = 0;
+
+ block_t *block = NULL;
+
+ while(pos < len)
+ {
+ block = this->blockqueue.front();
+ if((len - pos) < (block->len))
+ {
+ memcpy(data + pos, block->data, len - pos);
+
+ this->blockqueue.pop_front();
+
+ block_t* newfront = AllocBlock(block->len - (len - pos));
+ memcpy(newfront->data, block->data + (len - pos), newfront->len);
+
+ DeleteBlock(block);
+ this->blockqueue.push_front(newfront);
+
+ return true;
+ }
+ else
+ {
+ memcpy(data + pos, block->data, block->len);
+ pos += block->len;
+
+ DeleteBlock(block);
+ this->blockqueue.pop_front();
+ }
+ }
+
+ return false;
+}
+bool BlockStream::BlockQueuePeekBytes (uint8_t *data, uint32_t len, size_t offset)
+{
+ uint32_t pos = 0;
+ int cnt = 0;
+
+ const block_t *block = NULL;
+
+ while(pos < len)
+ {
+ block = this->blockqueue.at(cnt);
+ if((offset + len - pos) < (block->len))
+ {
+ memcpy(data + pos, block->data + offset, len - pos - offset);
+ return true;
+ }
+ else
+ {
+ memcpy(data + pos, block->data + offset, block->len - offset);
+ pos += block->len;
+ }
+
+ cnt++;
+ }
+
+ return false;
+}
+uint8_t BlockStream::ByteAt (uint64_t position) const
+{
+ if(position > this->length)
+ return -1;
+
+ uint64_t pos = 0;
+
+ for(size_t i = 0; i < this->blockqueue.size(); i++)
+ {
+ const block_t *block = this->blockqueue.at(i);
+
+ if(pos + block->len > position)
+ return block->data[position - pos];
+ else
+ pos += block->len;
+ }
+
+ return -1;
+}
+const block_t* BlockStream::ToBlock ()
+{
+ if(this->length > std::numeric_limits<size_t>::max())
+ return NULL;
+
+ return BlockStream::GetBytes((size_t)this->length);
+}
+void BlockStream::Clear ()
+{
+ while(!this->blockqueue.empty())
+ {
+ DeleteBlock(this->blockqueue.front());
+ this->blockqueue.pop_front();
+ }
+
+ this->length = 0;
+}
+void BlockStream::EraseFront (uint64_t len)
+{
+ if(len > this->length)
+ len = this->length;
+
+ uint64_t actLen = 0;
+
+ while(actLen < len)
+ {
+ if(this->blockqueue.size() == 0)
+ return;
+
+ block_t *front = this->blockqueue.front();
+
+ if((actLen + front->len) <= len)
+ {
+ this->length -= front->len;
+ actLen += front->len;
+
+ DeleteBlock(front);
+ this->blockqueue.pop_front();
+ }
+ else
+ {
+ uint32_t diff = (uint32_t) (len - actLen);
+ this->length -= diff;
+ actLen += diff;
+ block_t* newfront = AllocBlock(front->len - diff);
+
+ memcpy(newfront->data, front->data + diff, newfront->len);
+
+ DeleteBlock(front);
+ this->blockqueue.pop_front();
+ this->blockqueue.push_front(newfront);
+ }
+ }
+}
+BlockStream* BlockStream::GetBlocks (uint64_t len)
+{
+ if(len > this->length)
+ return NULL;
+
+ BlockStream *blocks = new BlockStream();
+
+ uint64_t actLen = 0;
+
+ while(actLen < len)
+ {
+ block_t *front = this->blockqueue.front();
+
+ if((actLen + front->len) <= len)
+ {
+ this->length -= front->len;
+ actLen += front->len;
+
+ blocks->PushBack(front);
+ this->blockqueue.pop_front();
+ }
+ else
+ {
+ uint32_t diff = (uint32_t) (len - actLen);
+ this->length -= diff;
+ actLen += diff;
+ block_t *block = AllocBlock(diff);
+ block_t* newfront = AllocBlock(front->len - diff);
+
+ memcpy(block->data, front->data, diff);
+ blocks->PushBack(block);
+
+ memcpy(newfront->data, front->data+ diff, newfront->len);
+
+ DeleteBlock(front);
+ this->blockqueue.pop_front();
+ this->blockqueue.push_front(newfront);
+ }
+ }
+
+ return blocks;
+}
diff --git a/libdash/source/helpers/BlockStream.h b/libdash/source/helpers/BlockStream.h
new file mode 100644
index 00000000..4b8b3fd5
--- /dev/null
+++ b/libdash/source/helpers/BlockStream.h
@@ -0,0 +1,55 @@
+/*
+ * BlockStream.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 __BLOCKSTREAM_H__
+#define __BLOCKSTREAM_H__
+
+#include "config.h"
+
+#include "Block.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ class BlockStream
+ {
+ public:
+ BlockStream ();
+ virtual ~BlockStream ();
+
+ virtual void PushBack (block_t *block);
+ virtual void PushFront (block_t *block);
+ virtual const block_t* GetBytes (uint32_t len);
+ virtual size_t GetBytes (uint8_t *data, size_t len);
+ virtual size_t PeekBytes (uint8_t *data, size_t len);
+ virtual size_t PeekBytes (uint8_t *data, size_t len, size_t offset);
+ virtual const block_t* GetFront ();
+ virtual const block_t* Front () const;
+ virtual uint64_t Length () const;
+ virtual uint8_t ByteAt (uint64_t position) const;
+ virtual const block_t* ToBlock ();
+ virtual void Clear ();
+ virtual void EraseFront (uint64_t len);
+ virtual BlockStream* GetBlocks (uint64_t len);
+ virtual void PopAndDeleteFront ();
+
+ protected:
+ uint64_t length;
+ std::deque<block_t *> blockqueue;
+
+ virtual bool BlockQueueGetBytes (uint8_t *data, uint32_t len);
+ virtual bool BlockQueuePeekBytes (uint8_t *data, uint32_t len, size_t offset);
+ };
+ }
+}
+
+#endif // __BLOCKSTREAM_H__ \ No newline at end of file
diff --git a/libdash/source/helpers/Path.cpp b/libdash/source/helpers/Path.cpp
new file mode 100644
index 00000000..301d9fa0
--- /dev/null
+++ b/libdash/source/helpers/Path.cpp
@@ -0,0 +1,118 @@
+/*
+ * Path.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 "Path.h"
+
+using namespace dash::helpers;
+
+std::string Path::CombinePaths (const std::string &path1, const std::string &path2)
+{
+ if(path1 == "")
+ return path2;
+ if(path2 == "")
+ return path1;
+
+ char path1Last = path1.at(path1.size() - 1);
+ char path2First = path2.at(0);
+
+ if(path1Last == '/' && path2First == '/')
+ return path1 + path2.substr(1, path2.size());
+
+ if(path1Last != '/' && path2First != '/')
+ return path1 + "/" + path2;
+
+ return path1 + path2;
+}
+std::string Path::GetDirectoryPath (const std::string &path)
+{
+ int pos = path.find_last_of('/');
+
+ return path.substr(0, pos);
+}
+std::vector<std::string> Path::Split (const std::string &s, char delim)
+{
+ std::stringstream ss(s);
+ std::string item;
+ std::vector<std::string> ret;
+
+ while(std::getline(ss, item, delim))
+ ret.push_back(item);
+
+ return ret;
+}
+bool Path::GetHostPortAndPath (const std::string &url, std::string &host, size_t &port, std::string& path)
+{
+ std::string hostPort = "";
+ size_t found = 0;
+ size_t pathBegin = 0;
+
+ if (url.substr(0,7) == "http://" || url.substr(0,8) == "https://")
+ {
+ found = url.find("//");
+ pathBegin = url.find('/', found+2);
+ path = url.substr(pathBegin, std::string::npos);
+
+ hostPort = url.substr(found+2, pathBegin - (found+2));
+ found = hostPort.find(':');
+ if (found != std::string::npos)
+ {
+ port = strtoul(hostPort.substr(found+1, std::string::npos).c_str(), NULL, 10);
+ }
+ host = hostPort.substr(0, found);
+ return (host.size() > 0) && (path.size() > 0);
+ }
+ else if(url.substr(0,5) == "ndn:/")
+ {
+ found = url.find("/");
+ pathBegin = url.find('/', found+1);
+ path = url.substr(pathBegin, std::string::npos);
+
+ hostPort = url.substr(found+1, pathBegin - (found+1));
+ found = hostPort.find(':');
+ if (found != std::string::npos)
+ {
+ port = strtoul(hostPort.substr(found+1, std::string::npos).c_str(), NULL, 10);
+ }
+ host = hostPort.substr(0, found);
+ return (host.size() > 0) && (path.size() > 0);
+ }
+ else if(url.substr(0,6) == "ccnx:/")
+ {
+ found = url.find("/");
+ pathBegin = url.find('/', found+1);
+ path = url.substr(pathBegin, std::string::npos);
+
+ hostPort = url.substr(found+1, pathBegin - (found+1));
+ found = hostPort.find(':');
+ if (found != std::string::npos)
+ {
+ port = strtoul(hostPort.substr(found+1, std::string::npos).c_str(), NULL, 10);
+ }
+ host = hostPort.substr(0, found);
+ return (host.size() > 0) && (path.size() > 0);
+ }
+
+ return false;
+}
+bool Path::GetStartAndEndBytes (const std::string &byteRange, size_t &startByte, size_t &endByte)
+{
+ size_t found = 0;
+
+ found = byteRange.find('-');
+ if (found != std::string::npos && found < byteRange.size()-1 )
+ {
+ startByte = strtoul(byteRange.substr(0, found).c_str(), NULL, 10);
+ endByte = strtoul(byteRange.substr(found+1, std::string::npos).c_str(), NULL, 10);
+ return (startByte <= endByte);
+ }
+
+ return false;
+}
diff --git a/libdash/source/helpers/Path.h b/libdash/source/helpers/Path.h
new file mode 100644
index 00000000..1c791baa
--- /dev/null
+++ b/libdash/source/helpers/Path.h
@@ -0,0 +1,33 @@
+/*
+ * Path.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 PATH_H_
+#define PATH_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ class Path
+ {
+ public:
+ static std::string CombinePaths (const std::string &path1, const std::string &path2);
+ static std::string GetDirectoryPath (const std::string &path);
+ static std::vector<std::string> Split (const std::string &s, char delim);
+ static bool GetHostPortAndPath (const std::string &url, std::string &host, size_t &port, std::string& path);
+ static bool GetStartAndEndBytes (const std::string &byteRange, size_t &startByte, size_t &endByte);
+ };
+ }
+}
+
+#endif /* PATH_H_ */ \ No newline at end of file
diff --git a/libdash/source/helpers/String.cpp b/libdash/source/helpers/String.cpp
new file mode 100644
index 00000000..53da5592
--- /dev/null
+++ b/libdash/source/helpers/String.cpp
@@ -0,0 +1,53 @@
+/*
+ * String.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 "String.h"
+
+using namespace dash::helpers;
+
+void String::Split (const std::string &s, char delim, std::vector<std::string>& vector)
+{
+ std::stringstream ss(s);
+ std::string item;
+
+ while(std::getline(ss, item, delim))
+ vector.push_back(item);
+}
+void String::Split (const std::string &s, char delim, std::vector<uint32_t>& vector)
+{
+ size_t lengthOfString = s.length();
+ size_t pos = 0;
+ size_t i = 0;
+ uint32_t level = 0;
+
+ while (pos != std::string::npos)
+ {
+ pos = s.find(delim, i);
+
+ if (i < lengthOfString)
+ {
+ level = strtoul(s.substr(i, pos-i).c_str(), NULL, 10);
+ vector.push_back(level);
+ i = pos + 1;
+ }
+ }
+}
+bool String::ToBool (const std::string &s)
+{
+ if (s == "true" || s == "True" || s == "TRUE")
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/libdash/source/helpers/String.h b/libdash/source/helpers/String.h
new file mode 100644
index 00000000..73ac6db8
--- /dev/null
+++ b/libdash/source/helpers/String.h
@@ -0,0 +1,31 @@
+/*
+ * String.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 STRING_H_
+#define STRING_H_
+
+#include "config.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ class String
+ {
+ public:
+ static void Split (const std::string &s, char delim, std::vector<std::string>& vector);
+ static void Split (const std::string &s, char delim, std::vector<uint32_t>& vector);
+ static bool ToBool (const std::string &s);
+ };
+ }
+}
+
+#endif /* STRING_H_ */ \ No newline at end of file
diff --git a/libdash/source/helpers/SyncedBlockStream.cpp b/libdash/source/helpers/SyncedBlockStream.cpp
new file mode 100644
index 00000000..84fa63cf
--- /dev/null
+++ b/libdash/source/helpers/SyncedBlockStream.cpp
@@ -0,0 +1,250 @@
+/*
+ * SyncedBlockStream.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 "SyncedBlockStream.h"
+
+using namespace dash::helpers;
+
+SyncedBlockStream::SyncedBlockStream () :
+ eos (false)
+{
+ InitializeConditionVariable (&this->full);
+ InitializeCriticalSection (&this->monitorMutex);
+}
+SyncedBlockStream::~SyncedBlockStream ()
+{
+ DeleteConditionVariable(&this->full);
+ DeleteCriticalSection(&this->monitorMutex);
+}
+
+void SyncedBlockStream::PopAndDeleteFront ()
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ BlockStream::PopAndDeleteFront();
+
+ LeaveCriticalSection(&this->monitorMutex);
+}
+void SyncedBlockStream::PushBack (block_t *block)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ BlockStream::PushBack(block);
+
+ WakeAllConditionVariable(&this->full);
+ LeaveCriticalSection(&this->monitorMutex);
+}
+void SyncedBlockStream::PushFront (block_t *block)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ BlockStream::PushFront(block);
+
+ WakeAllConditionVariable(&this->full);
+ LeaveCriticalSection(&this->monitorMutex);
+}
+const block_t* SyncedBlockStream::GetBytes (uint32_t len)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ const block_t* block = BlockStream::GetBytes(len);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return block;
+}
+size_t SyncedBlockStream::GetBytes (uint8_t *data, size_t len)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return 0;
+ }
+
+ size_t ret = BlockStream::GetBytes(data, len);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return ret;
+}
+size_t SyncedBlockStream::PeekBytes (uint8_t *data, size_t len)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return 0;
+ }
+
+ size_t ret = BlockStream::PeekBytes(data, len);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return ret;
+}
+size_t SyncedBlockStream::PeekBytes (uint8_t *data, size_t len, size_t offset)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while((this->length == 0 || offset >= this->length) && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0 || offset >= this->length)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return 0;
+ }
+
+ size_t ret = BlockStream::PeekBytes(data, len, offset);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return ret;
+}
+uint64_t SyncedBlockStream::Length () const
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ uint64_t len = BlockStream::Length();
+
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return len;
+}
+const block_t* SyncedBlockStream::GetFront ()
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ const block_t* block = BlockStream::GetFront();
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return block;
+}
+const block_t* SyncedBlockStream::Front () const
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ const block_t* block = BlockStream::Front();
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return block;
+}
+uint8_t SyncedBlockStream::ByteAt (uint64_t position) const
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length < position && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length < position)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return 0;
+ }
+
+ uint8_t ret = BlockStream::ByteAt(position);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return ret;
+}
+const block_t* SyncedBlockStream::ToBlock ()
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ const block_t* block = BlockStream::ToBlock();
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return block;
+}
+void SyncedBlockStream::Clear ()
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ BlockStream::Clear();
+
+ LeaveCriticalSection(&this->monitorMutex);
+}
+void SyncedBlockStream::EraseFront (uint64_t len)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ BlockStream::EraseFront(len);
+
+ LeaveCriticalSection(&this->monitorMutex);
+}
+BlockStream* SyncedBlockStream::GetBlocks (uint64_t len)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ while(this->length == 0 && !this->eos)
+ SleepConditionVariableCS(&this->full, &this->monitorMutex, INFINITE);
+
+ if(this->length == 0)
+ {
+ LeaveCriticalSection(&this->monitorMutex);
+ return NULL;
+ }
+
+ BlockStream *stream = BlockStream::GetBlocks(len);
+ LeaveCriticalSection(&this->monitorMutex);
+
+ return stream;
+}
+void SyncedBlockStream::SetEOS (bool value)
+{
+ EnterCriticalSection(&this->monitorMutex);
+
+ this->eos = value;
+
+ WakeAllConditionVariable(&this->full);
+ LeaveCriticalSection(&this->monitorMutex);
+}
diff --git a/libdash/source/helpers/SyncedBlockStream.h b/libdash/source/helpers/SyncedBlockStream.h
new file mode 100644
index 00000000..9e266c60
--- /dev/null
+++ b/libdash/source/helpers/SyncedBlockStream.h
@@ -0,0 +1,57 @@
+/*
+ * SyncedBlockStream.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 __SYNCEDBLOCKSTREAM_H__
+#define __SYNCEDBLOCKSTREAM_H__
+
+#include "config.h"
+
+#include "BlockStream.h"
+#include "../portable/MultiThreading.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ class SyncedBlockStream : public BlockStream
+ {
+ public:
+ SyncedBlockStream ();
+ virtual ~SyncedBlockStream ();
+
+ virtual void PushBack (block_t *block);
+ virtual void PushFront (block_t *block);
+ virtual const block_t* GetBytes (uint32_t len);
+ virtual size_t GetBytes (uint8_t *data, size_t len);
+ virtual size_t PeekBytes (uint8_t *data, size_t len);
+ virtual size_t PeekBytes (uint8_t *data, size_t len, size_t offset);
+ virtual const block_t* GetFront ();
+ virtual const block_t* Front () const;
+ virtual uint64_t Length () const;
+ virtual uint8_t ByteAt (uint64_t position) const;
+ virtual const block_t* ToBlock ();
+ virtual void Clear ();
+ virtual void EraseFront (uint64_t len);
+ virtual BlockStream* GetBlocks (uint64_t len);
+ virtual void PopAndDeleteFront ();
+ virtual void SetEOS (bool value);
+
+ private:
+ bool eos;
+
+ mutable CRITICAL_SECTION monitorMutex;
+ mutable CONDITION_VARIABLE full;
+
+ };
+ }
+}
+
+#endif // __SYNCEDBLOCKSTREAM_H__ \ No newline at end of file
diff --git a/libdash/source/helpers/Time.cpp b/libdash/source/helpers/Time.cpp
new file mode 100644
index 00000000..e6ca2b81
--- /dev/null
+++ b/libdash/source/helpers/Time.cpp
@@ -0,0 +1,33 @@
+/*
+ * Time.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 "Time.h"
+
+using namespace dash::helpers;
+
+uint32_t Time::GetCurrentUTCTimeInSec ()
+{
+ return mktime(Time::GetCurrentUTCTime());
+}
+std::string Time::GetCurrentUTCTimeStr ()
+{
+ char timeString[30];
+ strftime(timeString, 30, "%Y-%m-%dT%H:%M:%SZ", Time::GetCurrentUTCTime());
+
+ return std::string(timeString);
+}
+struct tm* Time::GetCurrentUTCTime ()
+{
+ time_t rawTime;
+
+ time(&rawTime);
+ return gmtime(&rawTime);
+}
diff --git a/libdash/source/helpers/Time.h b/libdash/source/helpers/Time.h
new file mode 100644
index 00000000..e7de0cd9
--- /dev/null
+++ b/libdash/source/helpers/Time.h
@@ -0,0 +1,35 @@
+/*
+ * Time.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 DASH_HELPERS_TIME_H_
+#define DASH_HELPERS_TIME_H_
+
+#include <time.h>
+#include "config.h"
+
+namespace dash
+{
+ namespace helpers
+ {
+ class Time
+ {
+ public:
+ static uint32_t GetCurrentUTCTimeInSec ();
+ static std::string GetCurrentUTCTimeStr ();
+
+ private:
+ static struct tm* GetCurrentUTCTime ();
+
+ };
+ }
+}
+
+#endif /* DASH_HELPERS_TIME_H_ */
diff --git a/libdash/source/libdash.cpp b/libdash/source/libdash.cpp
new file mode 100644
index 00000000..f26c8224
--- /dev/null
+++ b/libdash/source/libdash.cpp
@@ -0,0 +1,20 @@
+/*
+ * libdash.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 "../include/libdash.h"
+#include "manager/DASHManager.h"
+
+using namespace dash;
+
+__declspec(dllexport) IDASHManager* __cdecl CreateDashManager()
+{
+ return new DASHManager();
+} \ No newline at end of file
diff --git a/libdash/source/manager/DASHManager.cpp b/libdash/source/manager/DASHManager.cpp
new file mode 100644
index 00000000..7650111e
--- /dev/null
+++ b/libdash/source/manager/DASHManager.cpp
@@ -0,0 +1,45 @@
+/*
+ * DASHManager.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 "DASHManager.h"
+
+using namespace dash;
+using namespace dash::xml;
+using namespace dash::mpd;
+using namespace dash::network;
+using namespace dash::helpers;
+
+DASHManager::DASHManager ()
+{
+}
+DASHManager::~DASHManager ()
+{
+}
+IMPD* DASHManager::Open (char *path, std::string mUrl)
+{
+ DOMParser parser(path);
+
+ uint32_t fetchTime = Time::GetCurrentUTCTimeInSec();
+
+ if (!parser.Parse(mUrl))
+ return NULL;
+
+ MPD* mpd = parser.GetRootNode()->ToMPD();
+
+ if (mpd)
+ mpd->SetFetchTime(fetchTime);
+
+ return mpd;
+}
+void DASHManager::Delete ()
+{
+ delete this;
+}
diff --git a/libdash/source/manager/DASHManager.h b/libdash/source/manager/DASHManager.h
new file mode 100644
index 00000000..99ef188b
--- /dev/null
+++ b/libdash/source/manager/DASHManager.h
@@ -0,0 +1,35 @@
+/*
+ * DASHManager.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 DASHMANAGER_H_
+#define DASHMANAGER_H_
+
+#include "config.h"
+
+#include "../xml/Node.h"
+#include "../xml/DOMParser.h"
+#include "IDASHManager.h"
+#include "../helpers/Time.h"
+
+namespace dash
+{
+ class DASHManager : public IDASHManager
+ {
+ public:
+ DASHManager ();
+ virtual ~DASHManager ();
+
+ mpd::IMPD* Open (char *path, std::string mUrl = "");
+ void Delete ();
+ };
+}
+
+#endif /* DASHMANAGER_H_ */
diff --git a/libdash/source/metrics/HTTPTransaction.cpp b/libdash/source/metrics/HTTPTransaction.cpp
new file mode 100644
index 00000000..2767b514
--- /dev/null
+++ b/libdash/source/metrics/HTTPTransaction.cpp
@@ -0,0 +1,122 @@
+/*
+ * HTTPTransaction.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 "HTTPTransaction.h"
+
+using namespace dash::metrics;
+
+HTTPTransaction::HTTPTransaction () :
+ tcpId (0),
+ type (dash::metrics::Other),
+ responseCode (0),
+ interval (0),
+ url (""),
+ actualUrl (""),
+ range (""),
+ tRequest (""),
+ tResponse (""),
+ httpHeader ("")
+{
+}
+HTTPTransaction::~HTTPTransaction()
+{
+ for (size_t i = 0; i < trace.size(); i++)
+ delete trace.at(i);
+}
+
+uint32_t HTTPTransaction::TCPId () const
+{
+ return this->tcpId;
+}
+void HTTPTransaction::SetTCPId (uint32_t tcpId)
+{
+ this->tcpId = tcpId;
+}
+HTTPTransactionType HTTPTransaction::Type () const
+{
+ return this->type;
+}
+void HTTPTransaction::SetType (HTTPTransactionType type)
+{
+ this->type = type;
+}
+const std::string& HTTPTransaction::OriginalUrl () const
+{
+ return this->url;
+}
+void HTTPTransaction::SetOriginalUrl (const std::string& origUrl)
+{
+ this->url = origUrl;
+}
+const std::string& HTTPTransaction::ActualUrl () const
+{
+ return this->actualUrl;
+}
+void HTTPTransaction::SetActualUrl (const std::string& actUrl)
+{
+ this->actualUrl = actUrl;
+}
+const std::string& HTTPTransaction::Range () const
+{
+ return this->range;
+}
+void HTTPTransaction::SetRange (const std::string& range)
+{
+ this->range = range;
+}
+const std::string& HTTPTransaction::RequestSentTime () const
+{
+ return this->tRequest;
+}
+void HTTPTransaction::SetRequestSentTime (std::string tRequest)
+{
+ this->tRequest = tRequest;
+}
+const std::string& HTTPTransaction::ResponseReceivedTime () const
+{
+ return this->tResponse;
+}
+void HTTPTransaction::SetResponseReceivedTime (std::string tResponse)
+{
+ this->tResponse = tResponse;
+}
+uint16_t HTTPTransaction::ResponseCode () const
+{
+ return this->responseCode;
+}
+void HTTPTransaction::SetResponseCode (uint16_t respCode)
+{
+ this->responseCode = respCode;
+}
+uint64_t HTTPTransaction::Interval () const
+{
+ return this->interval;
+}
+void HTTPTransaction::SetInterval (uint64_t interval)
+{
+ this->interval = interval;
+}
+const std::vector<IThroughputMeasurement *>& HTTPTransaction::ThroughputTrace () const
+{
+ return (std::vector<IThroughputMeasurement *> &) this->trace;
+}
+void HTTPTransaction::AddThroughputMeasurement (ThroughputMeasurement *throuputEntry)
+{
+ this->trace.push_back(throuputEntry);
+}
+const std::string& HTTPTransaction::HTTPHeader () const
+{
+ return this->httpHeader;
+}
+void HTTPTransaction::AddHTTPHeaderLine (std::string headerLine)
+{
+ this->httpHeader.append(headerLine);
+}
diff --git a/libdash/source/metrics/HTTPTransaction.h b/libdash/source/metrics/HTTPTransaction.h
new file mode 100644
index 00000000..77c69234
--- /dev/null
+++ b/libdash/source/metrics/HTTPTransaction.h
@@ -0,0 +1,68 @@
+/*
+ * HTTPTransaction.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 HTTPTRANSACTION_H_
+#define HTTPTRANSACTION_H_
+
+#include "IHTTPTransaction.h"
+#include "ThroughputMeasurement.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class HTTPTransaction : public IHTTPTransaction
+ {
+ public:
+ HTTPTransaction ();
+ virtual ~HTTPTransaction ();
+
+ uint32_t TCPId () const;
+ HTTPTransactionType Type () const;
+ const std::string& OriginalUrl () const;
+ const std::string& ActualUrl () const;
+ const std::string& Range () const;
+ const std::string& RequestSentTime () const;
+ const std::string& ResponseReceivedTime () const;
+ uint16_t ResponseCode () const;
+ uint64_t Interval () const;
+ const std::vector<IThroughputMeasurement *>& ThroughputTrace () const;
+ const std::string& HTTPHeader () const;
+
+ void SetTCPId (uint32_t tcpId);
+ void SetType (HTTPTransactionType type);
+ void SetOriginalUrl (const std::string& origUrl);
+ void SetActualUrl (const std::string& actUrl);
+ void SetRange (const std::string& range);
+ void SetRequestSentTime (std::string tRequest);
+ void SetResponseReceivedTime (std::string tResponse);
+ void SetResponseCode (uint16_t respCode);
+ void SetInterval (uint64_t interval);
+ void AddThroughputMeasurement (ThroughputMeasurement *throuputEntry);
+ void AddHTTPHeaderLine (std::string headerLine);
+
+ private:
+ uint32_t tcpId;
+ HTTPTransactionType type;
+ std::string url;
+ std::string actualUrl;
+ std::string range;
+ std::string tRequest;
+ std::string tResponse;
+ uint16_t responseCode;
+ uint64_t interval;
+ std::vector<ThroughputMeasurement *> trace;
+ std::string httpHeader;
+ };
+ }
+}
+
+#endif /* HTTPTRANSACTION_H_ */
diff --git a/libdash/source/metrics/TCPConnection.cpp b/libdash/source/metrics/TCPConnection.cpp
new file mode 100644
index 00000000..581b0539
--- /dev/null
+++ b/libdash/source/metrics/TCPConnection.cpp
@@ -0,0 +1,62 @@
+/*
+ * TCPConnection.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 "TCPConnection.h"
+
+using namespace dash::metrics;
+
+TCPConnection::TCPConnection ()
+{
+}
+TCPConnection::~TCPConnection()
+{
+}
+
+uint32_t TCPConnection::TCPId () const
+{
+ return this->tcpId;
+}
+void TCPConnection::SetTCPId (uint32_t tcpId)
+{
+ this->tcpId = tcpId;
+}
+const std::string& TCPConnection::DestinationAddress () const
+{
+ return this->dest;
+}
+void TCPConnection::SetDestinationAddress (const std::string& destAddress)
+{
+ this->dest = destAddress;
+}
+const std::string& TCPConnection::ConnectionOpenedTime () const
+{
+ return this->tOpen;
+}
+void TCPConnection::SetConnectionOpenedTime (std::string tOpen)
+{
+ this->tOpen = tOpen;
+}
+const std::string& TCPConnection::ConnectionClosedTime () const
+{
+ return this->tClose;
+}
+void TCPConnection::SetConnectionClosedTime (std::string tClose)
+{
+ this->tClose = tClose;
+}
+uint64_t TCPConnection::ConnectionTime () const
+{
+ return this->tConnect;
+}
+void TCPConnection::SetConnectionTime (uint64_t tConnect)
+{
+ this->tConnect = tConnect;
+}
diff --git a/libdash/source/metrics/TCPConnection.h b/libdash/source/metrics/TCPConnection.h
new file mode 100644
index 00000000..d4618d7f
--- /dev/null
+++ b/libdash/source/metrics/TCPConnection.h
@@ -0,0 +1,49 @@
+/*
+ * TCPConnection.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 TCPCONNECTION_H_
+#define TCPCONNECTION_H_
+
+#include "ITCPConnection.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class TCPConnection : public ITCPConnection
+ {
+ public:
+ TCPConnection ();
+ virtual ~TCPConnection ();
+
+ uint32_t TCPId () const;
+ const std::string& DestinationAddress () const;
+ const std::string& ConnectionOpenedTime () const;
+ const std::string& ConnectionClosedTime () const;
+ uint64_t ConnectionTime () const;
+
+ void SetTCPId (uint32_t tcpId);
+ void SetDestinationAddress (const std::string& destAddress);
+ void SetConnectionOpenedTime (std::string tOpen);
+ void SetConnectionClosedTime (std::string tClose);
+ void SetConnectionTime (uint64_t tConnect);
+
+ private:
+ uint32_t tcpId;
+ std::string dest;
+ std::string tOpen;
+ std::string tClose;
+ uint64_t tConnect;
+ };
+ }
+}
+
+#endif /* TCPCONNECTION_H_ */
diff --git a/libdash/source/metrics/ThroughputMeasurement.cpp b/libdash/source/metrics/ThroughputMeasurement.cpp
new file mode 100644
index 00000000..8d2c485e
--- /dev/null
+++ b/libdash/source/metrics/ThroughputMeasurement.cpp
@@ -0,0 +1,46 @@
+/*
+ * ThroughputMeasurement.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 "ThroughputMeasurement.h"
+
+using namespace dash::metrics;
+
+ThroughputMeasurement::ThroughputMeasurement ()
+{
+}
+ThroughputMeasurement::~ThroughputMeasurement()
+{
+}
+
+const std::string& ThroughputMeasurement::StartOfPeriod () const
+{
+ return this->startOfPeriod;
+}
+void ThroughputMeasurement::SetStartOfPeriod (std::string start)
+{
+ this->startOfPeriod = start;
+}
+uint64_t ThroughputMeasurement::DurationOfPeriod () const
+{
+ return this->durationOfPeriod;
+}
+void ThroughputMeasurement::SetDurationOfPeriod (uint64_t duration)
+{
+ this->durationOfPeriod = duration;
+}
+const std::vector<uint32_t>& ThroughputMeasurement::ReceivedBytesPerTrace () const
+{
+ return this->receivedBytesPerTrace;
+}
+void ThroughputMeasurement::AddReceivedBytes (uint32_t numberOfBytes)
+{
+ this->receivedBytesPerTrace.push_back(numberOfBytes);
+}
diff --git a/libdash/source/metrics/ThroughputMeasurement.h b/libdash/source/metrics/ThroughputMeasurement.h
new file mode 100644
index 00000000..817e30d9
--- /dev/null
+++ b/libdash/source/metrics/ThroughputMeasurement.h
@@ -0,0 +1,43 @@
+/*
+ * ThroughputMeasurement.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 THROUGHPUTMEASUREMENT_H_
+#define THROUGHPUTMEASUREMENT_H_
+
+#include "IThroughputMeasurement.h"
+
+namespace dash
+{
+ namespace metrics
+ {
+ class ThroughputMeasurement : public IThroughputMeasurement
+ {
+ public:
+ ThroughputMeasurement ();
+ virtual ~ThroughputMeasurement ();
+
+ const std::string& StartOfPeriod () const;
+ uint64_t DurationOfPeriod () const;
+ const std::vector<uint32_t>& ReceivedBytesPerTrace () const;
+
+ void SetStartOfPeriod (std::string startOfPeriod);
+ void SetDurationOfPeriod (uint64_t duration);
+ void AddReceivedBytes (uint32_t numberOfBytes);
+
+ private:
+ std::string startOfPeriod;
+ uint64_t durationOfPeriod;
+ std::vector<uint32_t> receivedBytesPerTrace;
+ };
+ }
+}
+
+#endif /* THROUGHPUTMEASUREMENT_H_ */
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_ */
diff --git a/libdash/source/network/AbstractChunk.cpp b/libdash/source/network/AbstractChunk.cpp
new file mode 100644
index 00000000..35774efe
--- /dev/null
+++ b/libdash/source/network/AbstractChunk.cpp
@@ -0,0 +1,271 @@
+/*
+ * AbstractChunk.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 "AbstractChunk.h"
+
+using namespace dash::network;
+using namespace dash::helpers;
+using namespace dash::metrics;
+
+uint32_t AbstractChunk::BLOCKSIZE = 32768;
+
+AbstractChunk::AbstractChunk () :
+ connection (NULL),
+ dlThread (NULL),
+ bytesDownloaded (0)
+{
+}
+AbstractChunk::~AbstractChunk ()
+{
+ this->AbortDownload();
+ this->blockStream.Clear();
+ DestroyThreadPortable(this->dlThread);
+}
+
+void AbstractChunk::AbortDownload ()
+{
+ this->stateManager.CheckAndSet(IN_PROGRESS, REQUEST_ABORT);
+ this->stateManager.CheckAndWait(REQUEST_ABORT, ABORTED);
+}
+bool AbstractChunk::StartDownload ()
+{
+ if(this->stateManager.State() != NOT_STARTED)
+ return false;
+ curl_global_init(CURL_GLOBAL_ALL);
+ this->curlm = curl_multi_init();
+
+ this->curl = curl_easy_init();
+ curl_easy_setopt(this->curl, CURLOPT_URL, this->AbsoluteURI().c_str());
+ curl_easy_setopt(this->curl, CURLOPT_WRITEFUNCTION, CurlResponseCallback);
+ curl_easy_setopt(this->curl, CURLOPT_WRITEDATA, (void *)this);
+ /* Debug Callback */
+ curl_easy_setopt(this->curl, CURLOPT_VERBOSE, 1L);
+ curl_easy_setopt(this->curl, CURLOPT_DEBUGFUNCTION, CurlDebugCallback);
+ curl_easy_setopt(this->curl, CURLOPT_DEBUGDATA, (void *)this);
+ curl_easy_setopt(this->curl, CURLOPT_FAILONERROR, true);
+
+ if(this->HasByteRange())
+ curl_easy_setopt(this->curl, CURLOPT_RANGE, this->Range().c_str());
+
+ curl_multi_add_handle(this->curlm, this->curl);
+ this->dlThread = CreateThreadPortable (DownloadInternalConnection, this);
+
+ if(this->dlThread == NULL)
+ return false;
+
+ this->stateManager.State(IN_PROGRESS);
+
+ return true;
+}
+bool AbstractChunk::StartDownload (IConnection *connection)
+{
+ if(this->stateManager.State() != NOT_STARTED)
+ return false;
+
+ this->connection = connection;
+ this->dlThread = CreateThreadPortable (DownloadExternalConnection, this);
+
+ if(this->dlThread == NULL)
+ return false;
+
+ this->stateManager.State(IN_PROGRESS);
+
+
+ return true;
+}
+int AbstractChunk::Read (uint8_t *data, size_t len)
+{
+ return this->blockStream.GetBytes(data, len);
+}
+int AbstractChunk::Peek (uint8_t *data, size_t len)
+{
+ return this->blockStream.PeekBytes(data, len);
+}
+int AbstractChunk::Peek (uint8_t *data, size_t len, size_t offset)
+{
+ return this->blockStream.PeekBytes(data, len, offset);
+}
+void AbstractChunk::AttachDownloadObserver (IDownloadObserver *observer)
+{
+ this->observers.push_back(observer);
+ this->stateManager.Attach(observer);
+}
+void AbstractChunk::DetachDownloadObserver (IDownloadObserver *observer)
+{
+ uint32_t pos = -1;
+
+ for(size_t i = 0; i < this->observers.size(); i++)
+ if(this->observers.at(i) == observer)
+ pos = i;
+
+ if(pos != -1)
+ this->observers.erase(this->observers.begin() + pos);
+
+ this->stateManager.Detach(observer);
+}
+void* AbstractChunk::DownloadExternalConnection (void *abstractchunk)
+{
+ AbstractChunk *chunk = (AbstractChunk *) abstractchunk;
+ block_t *block = AllocBlock(chunk->BLOCKSIZE);
+ int ret = 0;
+
+ int count = 0;
+ do
+ {
+ ret = chunk->connection->Read(block->data, block->len, chunk);
+ if(ret > 0)
+ {
+ block_t *streamblock = AllocBlock(ret);
+ memcpy(streamblock->data, block->data, ret);
+ chunk->blockStream.PushBack(streamblock);
+ chunk->bytesDownloaded += ret;
+
+ // chunk->NotifyDownloadRateChanged();
+ }
+ if(chunk->stateManager.State() == REQUEST_ABORT)
+ ret = 0;
+ count += ret;
+ }while(ret);
+
+ double speed = chunk->connection->GetAverageDownloadingSpeed();
+ double time = chunk->connection->GetDownloadingTime();
+ chunk->NotifyDownloadRateChanged(speed);
+ chunk->NotifyDownloadTimeChanged(time);
+ DeleteBlock(block);
+
+ if(chunk->stateManager.State() == REQUEST_ABORT)
+ chunk->stateManager.State(ABORTED);
+ else
+ chunk->stateManager.State(COMPLETED);
+
+ chunk->blockStream.SetEOS(true);
+
+ return NULL;
+}
+void* AbstractChunk::DownloadInternalConnection (void *abstractchunk)
+{
+ AbstractChunk *chunk = (AbstractChunk *) abstractchunk;
+
+ //chunk->response = curl_easy_perform(chunk->curl);
+ int u =1;
+
+ while(chunk->stateManager.State() != REQUEST_ABORT && u)
+ {
+ curl_multi_perform(chunk->curlm, &u);
+ }
+ double speed;
+ double size;
+ double time;
+ curl_easy_getinfo(chunk->curl, CURLINFO_SPEED_DOWNLOAD,&speed);
+ curl_easy_getinfo(chunk->curl, CURLINFO_SIZE_DOWNLOAD, &size);
+ curl_easy_getinfo(chunk->curl, CURLINFO_TOTAL_TIME, &time);
+
+ //Speed is in Bps ==> *8 for the bps
+ speed = 8*speed;
+ //size = 8*size; //Uncomment for the size in bits.
+ chunk->NotifyDownloadRateChanged(speed);
+ chunk->NotifyDownloadTimeChanged(time);
+ curl_easy_cleanup(chunk->curl);
+ //curl_global_cleanup();
+
+ curl_multi_cleanup(chunk->curlm);
+ if(chunk->stateManager.State() == REQUEST_ABORT)
+ {
+ chunk->stateManager.State(ABORTED);
+ }
+ else
+ {
+ chunk->stateManager.State(COMPLETED);
+ }
+
+ chunk->blockStream.SetEOS(true);
+
+ return NULL;
+}
+void AbstractChunk::NotifyDownloadRateChanged (double bitrate)
+{
+ for(size_t i = 0; i < this->observers.size(); i++)
+ this->observers.at(i)->OnDownloadRateChanged((uint64_t)bitrate);
+}
+void AbstractChunk::NotifyDownloadTimeChanged (double dnltime)
+{
+ for(size_t i = 0; i < this->observers.size(); i++)
+ this->observers.at(i)->OnDownloadTimeChanged(dnltime);
+}
+size_t AbstractChunk::CurlResponseCallback (void *contents, size_t size, size_t nmemb, void *userp)
+{
+ size_t realsize = size * nmemb;
+ AbstractChunk *chunk = (AbstractChunk *)userp;
+
+ if(chunk->stateManager.State() == REQUEST_ABORT)
+ return 0;
+
+ block_t *block = AllocBlock(realsize);
+
+ memcpy(block->data, contents, realsize);
+ chunk->blockStream.PushBack(block);
+
+ chunk->bytesDownloaded += realsize;
+// chunk->NotifyDownloadRateChanged();
+
+ return realsize;
+}
+size_t AbstractChunk::CurlDebugCallback (CURL *url, curl_infotype infoType, char * data, size_t length, void *userdata)
+{
+ AbstractChunk *chunk = (AbstractChunk *)userdata;
+
+ switch (infoType) {
+ case CURLINFO_TEXT:
+ break;
+ case CURLINFO_HEADER_OUT:
+ chunk->HandleHeaderOutCallback();
+ break;
+ case CURLINFO_HEADER_IN:
+ chunk->HandleHeaderInCallback(std::string(data));
+ break;
+ case CURLINFO_DATA_IN:
+ break;
+ default:
+ return 0;
+ }
+ return 0;
+}
+void AbstractChunk::HandleHeaderOutCallback ()
+{
+ HTTPTransaction *httpTransaction = new HTTPTransaction();
+
+ httpTransaction->SetOriginalUrl(this->AbsoluteURI());
+ httpTransaction->SetRange(this->Range());
+ httpTransaction->SetType(this->GetType());
+ httpTransaction->SetRequestSentTime(Time::GetCurrentUTCTimeStr());
+
+ this->httpTransactions.push_back(httpTransaction);
+}
+void AbstractChunk::HandleHeaderInCallback (std::string data)
+{
+ HTTPTransaction *httpTransaction = this->httpTransactions.at(this->httpTransactions.size()-1);
+
+ if (data.substr(0,4) == "HTTP")
+ {
+ httpTransaction->SetResponseReceivedTime(Time::GetCurrentUTCTimeStr());
+ httpTransaction->SetResponseCode(strtoul(data.substr(9,3).c_str(), NULL, 10));
+ }
+
+ httpTransaction->AddHTTPHeaderLine(data);
+}
+const std::vector<ITCPConnection *>& AbstractChunk::GetTCPConnectionList () const
+{
+ return (std::vector<ITCPConnection *> &) this->tcpConnections;
+}
+const std::vector<IHTTPTransaction *>& AbstractChunk::GetHTTPTransactionList () const
+{
+ return (std::vector<IHTTPTransaction *> &) this->httpTransactions;
+}
diff --git a/libdash/source/network/AbstractChunk.h b/libdash/source/network/AbstractChunk.h
new file mode 100644
index 00000000..794469fd
--- /dev/null
+++ b/libdash/source/network/AbstractChunk.h
@@ -0,0 +1,100 @@
+/*
+ * AbstractChunk.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 ABSTRACTCHUNK_H_
+#define ABSTRACTCHUNK_H_
+
+#include "config.h"
+
+#include "IDownloadableChunk.h"
+#include "DownloadStateManager.h"
+#include "../helpers/SyncedBlockStream.h"
+#include "../portable/Networking.h"
+#include <curl/curl.h>
+#include "../metrics/HTTPTransaction.h"
+#include "../metrics/TCPConnection.h"
+#include "../metrics/ThroughputMeasurement.h"
+#include "../helpers/Time.h"
+
+#include <chrono>
+
+namespace dash
+{
+ namespace network
+ {
+ class AbstractChunk : public virtual IDownloadableChunk
+ {
+ public:
+ AbstractChunk ();
+ virtual ~AbstractChunk ();
+
+ /*
+ * Pure virtual IChunk Interface
+ */
+ virtual std::string& AbsoluteURI () = 0;
+ virtual std::string& Host () = 0;
+ virtual size_t Port () = 0;
+ virtual std::string& Path () = 0;
+ virtual std::string& Range () = 0;
+ virtual size_t StartByte () = 0;
+ virtual size_t EndByte () = 0;
+ virtual bool HasByteRange () = 0;
+ virtual dash::metrics::HTTPTransactionType GetType() = 0;
+ /*
+ * IDownloadableChunk Interface
+ */
+ virtual bool StartDownload (IConnection *connection);
+ virtual bool StartDownload ();
+ virtual void AbortDownload ();
+ virtual int Read (uint8_t *data, size_t len);
+ virtual int Peek (uint8_t *data, size_t len);
+ virtual int Peek (uint8_t *data, size_t len, size_t offset);
+ virtual void AttachDownloadObserver (IDownloadObserver *observer);
+ virtual void DetachDownloadObserver (IDownloadObserver *observer);
+ /*
+ * Observer Notification
+ */
+ void NotifyDownloadRateChanged (double bitrate);
+ void NotifyDownloadTimeChanged (double dnltime);
+ /*
+ * IDASHMetrics
+ */
+ const std::vector<dash::metrics::ITCPConnection *>& GetTCPConnectionList () const;
+ const std::vector<dash::metrics::IHTTPTransaction *>& GetHTTPTransactionList () const;
+
+ private:
+ std::vector<IDownloadObserver *> observers;
+ THREAD_HANDLE dlThread;
+ IConnection *connection;
+ helpers::SyncedBlockStream blockStream;
+ CURL *curl;
+ CURLM *curlm;
+ CURLcode response;
+ uint64_t bytesDownloaded;
+ DownloadStateManager stateManager;
+
+ std::vector<dash::metrics::TCPConnection *> tcpConnections;
+ std::vector<dash::metrics::HTTPTransaction *> httpTransactions;
+
+ static uint32_t BLOCKSIZE;
+
+ static void* DownloadExternalConnection (void *chunk);
+ static void* DownloadInternalConnection (void *chunk);
+ static size_t CurlResponseCallback (void *contents, size_t size, size_t nmemb, void *userp);
+ static size_t CurlHeaderCallback (void *headerData, size_t size, size_t nmemb, void *userdata);
+ static size_t CurlDebugCallback (CURL *url, curl_infotype infoType, char * data, size_t length, void *userdata);
+ void HandleHeaderOutCallback ();
+ void HandleHeaderInCallback (std::string data);
+ };
+ }
+}
+
+#endif /* ABSTRACTCHUNK_H_ */
diff --git a/libdash/source/network/DownloadStateManager.cpp b/libdash/source/network/DownloadStateManager.cpp
new file mode 100644
index 00000000..5117c099
--- /dev/null
+++ b/libdash/source/network/DownloadStateManager.cpp
@@ -0,0 +1,100 @@
+/*
+ * DownloadStateManager.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 "DownloadStateManager.h"
+
+using namespace dash::network;
+
+DownloadStateManager::DownloadStateManager () :
+ state (NOT_STARTED)
+{
+ InitializeConditionVariable (&this->stateChanged);
+ InitializeCriticalSection (&this->stateLock);
+}
+DownloadStateManager::~DownloadStateManager ()
+{
+ DeleteConditionVariable (&this->stateChanged);
+ DeleteCriticalSection (&this->stateLock);
+}
+
+DownloadState DownloadStateManager::State () const
+{
+ EnterCriticalSection(&this->stateLock);
+
+ DownloadState ret = this->state;
+
+ LeaveCriticalSection(&this->stateLock);
+
+ return ret;
+}
+void DownloadStateManager::State (DownloadState state)
+{
+ EnterCriticalSection(&this->stateLock);
+
+ this->state = state;
+
+ this->Notify();
+ WakeAllConditionVariable(&this->stateChanged);
+ LeaveCriticalSection(&this->stateLock);
+}
+void DownloadStateManager::WaitState (DownloadState state) const
+{
+ EnterCriticalSection(&this->stateLock);
+
+ while(this->state != state)
+ SleepConditionVariableCS(&this->stateChanged, &this->stateLock, INFINITE);
+
+ LeaveCriticalSection(&this->stateLock);
+}
+void DownloadStateManager::CheckAndWait (DownloadState check, DownloadState wait) const
+{
+ EnterCriticalSection(&this->stateLock);
+
+ if(this->state == check)
+ while(this->state != wait)
+ SleepConditionVariableCS(&this->stateChanged, &this->stateLock, INFINITE);
+
+ LeaveCriticalSection(&this->stateLock);
+}
+void DownloadStateManager::Attach (IDownloadObserver *observer)
+{
+ EnterCriticalSection(&this->stateLock);
+ this->observers.push_back(observer);
+ LeaveCriticalSection(&this->stateLock);
+}
+void DownloadStateManager::Detach (IDownloadObserver *observer)
+{
+ EnterCriticalSection(&this->stateLock);
+
+ uint32_t pos = -1;
+
+ for(size_t i = 0; i < this->observers.size(); i++)
+ if(this->observers.at(i) == observer)
+ pos = i;
+
+ if(pos != -1)
+ this->observers.erase(this->observers.begin() + pos);
+
+ LeaveCriticalSection(&this->stateLock);
+}
+void DownloadStateManager::Notify ()
+{
+ for(size_t i = 0; i < this->observers.size(); i++)
+ this->observers.at(i)->OnDownloadStateChanged(this->state);
+}
+void DownloadStateManager::CheckAndSet (DownloadState check, DownloadState set)
+{
+ EnterCriticalSection(&this->stateLock);
+
+ if(this->state == check)
+ this->state = set;
+ LeaveCriticalSection(&this->stateLock);
+}
diff --git a/libdash/source/network/DownloadStateManager.h b/libdash/source/network/DownloadStateManager.h
new file mode 100644
index 00000000..90dd770d
--- /dev/null
+++ b/libdash/source/network/DownloadStateManager.h
@@ -0,0 +1,50 @@
+/*
+ * DownloadStateManager.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 DOWNLOADSTATEMANAGER_H_
+#define DOWNLOADSTATEMANAGER_H_
+
+#include "config.h"
+
+#include "IDownloadObserver.h"
+#include "../portable/MultiThreading.h"
+
+namespace dash
+{
+ namespace network
+ {
+ class DownloadStateManager
+ {
+ public:
+ DownloadStateManager ();
+ virtual ~DownloadStateManager ();
+
+ DownloadState State () const;
+ void WaitState (DownloadState state) const;
+ void CheckAndWait (DownloadState check, DownloadState wait) const;
+ void CheckAndSet (DownloadState check, DownloadState set);
+ void State (DownloadState state);
+ void Attach (IDownloadObserver *observer);
+ void Detach (IDownloadObserver *observer);
+
+ private:
+ DownloadState state;
+ mutable CRITICAL_SECTION stateLock;
+ mutable CONDITION_VARIABLE stateChanged;
+
+ std::vector<IDownloadObserver *> observers;
+
+ void Notify ();
+ };
+ }
+}
+
+#endif /* DOWNLOADSTATEMANAGER_H_ */
diff --git a/libdash/source/portable/MultiThreading.cpp b/libdash/source/portable/MultiThreading.cpp
new file mode 100644
index 00000000..5d1fe9c0
--- /dev/null
+++ b/libdash/source/portable/MultiThreading.cpp
@@ -0,0 +1,112 @@
+#include "MultiThreading.h"
+
+THREAD_HANDLE CreateThreadPortable (void *(*start_routine) (void *), void *arg)
+{
+ #if defined _WIN32 || defined _WIN64
+ return CreateThread (0, 0, (LPTHREAD_START_ROUTINE)start_routine, (LPVOID)arg, 0, 0);
+ #else
+ THREAD_HANDLE th = (THREAD_HANDLE)malloc(sizeof(pthread_t));
+
+ if (!th)
+ {
+ std::cerr << "Error allocating thread." << std::endl;
+ return NULL;
+ }
+
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ if(int err = pthread_create(th, &attr, start_routine, arg))
+ {
+ std::cerr << strerror(err) << std::endl;
+ return NULL;
+ }
+ return th;
+ #endif
+}
+void DestroyThreadPortable (THREAD_HANDLE th)
+{
+ #if !defined _WIN32 && !defined _WIN64
+ if(th)
+ free(th);
+ #endif
+}
+
+/****************************************************************************
+* Condition variables for Windows XP and older windows sytems
+*****************************************************************************/
+#if defined WINXPOROLDER
+ void InitCondition (condition_variable_t *cv)
+ {
+ InitializeCriticalSection(&cv->waitersCountLock);
+
+ cv->waitersCount = 0;
+ cv->waitGenerationCount = 0;
+ cv->releaseCount = 0;
+
+ cv->waitingEvent = CreateEvent (NULL, // no security
+ TRUE, // manual-reset
+ FALSE, // non-signaled initially
+ NULL); // unnamed
+ }
+ void WaitCondition (condition_variable_t *cv, CRITICAL_SECTION *externalMutex)
+ {
+ EnterCriticalSection(&cv->waitersCountLock);
+
+ cv->waitersCount++;
+
+ int currentGenerationCount = cv->waitGenerationCount;
+
+ LeaveCriticalSection(&cv->waitersCountLock);
+ LeaveCriticalSection(externalMutex);
+
+ bool isWaitDone = false;
+ while(!isWaitDone)
+ {
+ WaitForSingleObject (cv->waitingEvent, INFINITE);
+ EnterCriticalSection (&cv->waitersCountLock);
+
+ isWaitDone = (cv->releaseCount > 0 && cv->waitGenerationCount != currentGenerationCount);
+ LeaveCriticalSection (&cv->waitersCountLock);
+ }
+
+ EnterCriticalSection(externalMutex);
+ EnterCriticalSection(&cv->waitersCountLock);
+
+ cv->waitersCount--;
+ cv->releaseCount--;
+ bool isLastWaiter = (cv->releaseCount == 0);
+
+ LeaveCriticalSection(&cv->waitersCountLock);
+
+ if(isLastWaiter)
+ ResetEvent(cv->waitingEvent);
+ }
+ void SignalCondition (condition_variable_t *cv)
+ {
+ EnterCriticalSection(&cv->waitersCountLock);
+
+ if(cv->waitersCount > cv->releaseCount)
+ {
+ SetEvent(cv->waitingEvent);
+ cv->releaseCount++;
+ cv->waitGenerationCount++;
+ }
+
+ LeaveCriticalSection(&cv->waitersCountLock);
+ }
+ void BroadcastCondition (condition_variable_t *cv)
+ {
+ EnterCriticalSection(&cv->waitersCountLock);
+
+ if(cv->waitersCount > 0)
+ {
+ SetEvent(cv->waitingEvent);
+ cv->releaseCount = cv->waitersCount;
+ cv->waitGenerationCount++;
+ }
+
+ LeaveCriticalSection(&cv->waitersCountLock);
+}
+#endif
diff --git a/libdash/source/portable/MultiThreading.h b/libdash/source/portable/MultiThreading.h
new file mode 100644
index 00000000..c1b45f5c
--- /dev/null
+++ b/libdash/source/portable/MultiThreading.h
@@ -0,0 +1,70 @@
+#ifndef PORTABLE_MULTITHREADING_H_
+#define PORTABLE_MULTITHREADING_H_
+
+#if defined _WIN32 || defined _WIN64
+
+ #define _WINSOCKAPI_
+ #include <Windows.h>
+ #define DeleteConditionVariable(cond_p) {}
+
+ typedef HANDLE THREAD_HANDLE;
+
+ #if defined WINXPOROLDER
+ /****************************************************************************
+ * Variables
+ *****************************************************************************/
+ struct condition_variable_t
+ {
+ int waitersCount; // Count of the number of waiters.
+ CRITICAL_SECTION waitersCountLock; // Serialize access to <waitersCount>.
+ int releaseCount; // Number of threads to release via a <BroadcastCondition> or a <SignalCondition>.
+ int waitGenerationCount; // Keeps track of the current "generation" so that we don't allow one thread to steal all the "releases" from the broadcast.
+ HANDLE waitingEvent; // A manual-reset event that's used to block and release waiting threads.
+ };
+ /****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+ void InitCondition (condition_variable_t *cv);
+ void WaitCondition (condition_variable_t *cv, CRITICAL_SECTION *externalMutex);
+ void SignalCondition (condition_variable_t *cv);
+ void BroadcastCondition (condition_variable_t *cv);
+ /****************************************************************************
+ * Defines
+ *****************************************************************************/
+ #define CONDITION_VARIABLE condition_variable_t
+
+ #define InitializeConditionVariable(cond_p) InitCondition(cond_p)
+ #define SleepConditionVariableCS(cond_p, mutex_p, infinite) WaitCondition(cond_p, mutex_p) // INFINITE should be handled mor properly
+ #define WakeConditionVariable(cond_p) SignalCondition(cond_p)
+ #define WakeAllConditionVariable(cond_p) BroadcastCondition(cond_p)
+ #endif
+
+#else
+
+ #include <string.h>
+ #include <pthread.h>
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <iostream>
+
+ #define CRITICAL_SECTION pthread_mutex_t
+ #define CONDITION_VARIABLE pthread_cond_t
+
+ #define InitializeCriticalSection(mutex_p) pthread_mutex_init(mutex_p, NULL)
+ #define DeleteCriticalSection(mutex_p) pthread_mutex_destroy(mutex_p)
+ #define EnterCriticalSection(mutex_p) pthread_mutex_lock(mutex_p)
+ #define LeaveCriticalSection(mutex_p) pthread_mutex_unlock(mutex_p)
+ #define InitializeConditionVariable(cond_p) pthread_cond_init(cond_p, NULL)
+ #define DeleteConditionVariable(cond_p) pthread_cond_destroy(cond_p)
+ #define SleepConditionVariableCS(cond_p, mutex_p, infinite) pthread_cond_wait(cond_p, mutex_p) // INFINITE should be handled mor properly
+ #define WakeConditionVariable(cond_p) pthread_cond_signal(cond_p)
+ #define WakeAllConditionVariable(cond_p) pthread_cond_broadcast(cond_p)
+
+ typedef pthread_t* THREAD_HANDLE;
+
+#endif
+
+THREAD_HANDLE CreateThreadPortable (void *(*start_routine) (void *), void *arg);
+void DestroyThreadPortable (THREAD_HANDLE th);
+
+#endif // PORTABLE_MULTITHREADING_H_ \ No newline at end of file
diff --git a/libdash/source/portable/Networking.h b/libdash/source/portable/Networking.h
new file mode 100644
index 00000000..6239c3a3
--- /dev/null
+++ b/libdash/source/portable/Networking.h
@@ -0,0 +1,27 @@
+#ifndef PORTABLE_NETWORKING_H_
+#define PORTABLE_NETWORKING_H_
+
+#if defined _WIN32 || defined _WIN64
+
+#include <WinSock2.h>
+#include <WS2tcpip.h>
+
+#else
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/ip.h> /* superset of previous */
+#include <netdb.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define closesocket(socket) close(socket)
+#define WSAStartup(wVersionRequested, lpWSAData) 0
+#define WSACleanup() {}
+
+typedef unsigned char WSADATA;
+
+#endif
+
+#endif // PORTABLE_NETWORKING_H_
diff --git a/libdash/source/sublibs.mk b/libdash/source/sublibs.mk
new file mode 100644
index 00000000..69173c3b
--- /dev/null
+++ b/libdash/source/sublibs.mk
@@ -0,0 +1,23 @@
+LIBDIR=../libs
+OBJECTS=$(SOURCES:.cpp=.o)
+DIRNAME=$(shell basename $(shell pwd))
+LIBRARY=$(LIBDIR)/lib$(DIRNAME).a
+
+all: $(SOURCES) $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ mkdir -p $(LIBDIR)
+ rm -f $@
+ $(AR) $(ARFLAGS) $@ $(OBJECTS)
+
+.cpp.o:
+ $(CC) $(CFLAGS) $< -o $@
+
+clean:
+ rm -f $(OBJECTS)
+
+distclean: clean
+ rm -f $(LIBRARY)
+ if test -d $(LIBDIR); then \
+ rmdir --ignore-fail-on-non-empty $(LIBDIR) ; \
+ fi
diff --git a/libdash/source/targetver.h b/libdash/source/targetver.h
new file mode 100644
index 00000000..2adeccf9
--- /dev/null
+++ b/libdash/source/targetver.h
@@ -0,0 +1,18 @@
+/*
+ * targetver.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.
+ *****************************************************************************/
+
+#pragma once
+
+#if defined _WIN32 || defined _WIN64
+
+#include <SDKDDKVer.h>
+
+#endif \ No newline at end of file
diff --git a/libdash/source/xml/DOMHelper.cpp b/libdash/source/xml/DOMHelper.cpp
new file mode 100644
index 00000000..43adadc0
--- /dev/null
+++ b/libdash/source/xml/DOMHelper.cpp
@@ -0,0 +1,54 @@
+/*
+ * DOMHelper.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 "DOMHelper.h"
+
+using namespace dash::xml;
+
+std::vector<Node *> DOMHelper::GetElementByTagName (Node *root, const std::string &name, bool selfContain)
+{
+ std::vector<Node *> elements;
+
+ for(unsigned int i = 0; i < root->GetSubNodes().size(); i++)
+ {
+ GetElementsByTagName(root->GetSubNodes().at(i), name, &elements, selfContain);
+ }
+
+ return elements;
+}
+std::vector<Node *> DOMHelper::GetChildElementByTagName (Node *root, const std::string &name)
+{
+ std::vector<Node *> elements;
+
+ for(unsigned int i = 0; i < root->GetSubNodes().size(); i++)
+ {
+ if(!root->GetSubNodes().at(i)->GetName().compare(name))
+ elements.push_back(root->GetSubNodes().at(i));
+ }
+
+ return elements;
+}
+void DOMHelper::GetElementsByTagName (Node *root, const std::string &name, std::vector<Node*> *elements, bool selfContain)
+{
+ if(!selfContain && !root->GetName().compare(name))
+ {
+ elements->push_back(root);
+ return;
+ }
+
+ if(!root->GetName().compare(name))
+ elements->push_back(root);
+
+ for(unsigned int i = 0; i < root->GetSubNodes().size(); i++)
+ {
+ GetElementsByTagName(root->GetSubNodes().at(i), name, elements, selfContain);
+ }
+}
diff --git a/libdash/source/xml/DOMHelper.h b/libdash/source/xml/DOMHelper.h
new file mode 100644
index 00000000..d76d425b
--- /dev/null
+++ b/libdash/source/xml/DOMHelper.h
@@ -0,0 +1,35 @@
+/*
+ * DOMHelper.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 DOMHELPER_H_
+#define DOMHELPER_H_
+
+#include "config.h"
+
+#include "Node.h"
+
+namespace dash
+{
+ namespace xml
+ {
+ class DOMHelper
+ {
+ public:
+ static std::vector<Node *> GetElementByTagName (Node *root, const std::string &name, bool selfContain);
+ static std::vector<Node *> GetChildElementByTagName (Node *root, const std::string &name);
+
+ private:
+ static void GetElementsByTagName(Node *root, const std::string &name, std::vector<Node *> *elements, bool selfContain);
+ };
+ }
+}
+
+#endif /* DOMHELPER_H_ */
diff --git a/libdash/source/xml/DOMParser.cpp b/libdash/source/xml/DOMParser.cpp
new file mode 100644
index 00000000..5feb3850
--- /dev/null
+++ b/libdash/source/xml/DOMParser.cpp
@@ -0,0 +1,160 @@
+/*
+ * DOMParser.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 "DOMParser.h"
+
+using namespace dash::xml;
+using namespace dash::helpers;
+
+DOMParser::DOMParser (std::string url) :
+ url (url),
+ reader (NULL),
+ root (NULL)
+{
+ this->Init();
+}
+DOMParser::~DOMParser ()
+{
+ xmlCleanupParser();
+ delete(this->root);
+}
+
+Node* DOMParser::GetRootNode () const
+{
+ return this->root;
+}
+bool DOMParser::Parse (std::string path)
+{
+ this->reader = xmlReaderForFile(this->url.c_str(), NULL, 0);
+
+ if(this->reader == NULL)
+ return false;
+
+ if(xmlTextReaderRead(this->reader))
+ this->root = this->ProcessNode(path);
+
+ if(this->root == NULL)
+ return false;
+
+ xmlFreeTextReader(this->reader);
+
+ return true;
+}
+Node* DOMParser::ProcessNode (std::string path)
+{
+ int type = xmlTextReaderNodeType(this->reader);
+
+ if(type != WhiteSpace && type != Text)
+ {
+ while (type == Comment || type == WhiteSpace)
+ {
+ xmlTextReaderRead(this->reader);
+ type = xmlTextReaderNodeType(this->reader);
+ }
+
+ Node *node = new Node();
+ node->SetType(type);
+ if(!(strcmp("",path.c_str())))
+ node->SetMPDPath(Path::GetDirectoryPath(url));
+ else
+ node->SetMPDPath(Path::GetDirectoryPath(path));
+ if(xmlTextReaderConstName(this->reader) == NULL)
+ {
+ delete node;
+ return NULL;
+ }
+
+ std::string name = (const char *) xmlTextReaderConstName(this->reader);
+ int isEmpty = xmlTextReaderIsEmptyElement(this->reader);
+
+ node->SetName(name);
+
+ this->AddAttributesToNode(node);
+
+ if(isEmpty)
+ return node;
+
+ Node *subnode = NULL;
+ int ret = xmlTextReaderRead(this->reader);
+
+ while(ret == 1)
+ {
+ if(!strcmp(name.c_str(), (const char *) xmlTextReaderConstName(this->reader)))
+ {
+ return node;
+ }
+
+ subnode = this->ProcessNode(path);
+
+ if(subnode != NULL)
+ node->AddSubNode(subnode);
+
+ ret = xmlTextReaderRead(this->reader);
+ }
+
+ return node;
+ } else if (type == Text)
+ {
+ const char* text = (const char *) xmlTextReaderReadString(this->reader);
+
+ if(text != NULL)
+ {
+ Node *node = new Node();
+ node->SetType(type);
+ node->SetText(text);
+ return node;
+ }
+ }
+ return NULL;
+}
+void DOMParser::AddAttributesToNode (Node *node)
+{
+ if(xmlTextReaderHasAttributes(this->reader))
+ {
+ while(xmlTextReaderMoveToNextAttribute(this->reader))
+ {
+ std::string key = (const char *) xmlTextReaderConstName(this->reader);
+ std::string value = (const char *) xmlTextReaderConstValue(this->reader);
+ node->AddAttribute(key, value);
+ }
+ }
+}
+void DOMParser::Print (Node *node, int offset)
+{
+ std::stringstream ss;
+ for(int i = 0; i < offset; i++)
+ ss << " ";
+ ss << node->GetName();
+
+ std::vector<std::string> keys = node->GetAttributeKeys();
+
+ ss.clear();
+ for(unsigned int i = 0; i < keys.size(); i++)
+ {
+ ss << " " << keys.at(i) << "=" << node->GetAttributeValue(keys.at(i));
+ }
+
+ offset++;
+
+ for(unsigned int i = 0; i < node->GetSubNodes().size(); i++)
+ {
+ this->Print(node->GetSubNodes().at(i), offset);
+ }
+}
+void DOMParser::Init ()
+{
+ this->root = NULL;
+ this->reader = NULL;
+}
+void DOMParser::Print ()
+{
+ this->Print(this->root, 0);
+}
diff --git a/libdash/source/xml/DOMParser.h b/libdash/source/xml/DOMParser.h
new file mode 100644
index 00000000..a8b3a9b7
--- /dev/null
+++ b/libdash/source/xml/DOMParser.h
@@ -0,0 +1,56 @@
+/*
+ * DOMParser.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 DOMPARSER_H_
+#define DOMPARSER_H_
+
+#include "config.h"
+
+#include "Node.h"
+#include <libxml/xmlreader.h>
+#include "../helpers/Path.h"
+
+namespace dash
+{
+ namespace xml
+ {
+ enum NodeType
+ {
+ Start = 1,
+ End = 15,
+ Comment = 8,
+ WhiteSpace = 14,
+ Text = 3,
+ };
+
+ class DOMParser
+ {
+ public:
+ DOMParser (std::string url);
+ virtual ~DOMParser ();
+
+ bool Parse (std::string path = "");
+ Node* GetRootNode () const;
+ void Print ();
+
+ private:
+ xmlTextReaderPtr reader;
+ Node *root;
+ std::string url;
+
+ void Init ();
+ Node* ProcessNode (std::string);
+ void AddAttributesToNode (Node *node);
+ void Print (Node *node, int offset);
+ };
+ }
+}
+#endif /* DOMPARSER_H_ */
diff --git a/libdash/source/xml/Node.cpp b/libdash/source/xml/Node.cpp
new file mode 100644
index 00000000..d04558b6
--- /dev/null
+++ b/libdash/source/xml/Node.cpp
@@ -0,0 +1,1029 @@
+/*
+ * Node.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 "Node.h"
+#include <cstdlib>
+
+using namespace dash::xml;
+using namespace dash::metrics;
+
+Node::Node ()
+{
+}
+Node::Node (const Node& other) :
+ name(other.name),
+ text(other.text),
+ type(other.type),
+ attributes(other.attributes)
+{
+ for (size_t i = 0; i < other.subNodes.size(); i++)
+ this->subNodes.push_back(new Node(*(other.subNodes.at(i))));
+}
+Node::~Node ()
+{
+ for(size_t i = 0; i < this->subNodes.size(); i++)
+ delete(this->subNodes.at(i));
+}
+
+dash::mpd::ProgramInformation* Node::ToProgramInformation () const
+{
+ dash::mpd::ProgramInformation *programInformation = new dash::mpd::ProgramInformation();
+
+ if (this->HasAttribute("lang"))
+ {
+ programInformation->SetLang(this->GetAttributeValue("lang"));
+ }
+ if (this->HasAttribute("moreInformationURL"))
+ {
+ programInformation->SetMoreInformationURL(this->GetAttributeValue("moreInformationURL"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "Title")
+ {
+ programInformation->SetTitle(subNodes.at(i)->GetText());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Source")
+ {
+ programInformation->SetSource(subNodes.at(i)->GetText());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Copyright")
+ {
+ programInformation->SetCopyright(subNodes.at(i)->GetText());
+ continue;
+ }
+ programInformation->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ programInformation->AddRawAttributes(this->attributes);
+ return programInformation;
+}
+dash::mpd::BaseUrl* Node::ToBaseUrl () const
+{
+ dash::mpd::BaseUrl *baseUrl = new dash::mpd::BaseUrl();
+
+ if(this->HasAttribute("serviceLocation"))
+ {
+ baseUrl->SetServiceLocation(this->GetAttributeValue("serviceLocation"));
+ }
+ if(this->HasAttribute("byteRange"))
+ {
+ baseUrl->SetByteRange(this->GetAttributeValue("byteRange"));
+ }
+ if (this->GetText() == "./")
+ {
+ baseUrl->SetUrl(this->mpdPath);
+ }
+ else
+ {
+ baseUrl->SetUrl(this->GetText());
+ }
+
+ baseUrl->AddRawAttributes(this->attributes);
+ return baseUrl;
+}
+dash::mpd::Descriptor* Node::ToDescriptor () const
+{
+ dash::mpd::Descriptor *descriptor = new dash::mpd::Descriptor();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("schemeIdUri"))
+ {
+ descriptor->SetSchemeIdUri(this->GetAttributeValue("schemeIdUri"));
+ }
+ if (this->HasAttribute("value"))
+ {
+ descriptor->SetValue(this->GetAttributeValue("value"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ descriptor->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ descriptor->AddRawAttributes(this->attributes);
+ return descriptor;
+}
+dash::mpd::ContentComponent* Node::ToContentComponent () const
+{
+ dash::mpd::ContentComponent *contentComponent = new dash::mpd::ContentComponent();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("id"))
+ {
+ contentComponent->SetId(strtoul(this->GetAttributeValue("id").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("lang"))
+ {
+ contentComponent->SetLang(this->GetAttributeValue("lang"));
+ }
+ if (this->HasAttribute("contentType"))
+ {
+ contentComponent->SetContentType(this->GetAttributeValue("contentType"));
+ }
+ if (this->HasAttribute("par"))
+ {
+ contentComponent->SetPar(this->GetAttributeValue("par"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "Accessibility")
+ {
+ contentComponent->AddAccessibity(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Role")
+ {
+ contentComponent->AddRole(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Rating")
+ {
+ contentComponent->AddRating(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Viewpoint")
+ {
+ contentComponent->AddViewpoint(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ contentComponent->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ contentComponent->AddRawAttributes(this->attributes);
+ return contentComponent;
+}
+dash::mpd::URLType* Node::ToURLType (HTTPTransactionType type) const
+{
+ dash::mpd::URLType* urlType = new dash::mpd::URLType();
+
+ if (this->HasAttribute("sourceURL"))
+ {
+ urlType->SetSourceURL(this->GetAttributeValue("sourceURL"));
+ }
+ if (this->HasAttribute("range"))
+ {
+ urlType->SetRange(this->GetAttributeValue("range"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ urlType->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ urlType->SetType(type);
+ urlType->AddRawAttributes(this->attributes);
+ return urlType;
+}
+dash::mpd::SegmentBase* Node::ToSegmentBase () const
+{
+ dash::mpd::SegmentBase* segmentBase = new dash::mpd::SegmentBase();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForSeg(*segmentBase);
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() != "Initialization" && subNodes.at(i)->GetName() != "RepresentationIndex")
+ segmentBase->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ segmentBase->AddRawAttributes(this->attributes);
+ return segmentBase;
+}
+dash::mpd::Timeline* Node::ToTimeline () const
+{
+ dash::mpd::Timeline* timeline = new dash::mpd::Timeline();
+
+ if (this->HasAttribute("t"))
+ {
+ timeline->SetStartTime(strtoul(this->GetAttributeValue("t").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("d"))
+ {
+ timeline->SetDuration(strtoul(this->GetAttributeValue("d").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("r"))
+ {
+ timeline->SetRepeatCount(strtoul(this->GetAttributeValue("r").c_str(), NULL, 10));
+ }
+
+ timeline->AddRawAttributes(this->attributes);
+ return timeline;
+}
+dash::mpd::SegmentTimeline* Node::ToSegmentTimeline () const
+{
+ dash::mpd::SegmentTimeline* segmentTimeline = new dash::mpd::SegmentTimeline();
+
+ std::vector<Node *> subNodes = this->GetSubNodes();
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "S")
+ {
+ segmentTimeline->AddTimeline(subNodes.at(i)->ToTimeline());
+ continue;
+ }
+ segmentTimeline->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ segmentTimeline->AddRawAttributes(this->attributes);
+ return segmentTimeline;
+}
+dash::mpd::SegmentURL* Node::ToSegmentURL () const
+{
+ dash::mpd::SegmentURL *segmentUrl = new dash::mpd::SegmentURL();
+
+ if (this->HasAttribute("media"))
+ {
+ segmentUrl->SetMediaURI(this->GetAttributeValue("media"));
+ }
+ if (this->HasAttribute("mediaRange"))
+ {
+ segmentUrl->SetMediaRange(this->GetAttributeValue("mediaRange"));
+ }
+ if (this->HasAttribute("index"))
+ {
+ segmentUrl->SetIndexURI(this->GetAttributeValue("index"));
+ }
+ if (this->HasAttribute("indexRange"))
+ {
+ segmentUrl->SetIndexRange(this->GetAttributeValue("indexRange"));
+ }
+ if(this->HasAttribute("size"))
+ {
+ segmentUrl->SetBitrate(this->GetAttributeValue("size"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ segmentUrl->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ segmentUrl->AddRawAttributes(this->attributes);
+ return segmentUrl;
+}
+dash::mpd::SegmentList* Node::ToSegmentList () const
+{
+ dash::mpd::SegmentList* segmentList = new dash::mpd::SegmentList();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForMSeg(*segmentList);
+
+ if (this->HasAttribute("xlink:href"))
+ {
+ segmentList->SetXlinkHref(this->GetAttributeValue("xlink:href"));
+ }
+ if (this->HasAttribute("xlink:actuate"))
+ {
+ segmentList->SetXlinkActuate(this->GetAttributeValue("xlink:actuate"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "SegmentURL")
+ {
+ segmentList->AddSegmentURL(subNodes.at(i)->ToSegmentURL());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() != "SegmentTimeline" && subNodes.at(i)->GetName() != "BitstreamSwitching" &&
+ subNodes.at(i)->GetName() != "Initialization" && subNodes.at(i)->GetName() != "RepresentationIndex")
+ segmentList->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ segmentList->AddRawAttributes(this->attributes);
+ return segmentList;
+}
+dash::mpd::SegmentTemplate* Node::ToSegmentTemplate () const
+{
+ dash::mpd::SegmentTemplate *segmentTemplate = new dash::mpd::SegmentTemplate();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForMSeg(*segmentTemplate);
+
+ if (this->HasAttribute("media"))
+ {
+ segmentTemplate->SetMedia(this->GetAttributeValue("media"));
+ }
+ if (this->HasAttribute("index"))
+ {
+ segmentTemplate->SetIndex(this->GetAttributeValue("index"));
+ }
+ if (this->HasAttribute("initialization"))
+ {
+ segmentTemplate->SetInitialization(this->GetAttributeValue("initialization"));
+ }
+ if (this->HasAttribute("bitstreamSwitching"))
+ {
+ segmentTemplate->SetBitstreamSwitching(this->GetAttributeValue("bitstreamSwitching"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() != "SegmentTimeline" && subNodes.at(i)->GetName() != "BitstreamSwitching" &&
+ subNodes.at(i)->GetName() != "Initialization" && subNodes.at(i)->GetName() != "RepresentationIndex")
+ segmentTemplate->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ segmentTemplate->AddRawAttributes(this->attributes);
+ return segmentTemplate;
+}
+dash::mpd::SubRepresentation* Node::ToSubRepresentation () const
+{
+ dash::mpd::SubRepresentation* subRepresentation = new dash::mpd::SubRepresentation();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForRep(*subRepresentation);
+
+ if (this->HasAttribute("level"))
+ {
+ subRepresentation->SetLevel(strtoul(this->GetAttributeValue("level").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("dependencyLevel"))
+ {
+ subRepresentation->SetDependencyLevel(this->GetAttributeValue("dependencyLevel"));
+ }
+ if (this->HasAttribute("bandwidth"))
+ {
+ subRepresentation->SetBandWidth(strtoul(this->GetAttributeValue("bandwidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("contentComponent"))
+ {
+ subRepresentation->SetContentComponent(this->GetAttributeValue("contentComponent"));
+ }
+ for (size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() != "FramePacking" && subNodes.at(i)->GetName() != "AudioChannelConfiguration" && subNodes.at(i)->GetName() != "ContentProtection")
+ subRepresentation->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ subRepresentation->AddRawAttributes(this->attributes);
+ return subRepresentation;
+}
+dash::mpd::Representation* Node::ToRepresentation () const
+{
+ dash::mpd::Representation* representation = new dash::mpd::Representation();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForRep(*representation);
+
+ if (this->HasAttribute("id"))
+ {
+ representation->SetId(this->GetAttributeValue("id"));
+ }
+ if (this->HasAttribute("bandwidth"))
+ {
+ representation->SetBandwidth(strtoul(this->GetAttributeValue("bandwidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("qualityRanking"))
+ {
+ representation->SetQualityRanking(strtoul(this->GetAttributeValue("qualityRanking").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("dependencyId"))
+ {
+ representation->SetDependencyId(this->GetAttributeValue("dependencyId"));
+ }
+ if (this->HasAttribute("mediaStreamStructureId"))
+ {
+ representation->SetMediaStreamStructureId(this->GetAttributeValue("mediaStreamStructureId"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "BaseURL")
+ {
+ representation->AddBaseURL(subNodes.at(i)->ToBaseUrl());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SubRepresentation")
+ {
+ representation->AddSubRepresentation(subNodes.at(i)->ToSubRepresentation());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentBase")
+ {
+ representation->SetSegmentBase(subNodes.at(i)->ToSegmentBase());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentList")
+ {
+ representation->SetSegmentList(subNodes.at(i)->ToSegmentList());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentTemplate")
+ {
+ representation->SetSegmentTemplate(subNodes.at(i)->ToSegmentTemplate());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() != "FramePacking" && subNodes.at(i)->GetName() != "AudioChannelConfiguration" && subNodes.at(i)->GetName() != "ContentProtection")
+ representation->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ representation->AddRawAttributes(this->attributes);
+ return representation;
+}
+dash::mpd::AdaptationSet* Node::ToAdaptationSet () const
+{
+ dash::mpd::AdaptationSet *adaptationSet = new dash::mpd::AdaptationSet();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForRep(*adaptationSet);
+
+ if (this->HasAttribute("xlink:href"))
+ {
+ adaptationSet->SetXlinkHref(this->GetAttributeValue("xlink:href"));
+ }
+ if (this->HasAttribute("xlink:actuate"))
+ {
+ adaptationSet->SetXlinkActuate(this->GetAttributeValue("xlink:actuate"));
+ }
+ if (this->HasAttribute("id"))
+ {
+ adaptationSet->SetId(strtoul(this->GetAttributeValue("id").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("group"))
+ {
+ adaptationSet->SetGroup(strtoul(this->GetAttributeValue("group").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("lang"))
+ {
+ adaptationSet->SetLang(this->GetAttributeValue("lang"));
+ }
+ if (this->HasAttribute("contentType"))
+ {
+ adaptationSet->SetContentType(this->GetAttributeValue("contentType"));
+ }
+ if (this->HasAttribute("par"))
+ {
+ adaptationSet->SetPar(this->GetAttributeValue("par"));
+ }
+ if (this->HasAttribute("minBandwidth"))
+ {
+ adaptationSet->SetMinBandwidth(strtoul(this->GetAttributeValue("minBandwidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("maxBandwidth"))
+ {
+ adaptationSet->SetMaxBandwidth(strtoul(this->GetAttributeValue("maxBandwidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("minWidth"))
+ {
+ adaptationSet->SetMinWidth(strtoul(this->GetAttributeValue("minWidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("maxWidth"))
+ {
+ adaptationSet->SetMaxWidth(strtoul(this->GetAttributeValue("maxWidth").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("minHeight"))
+ {
+ adaptationSet->SetMinHeight(strtoul(this->GetAttributeValue("minHeight").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("maxHeight"))
+ {
+ adaptationSet->SetMaxHeight(strtoul(this->GetAttributeValue("maxHeight").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("minFrameRate"))
+ {
+ adaptationSet->SetMinFramerate(this->GetAttributeValue("minFrameRate"));
+ }
+ if (this->HasAttribute("maxFrameRate"))
+ {
+ adaptationSet->SetMaxFramerate(this->GetAttributeValue("maxFrameRate"));
+ }
+ if (this->HasAttribute("segmentAlignment"))
+ {
+ adaptationSet->SetSegmentAlignment(this->GetAttributeValue("segmentAlignment"));
+ }
+ if (this->HasAttribute("subsegmentAlignment"))
+ {
+ adaptationSet->SetSubsegmentAlignment(this->GetAttributeValue("subsegmentAlignment"));
+ }
+ if (this->HasAttribute("subsegmentStartsWithSAP"))
+ {
+ adaptationSet->SetMaxHeight((uint8_t) strtoul(this->GetAttributeValue("subsegmentStartsWithSAP").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("bitstreamSwitching"))
+ {
+ adaptationSet->SetBitstreamSwitching(dash::helpers::String::ToBool(this->GetAttributeValue("bitstreamSwitching")));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "Accessibility")
+ {
+ adaptationSet->AddAccessibity(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Role")
+ {
+ adaptationSet->AddRole(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Rating")
+ {
+ adaptationSet->AddRating(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Viewpoint")
+ {
+ adaptationSet->AddViewpoint(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "ContentComponent")
+ {
+ adaptationSet->AddContentComponent(subNodes.at(i)->ToContentComponent());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "BaseURL")
+ {
+ adaptationSet->AddBaseURL(subNodes.at(i)->ToBaseUrl());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentBase")
+ {
+ adaptationSet->SetSegmentBase(subNodes.at(i)->ToSegmentBase());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentList")
+ {
+ adaptationSet->SetSegmentList(subNodes.at(i)->ToSegmentList());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentTemplate")
+ {
+ adaptationSet->SetSegmentTemplate(subNodes.at(i)->ToSegmentTemplate());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Representation")
+ {
+ adaptationSet->AddRepresentation(subNodes.at(i)->ToRepresentation());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() != "FramePacking" && subNodes.at(i)->GetName() != "AudioChannelConfiguration" && subNodes.at(i)->GetName() != "ContentProtection")
+ adaptationSet->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ adaptationSet->AddRawAttributes(this->attributes);
+ return adaptationSet;
+}
+dash::mpd::Subset* Node::ToSubset () const
+{
+ dash::mpd::Subset *subset = new dash::mpd::Subset();
+
+ if (this->HasAttribute("contains"))
+ {
+ subset->SetSubset(this->GetAttributeValue("contains"));
+ }
+
+ subset->AddRawAttributes(this->attributes);
+ return subset;
+}
+dash::mpd::Period* Node::ToPeriod () const
+{
+ dash::mpd::Period *period = new dash::mpd::Period();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("xlink:href"))
+ {
+ period->SetXlinkHref(this->GetAttributeValue("xlink:href"));
+ }
+ if (this->HasAttribute("xlink:actuate"))
+ {
+ period->SetXlinkActuate(this->GetAttributeValue("xlink:actuate"));
+ }
+ if (this->HasAttribute("id"))
+ {
+ period->SetId(this->GetAttributeValue("id"));
+ }
+ if (this->HasAttribute("start"))
+ {
+ period->SetStart(this->GetAttributeValue("start"));
+ }
+ if (this->HasAttribute("duration"))
+ {
+ period->SetDuration(this->GetAttributeValue("duration"));
+ }
+ if (this->HasAttribute("bitstreamSwitching"))
+ {
+ period->SetBitstreamSwitching(dash::helpers::String::ToBool(this->GetAttributeValue("bitstreamSwitching")));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "BaseURL")
+ {
+ period->AddBaseURL(subNodes.at(i)->ToBaseUrl());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "AdaptationSet")
+ {
+ period->AddAdaptationSet(subNodes.at(i)->ToAdaptationSet());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Subset")
+ {
+ period->AddSubset(subNodes.at(i)->ToSubset());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentBase")
+ {
+ period->SetSegmentBase(subNodes.at(i)->ToSegmentBase());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentList")
+ {
+ period->SetSegmentList(subNodes.at(i)->ToSegmentList());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "SegmentTemplate")
+ {
+ period->SetSegmentTemplate(subNodes.at(i)->ToSegmentTemplate());
+ continue;
+ }
+ period->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ period->AddRawAttributes(this->attributes);
+ return period;
+}
+dash::mpd::Range* Node::ToRange () const
+{
+ dash::mpd::Range* range = new dash::mpd::Range();
+
+ if (this->HasAttribute("starttime"))
+ {
+ range->SetStarttime(this->GetAttributeValue("starttime"));
+ }
+ if (this->HasAttribute("duration"))
+ {
+ range->SetDuration(this->GetAttributeValue("duration"));
+ }
+
+ return range;
+}
+dash::mpd::Metrics* Node::ToMetrics () const
+{
+ dash::mpd::Metrics* metrics = new dash::mpd::Metrics();
+
+ if (this->HasAttribute("metrics"))
+ {
+ metrics->SetMetrics(this->GetAttributeValue("metrics"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "Reporting")
+ {
+ metrics->AddReporting(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Range")
+ {
+ metrics->AddRange(subNodes.at(i)->ToRange());
+ continue;
+ }
+ metrics->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ metrics->AddRawAttributes(this->attributes);
+ return metrics;
+}
+dash::mpd::MPD* Node::ToMPD () const
+{
+ dash::mpd::MPD *mpd = new dash::mpd::MPD();
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("id"))
+ {
+ mpd->SetId(this->GetAttributeValue("id"));
+ }
+ if (this->HasAttribute("profiles"))
+ {
+ mpd->SetProfiles(this->GetAttributeValue("profiles"));
+ }
+ if (this->HasAttribute("type"))
+ {
+ mpd->SetType(this->GetAttributeValue("type"));
+ }
+ if (this->HasAttribute("availabilityStartTime"))
+ {
+ mpd->SetAvailabilityStarttime(this->GetAttributeValue("availabilityStartTime"));
+ }
+ if (this->HasAttribute("availabilityEndTime"))
+ {
+ mpd->SetAvailabilityEndtime(this->GetAttributeValue("availabilityEndTime"));
+ }
+ if (this->HasAttribute("mediaPresentationDuration"))
+ {
+ mpd->SetMediaPresentationDuration(this->GetAttributeValue("mediaPresentationDuration"));
+ }
+ if (this->HasAttribute("minimumUpdatePeriod"))
+ {
+ mpd->SetMinimumUpdatePeriod(this->GetAttributeValue("minimumUpdatePeriod"));
+ }
+ if (this->HasAttribute("minBufferTime"))
+ {
+ mpd->SetMinBufferTime(this->GetAttributeValue("minBufferTime"));
+ }
+ if (this->HasAttribute("timeShiftBufferDepth"))
+ {
+ mpd->SetTimeShiftBufferDepth(this->GetAttributeValue("timeShiftBufferDepth"));
+ }
+ if (this->HasAttribute("suggestedPresentationDelay"))
+ {
+ mpd->SetSuggestedPresentationDelay(this->GetAttributeValue("suggestedPresentationDelay"));
+ }
+ if (this->HasAttribute("maxSegmentDuration"))
+ {
+ mpd->SetMaxSegmentDuration(this->GetAttributeValue("maxSegmentDuration"));
+ }
+ if (this->HasAttribute("maxSubsegmentDuration"))
+ {
+ mpd->SetMaxSubsegmentDuration(this->GetAttributeValue("maxSubsegmentDuration"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "ProgramInformation")
+ {
+ mpd->AddProgramInformation(subNodes.at(i)->ToProgramInformation());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "BaseURL")
+ {
+ mpd->AddBaseUrl(subNodes.at(i)->ToBaseUrl());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Location")
+ {
+ mpd->AddLocation(subNodes.at(i)->GetText());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Period")
+ {
+ mpd->AddPeriod(subNodes.at(i)->ToPeriod());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "Metrics")
+ {
+ mpd->AddMetrics(subNodes.at(i)->ToMetrics());
+ continue;
+ }
+ mpd->AddAdditionalSubNode((xml::INode *) new Node(*(subNodes.at(i))));
+ }
+
+ dash::mpd::BaseUrl *mpdPathBaseUrl = new dash::mpd::BaseUrl();
+ mpdPathBaseUrl->SetUrl(mpdPath);
+ mpd->SetMPDPathBaseUrl(mpdPathBaseUrl);
+
+ mpd->AddRawAttributes(this->attributes);
+ return mpd;
+}
+void Node::SetMPDPath (std::string path)
+{
+ this->mpdPath = path;
+}
+
+const std::vector<INode*>& Node::GetNodes () const
+{
+ return (std::vector<INode*> &) this->subNodes;
+}
+const std::vector<Node*>& Node::GetSubNodes () const
+{
+ return this->subNodes;
+}
+void Node::AddSubNode (Node *node)
+{
+ this->subNodes.push_back(node);
+}
+const std::string& Node::GetName () const
+{
+ return this->name;
+}
+void Node::SetName (const std::string &name)
+{
+ this->name = name;
+}
+const std::string& Node::GetAttributeValue (std::string key) const
+{
+ //return this->attributes[key];
+ return this->attributes.find(key)->second;
+}
+bool Node::HasAttribute (const std::string& name) const
+{
+ if(this->attributes.find(name) != this->attributes.end())
+ return true;
+
+ return false;
+}
+void Node::AddAttribute (const std::string &key, const std::string &value)
+{
+ this->attributes[key] = value;
+}
+std::vector<std::string> Node::GetAttributeKeys () const
+{
+ std::vector<std::string> keys;
+ std::map<std::string, std::string>::const_iterator it;
+
+ for(it = this->attributes.begin(); it != this->attributes.end(); ++it)
+ {
+ keys.push_back(it->first);
+ }
+ return keys;
+}
+bool Node::HasText () const
+{
+ return false;
+}
+std::string Node::GetText () const
+{
+ if(this->type == 3)
+ return this->text;
+ else
+ {
+ if(this->subNodes.size())
+ return this->subNodes[0]->GetText();
+ else
+ return "";
+ }
+}
+void Node::SetText (const std::string &text)
+{
+ this->text = text;
+}
+void Node::Print (std::ostream &stream) const
+{
+ stream << this->name;
+ std::vector<std::string> keys = this->GetAttributeKeys();
+ for(size_t i = 0; i < keys.size(); i++)
+ stream << " " << keys.at(i) << "=" << this->GetAttributeValue(keys.at(i));
+
+ stream << std::endl;
+}
+const std::map<std::string,std::string>& Node::GetAttributes () const
+{
+ return this->attributes;
+}
+int Node::GetType () const
+{
+ return this->type;
+}
+void Node::SetType (int type)
+{
+ this->type = type;
+}
+void Node::SetCommonValuesForRep (dash::mpd::RepresentationBase& object) const
+{
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("profiles"))
+ {
+ object.SetProfiles(this->GetAttributeValue("profiles"));
+ }
+ if (this->HasAttribute("width"))
+ {
+ object.SetWidth(strtoul(this->GetAttributeValue("width").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("height"))
+ {
+ object.SetHeight(strtoul(this->GetAttributeValue("height").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("sar"))
+ {
+ object.SetSar(this->GetAttributeValue("sar"));
+ }
+ if (this->HasAttribute("frameRate"))
+ {
+ object.SetFrameRate(this->GetAttributeValue("frameRate"));
+ }
+ if (this->HasAttribute("audioSamplingRate"))
+ {
+ object.SetAudioSamplingRate(this->GetAttributeValue("audioSamplingRate"));
+ }
+ if (this->HasAttribute("mimeType"))
+ {
+ object.SetMimeType(this->GetAttributeValue("mimeType"));
+ }
+ if (this->HasAttribute("segmentProfiles"))
+ {
+ object.SetSegmentProfiles(this->GetAttributeValue("segmentProfiles"));
+ }
+ if (this->HasAttribute("codecs"))
+ {
+ object.SetCodecs(this->GetAttributeValue("codecs"));
+ }
+ if (this->HasAttribute("maximumSAPPeriod"))
+ {
+ object.SetMaximumSAPPeriod(strtod(this->GetAttributeValue("maximumSAPPeriod").c_str(), NULL));
+ }
+ if (this->HasAttribute("startWithSAP"))
+ {
+ object.SetStartWithSAP((uint8_t) strtoul(this->GetAttributeValue("startWithSAP").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("maxPlayoutRate"))
+ {
+ object.SetMaxPlayoutRate(strtod(this->GetAttributeValue("maxPlayoutRate").c_str(), NULL));
+ }
+ if (this->HasAttribute("codingDependency"))
+ {
+ object.SetCodingDependency(dash::helpers::String::ToBool(this->GetAttributeValue("codingDependency")));
+ }
+ if (this->HasAttribute("scanType"))
+ {
+ object.SetScanType(this->GetAttributeValue("scanType"));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "FramePacking")
+ {
+ object.AddFramePacking(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "AudioChannelConfiguration")
+ {
+ object.AddAudioChannelConfiguration(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "ContentProtection")
+ {
+ object.AddContentProtection(subNodes.at(i)->ToDescriptor());
+ continue;
+ }
+ }
+}
+void Node::SetCommonValuesForSeg (dash::mpd::SegmentBase& object) const
+{
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ if (this->HasAttribute("timescale"))
+ {
+ object.SetTimescale(strtoul(this->GetAttributeValue("timescale").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("presentationTimeOffset"))
+ {
+ object.SetPresentationTimeOffset(strtoul(this->GetAttributeValue("presentationTimeOffset").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("indexRange"))
+ {
+ object.SetIndexRange(this->GetAttributeValue("indexRange"));
+ }
+ if (this->HasAttribute("indexRangeExact"))
+ {
+ object.SetIndexRangeExact(dash::helpers::String::ToBool(this->GetAttributeValue("indexRangeExact")));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "Initialization")
+ {
+ object.SetInitialization(subNodes.at(i)->ToURLType(dash::metrics::InitializationSegment));
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "RepresentationIndex")
+ {
+ object.SetRepresentationIndex(subNodes.at(i)->ToURLType(dash::metrics::IndexSegment));
+ continue;
+ }
+ }
+}
+void Node::SetCommonValuesForMSeg(dash::mpd::MultipleSegmentBase& object) const
+{
+ std::vector<Node *> subNodes = this->GetSubNodes();
+
+ SetCommonValuesForSeg(object);
+
+ if (this->HasAttribute("duration"))
+ {
+ object.SetDuration(strtoul(this->GetAttributeValue("duration").c_str(), NULL, 10));
+ }
+ if (this->HasAttribute("startNumber"))
+ {
+ object.SetStartNumber(strtoul(this->GetAttributeValue("startNumber").c_str(), NULL, 10));
+ }
+
+ for(size_t i = 0; i < subNodes.size(); i++)
+ {
+ if (subNodes.at(i)->GetName() == "SegmentTimeline")
+ {
+ object.SetSegmentTimeline(subNodes.at(i)->ToSegmentTimeline());
+ continue;
+ }
+ if (subNodes.at(i)->GetName() == "BitstreamSwitching")
+ {
+ object.SetBitstreamSwitching(subNodes.at(i)->ToURLType(dash::metrics::BitstreamSwitchingSegment));
+ continue;
+ }
+ }
+
+}
diff --git a/libdash/source/xml/Node.h b/libdash/source/xml/Node.h
new file mode 100644
index 00000000..552d83e5
--- /dev/null
+++ b/libdash/source/xml/Node.h
@@ -0,0 +1,105 @@
+/*
+ * Node.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 NODE_H_
+#define NODE_H_
+
+#include "config.h"
+
+#include "INode.h"
+#include "../helpers/String.h"
+#include "../mpd/AdaptationSet.h"
+#include "../mpd/BaseUrl.h"
+#include "../mpd/ContentComponent.h"
+#include "../mpd/Descriptor.h"
+#include "../mpd/Metrics.h"
+#include "../mpd/MPD.h"
+#include "../mpd/MultipleSegmentBase.h"
+#include "../mpd/Period.h"
+#include "../mpd/ProgramInformation.h"
+#include "../mpd/Range.h"
+#include "../mpd/Representation.h"
+#include "../mpd/RepresentationBase.h"
+#include "../mpd/SegmentBase.h"
+#include "../mpd/SegmentList.h"
+#include "../mpd/SegmentTemplate.h"
+#include "../mpd/SegmentTimeline.h"
+#include "../mpd/SegmentURL.h"
+#include "../mpd/SubRepresentation.h"
+#include "../mpd/Subset.h"
+#include "../mpd/URLType.h"
+#include "IHTTPTransaction.h"
+
+namespace dash
+{
+ namespace xml
+ {
+ class Node : public INode
+ {
+ public:
+ Node ();
+ Node (const Node& other);
+ virtual ~Node ();
+
+ const std::vector<INode *>& GetNodes () const;
+ const std::vector<Node *>& GetSubNodes () const;
+ std::vector<std::string> GetAttributeKeys () const;
+ const std::string& GetName () const;
+ std::string GetText () const;
+ const std::map<std::string, std::string>& GetAttributes () const;
+ int GetType () const;
+ void SetType (int type);
+ const std::string& GetAttributeValue (std::string key) const;
+ void AddSubNode (Node *node);
+ void SetName (const std::string &name);
+ bool HasAttribute (const std::string& name) const;
+ void AddAttribute (const std::string &key, const std::string &value);
+ bool HasText () const;
+ void SetText (const std::string &text);
+ void Print (std::ostream &stream) const;
+ dash::mpd::MPD* ToMPD () const;
+ void SetMPDPath (std::string path);
+
+ private:
+ void SetCommonValuesForRep (dash::mpd::RepresentationBase& object) const;
+ void SetCommonValuesForSeg (dash::mpd::SegmentBase& object) const;
+ void SetCommonValuesForMSeg (dash::mpd::MultipleSegmentBase& object) const;
+ dash::mpd::AdaptationSet* ToAdaptationSet () const;
+ dash::mpd::BaseUrl* ToBaseUrl () const;
+ dash::mpd::ContentComponent* ToContentComponent () const;
+ dash::mpd::Descriptor* ToDescriptor () const;
+ dash::mpd::Metrics* ToMetrics () const;
+ dash::mpd::Period* ToPeriod () const;
+ dash::mpd::ProgramInformation* ToProgramInformation () const;
+ dash::mpd::Range* ToRange () const;
+ dash::mpd::Representation* ToRepresentation () const;
+ dash::mpd::SegmentBase* ToSegmentBase () const;
+ dash::mpd::SegmentList* ToSegmentList () const;
+ dash::mpd::SegmentTemplate* ToSegmentTemplate () const;
+ dash::mpd::Timeline* ToTimeline () const;
+ dash::mpd::SegmentTimeline* ToSegmentTimeline () const;
+ dash::mpd::SegmentURL* ToSegmentURL () const;
+ dash::mpd::SubRepresentation* ToSubRepresentation () const;
+ dash::mpd::Subset* ToSubset () const;
+ dash::mpd::URLType* ToURLType (dash::metrics::HTTPTransactionType transActType) const;
+
+ std::vector<Node *> subNodes;
+ std::map<std::string, std::string> attributes;
+ std::string name;
+ std::string text;
+ int type;
+ std::string mpdPath;
+
+ };
+ }
+}
+
+#endif /* NODE_H_ */