diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp
index cec6cf09bca668d68b6e17ba6e9ed45893903654..897bb0e6a38f17be50e8ebb259af1b18d4b7eb8f 100644
--- a/modules/demux/dash/DASHManager.cpp
+++ b/modules/demux/dash/DASHManager.cpp
@@ -42,6 +42,8 @@
 #include "SegmentTracker.hpp"
 #include <vlc_stream.h>
 
+#include <algorithm>
+
 using namespace dash;
 using namespace dash::http;
 using namespace dash::logic;
diff --git a/modules/demux/dash/Streams.cpp b/modules/demux/dash/Streams.cpp
index b85c8e31ee54efe9ede3cc8bd0a683f5bc40063a..4858fa9a50eebe38aec985863ec9681211bacfa1 100644
--- a/modules/demux/dash/Streams.cpp
+++ b/modules/demux/dash/Streams.cpp
@@ -87,14 +87,14 @@ Format Stream::mimeToFormat(const std::string &mime)
     return format;
 }
 
-void Stream::create(demux_t *demux, AbstractAdaptationLogic *logic, SegmentTracker *tracker)
+void Stream::create(demux_t *demux, AbstractAdaptationLogic *logic, dash::SegmentTracker *tracker)
 {
     switch(format)
     {
-        case Streams::MP4:
+        case dash::Streams::MP4:
             output = new MP4StreamOutput(demux);
             break;
-        case Streams::MPEG2TS:
+        case dash::Streams::MPEG2TS:
             output = new MPEG2TSStreamOutput(demux);
             break;
         default:
diff --git a/modules/demux/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/demux/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
index 7d7b435c4bbf7b038771836ed7982efb4f4c7300..5535cd6dde6a0d0f74b657dd921d523b3f289b0a 100644
--- a/modules/demux/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+++ b/modules/demux/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
@@ -36,7 +36,7 @@ AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic    (MPD *mpd) :
 {
 }
 
-Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation(Streams::Type type, mpd::Period *period) const
+Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation(dash::Streams::Type type, Period *period) const
 {
     RepresentationSelector selector;
     return selector.select(period, type);
diff --git a/modules/demux/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp b/modules/demux/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
index 43f019cb3791e9fd8275abe558b472d0882fa3e6..e42b5794d16fcb49698f36079fce8988fe55b9f3 100644
--- a/modules/demux/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
+++ b/modules/demux/dash/adaptationlogic/AlwaysLowestAdaptationLogic.cpp
@@ -23,12 +23,12 @@
 using namespace dash::logic;
 using namespace dash::mpd;
 
-AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(mpd::MPD *mpd):
+AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(MPD *mpd):
     AbstractAdaptationLogic(mpd)
 {
 }
 
-Representation *AlwaysLowestAdaptationLogic::getCurrentRepresentation(Streams::Type type, mpd::Period *period) const
+Representation *AlwaysLowestAdaptationLogic::getCurrentRepresentation(dash::Streams::Type type, Period *period) const
 {
     RepresentationSelector selector;
     return selector.select(period, type, 0);
diff --git a/modules/demux/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/demux/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
index 58fc0ecff75b88619c6cd911a670bb0e4de63ec3..bd9cf3b08458fcef3d951d1497b027e7c4a0165c 100644
--- a/modules/demux/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+++ b/modules/demux/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
@@ -44,7 +44,7 @@ RateBasedAdaptationLogic::RateBasedAdaptationLogic  (MPD *mpd) :
     height = var_InheritInteger(mpd->getVLCObject(), "dash-prefheight");
 }
 
-Representation *RateBasedAdaptationLogic::getCurrentRepresentation(Streams::Type type, mpd::Period *period) const
+Representation *RateBasedAdaptationLogic::getCurrentRepresentation(dash::Streams::Type type, Period *period) const
 {
     if(period == NULL)
         return NULL;
@@ -78,13 +78,13 @@ void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
         currentBps = bpsAvg;
 }
 
-FixedRateAdaptationLogic::FixedRateAdaptationLogic(mpd::MPD *mpd) :
+FixedRateAdaptationLogic::FixedRateAdaptationLogic(MPD *mpd) :
     AbstractAdaptationLogic(mpd)
 {
     currentBps = var_InheritInteger( mpd->getVLCObject(), "dash-prefbw" ) * 8192;
 }
 
-Representation *FixedRateAdaptationLogic::getCurrentRepresentation(Streams::Type type, mpd::Period *period) const
+Representation *FixedRateAdaptationLogic::getCurrentRepresentation(dash::Streams::Type type, Period *period) const
 {
     if(period == NULL)
         return NULL;
diff --git a/modules/demux/dash/adaptationlogic/Representationselectors.cpp b/modules/demux/dash/adaptationlogic/Representationselectors.cpp
index 697a96ef3ff97fb6c2c2fab14df21a19ad4b94a8..d56b630e036905e9856fff5b891152135c6ce0a3 100644
--- a/modules/demux/dash/adaptationlogic/Representationselectors.cpp
+++ b/modules/demux/dash/adaptationlogic/Representationselectors.cpp
@@ -26,11 +26,11 @@ RepresentationSelector::RepresentationSelector()
 {
 }
 
-Representation * RepresentationSelector::select(Period *period, Streams::Type type) const
+Representation * RepresentationSelector::select(Period *period, dash::Streams::Type type) const
 {
     return select(period, type, std::numeric_limits<uint64_t>::max());
 }
-Representation * RepresentationSelector::select(Period *period, Streams::Type type, uint64_t bitrate) const
+Representation * RepresentationSelector::select(Period *period, dash::Streams::Type type, uint64_t bitrate) const
 {
     if (period == NULL)
         return NULL;
@@ -53,7 +53,7 @@ Representation * RepresentationSelector::select(Period *period, Streams::Type ty
     return best;
 }
 
-Representation * RepresentationSelector::select(Period *period, Streams::Type type, uint64_t bitrate,
+Representation * RepresentationSelector::select(Period *period, dash::Streams::Type type, uint64_t bitrate,
                                                 int width, int height) const
 {
     if(period == NULL)
diff --git a/modules/demux/dash/mpd/Period.cpp b/modules/demux/dash/mpd/Period.cpp
index 1487d48c70ebb076fe2cb5c67533e3a730ab29fb..4525ab53738d30a284349dc809ab43bf7da62b05 100644
--- a/modules/demux/dash/mpd/Period.cpp
+++ b/modules/demux/dash/mpd/Period.cpp
@@ -54,7 +54,7 @@ const std::vector<AdaptationSet*>&  Period::getAdaptationSets() const
     return this->adaptationSets;
 }
 
-const std::vector<AdaptationSet*>   Period::getAdaptationSets(Streams::Type type) const
+const std::vector<AdaptationSet*>   Period::getAdaptationSets(dash::Streams::Type type) const
 {
     std::vector<AdaptationSet*> list;
     std::vector<AdaptationSet*>::const_iterator it;
@@ -75,7 +75,7 @@ void                                Period::addAdaptationSet(AdaptationSet *adap
     }
 }
 
-AdaptationSet * Period::getAdaptationSet(Streams::Type type) const
+AdaptationSet * Period::getAdaptationSet(dash::Streams::Type type) const
 {
     std::vector<AdaptationSet *>::const_iterator it;
     for(it = adaptationSets.begin(); it != adaptationSets.end(); it++)
diff --git a/modules/demux/dash/mpd/SegmentTimeline.cpp b/modules/demux/dash/mpd/SegmentTimeline.cpp
index 7ca8cbf0720ebeb6f3f853c731aab148da4dc8ff..de50270881004e1ee16e5b0a9303155773bf88d3 100644
--- a/modules/demux/dash/mpd/SegmentTimeline.cpp
+++ b/modules/demux/dash/mpd/SegmentTimeline.cpp
@@ -28,6 +28,8 @@
 
 #include "SegmentTimeline.h"
 
+#include <algorithm>
+
 using namespace dash::mpd;
 
 SegmentTimeline::SegmentTimeline(TimescaleAble *parent)