]> git.sesse.net Git - vlc/commitdiff
Added DASH stream filter
authorChristopher Mueller <christopher.mueller@itec.aau.at>
Fri, 7 Oct 2011 02:36:57 +0000 (19:36 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 26 Oct 2011 05:43:18 +0000 (07:43 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
71 files changed:
configure.ac
modules/stream_filter/Modules.am
modules/stream_filter/dash/DASHManager.cpp [new file with mode: 0644]
modules/stream_filter/dash/DASHManager.h [new file with mode: 0644]
modules/stream_filter/dash/Modules.am [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/IDownloadRateObserver.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/NullAdaptationLogic.h [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp [new file with mode: 0644]
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h [new file with mode: 0644]
modules/stream_filter/dash/dash.cpp [new file with mode: 0644]
modules/stream_filter/dash/exceptions/AttributeNotPresentException.h [new file with mode: 0644]
modules/stream_filter/dash/exceptions/EOFException.h [new file with mode: 0644]
modules/stream_filter/dash/exceptions/ElementNotPresentException.h [new file with mode: 0644]
modules/stream_filter/dash/http/Chunk.cpp [new file with mode: 0644]
modules/stream_filter/dash/http/Chunk.h [new file with mode: 0644]
modules/stream_filter/dash/http/HTTPConnection.cpp [new file with mode: 0644]
modules/stream_filter/dash/http/HTTPConnection.h [new file with mode: 0644]
modules/stream_filter/dash/http/HTTPConnectionManager.cpp [new file with mode: 0644]
modules/stream_filter/dash/http/HTTPConnectionManager.h [new file with mode: 0644]
modules/stream_filter/dash/http/IHTTPConnection.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Accessibility.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/BaseUrl.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/BasicCMManager.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/BasicCMManager.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/BasicCMParser.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/BasicCMParser.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/ContentDescription.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/ContentDescription.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/ContentProtection.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Group.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/Group.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/IMPDManager.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/IMPDParser.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/ISegment.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/InitSegment.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/InitSegment.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/MPD.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/MPD.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/MPDManagerFactory.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/MPDManagerFactory.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/NullManager.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/NullManager.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Period.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/Period.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/ProgramInformation.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/ProgramInformation.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Rating.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Representation.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/Representation.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/SchemeInformation.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/SchemeInformation.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Segment.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/Segment.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/SegmentInfo.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/SegmentInfo.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/TrickModeType.cpp [new file with mode: 0644]
modules/stream_filter/dash/mpd/TrickModeType.h [new file with mode: 0644]
modules/stream_filter/dash/mpd/Viewpoint.h [new file with mode: 0644]
modules/stream_filter/dash/xml/DOMHelper.cpp [new file with mode: 0644]
modules/stream_filter/dash/xml/DOMHelper.h [new file with mode: 0644]
modules/stream_filter/dash/xml/DOMParser.cpp [new file with mode: 0644]
modules/stream_filter/dash/xml/DOMParser.h [new file with mode: 0644]
modules/stream_filter/dash/xml/Node.cpp [new file with mode: 0644]
modules/stream_filter/dash/xml/Node.h [new file with mode: 0644]

index d30dc83cde92f78aac528a19c0acbea99359cf98..63dd1fe7b1b72733e8d106170c4ff1b169be9d72 100644 (file)
@@ -4311,6 +4311,7 @@ AC_CONFIG_FILES([
   modules/packetizer/Makefile
   modules/services_discovery/Makefile
   modules/stream_filter/Makefile
+  modules/stream_filter/dash/Makefile
   modules/stream_out/Makefile
   modules/stream_out/transcode/Makefile
   modules/text_renderer/Makefile
index bdc2e69d55dd8be999da83029f77b37d7c8bac2e..a864ebafe4770ce04496e8b9765dafedf2f26541 100644 (file)
@@ -1,3 +1,5 @@
+SUBDIRS = dash
+
 SOURCES_decomp = decomp.c
 SOURCES_stream_filter_record = record.c
 SOURCES_stream_filter_httplive = httplive.c
diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp
new file mode 100644 (file)
index 0000000..7483ca4
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * DASHManager.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "DASHManager.h"
+
+using namespace dash;
+using namespace dash::http;
+using namespace dash::xml;
+using namespace dash::logic;
+using namespace dash::mpd;
+using namespace dash::exception;
+
+DASHManager::DASHManager    (HTTPConnectionManager *conManager, Node *node, IAdaptationLogic::LogicType type, Profile profile)
+{
+    this->conManager        = conManager;
+    this->node              = node;
+    this->logicType         = type;
+    this->profile           = profile;
+    this->mpdManagerFactory = new MPDManagerFactory();
+    this->mpdManager        = this->mpdManagerFactory->create(this->profile, this->node);
+    this->logicFactory      = new AdaptationLogicFactory();
+    this->adaptationLogic   = this->logicFactory->create(this->logicType, this->mpdManager);
+    this->currentChunk      = NULL;
+
+    this->conManager->attach(this->adaptationLogic);
+}
+DASHManager::~DASHManager   ()
+{
+    delete(this->logicFactory);
+    delete(this->adaptationLogic);
+    delete(this->mpdManager);
+}
+
+int DASHManager::read   (void *p_buffer, size_t len)
+{
+    if(this->currentChunk == NULL)
+    {
+        try
+        {
+            this->currentChunk = this->adaptationLogic->getNextChunk();
+        }
+        catch(EOFException &e)
+        {
+            this->currentChunk = NULL;
+            return 0;
+        }
+    }
+
+    int ret = this->conManager->read(this->currentChunk, p_buffer, len);
+
+    if(ret <= 0)
+    {
+        this->currentChunk = NULL;
+        return this->read(p_buffer, len);
+    }
+
+    return ret;
+}
+int DASHManager::peek   (const uint8_t **pp_peek, size_t i_peek)
+{
+    if(this->currentChunk == NULL)
+    {
+        try
+        {
+            this->currentChunk = this->adaptationLogic->getNextChunk();
+        }
+        catch(EOFException &e)
+        {
+            return 0;
+        }
+    }
+
+    int ret = this->conManager->peek(this->currentChunk, pp_peek, i_peek);
+    return ret;
+}
diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h
new file mode 100644 (file)
index 0000000..394d010
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * DASHManager.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef DASHMANAGER_H_
+#define DASHMANAGER_H_
+
+#include <stdint.h>
+#include <stddef.h>
+#include <iostream>
+
+#include "http/HTTPConnectionManager.h"
+#include "xml/Node.h"
+#include "adaptationlogic/IAdaptationLogic.h"
+#include "adaptationlogic/AdaptationLogicFactory.h"
+#include "mpd/IMPDManager.h"
+#include "mpd/MPDManagerFactory.h"
+#include "exceptions/EOFException.h"
+
+namespace dash
+{
+    class DASHManager
+    {
+        public:
+            DASHManager             (http::HTTPConnectionManager *conManager, xml::Node *node, logic::IAdaptationLogic::LogicType type, mpd::Profile profile);
+            virtual ~DASHManager    ();
+
+            int read        (void *p_buffer, size_t len);
+            int peek        (const uint8_t **pp_peek, size_t i_peek);
+
+        private:
+            http::HTTPConnectionManager         *conManager;
+            http::Chunk                         *currentChunk;
+            logic::AdaptationLogicFactory       *logicFactory;
+            logic::IAdaptationLogic             *adaptationLogic;
+            logic::IAdaptationLogic::LogicType  logicType;
+            mpd::Profile                        profile;
+            xml::Node                           *node;
+            mpd::MPDManagerFactory              *mpdManagerFactory;
+            mpd::IMPDManager                    *mpdManager;
+    };
+}
+
+#endif /* DASHMANAGER_H_ */
diff --git a/modules/stream_filter/dash/Modules.am b/modules/stream_filter/dash/Modules.am
new file mode 100644 (file)
index 0000000..01ff93c
--- /dev/null
@@ -0,0 +1,71 @@
+SOURCES_stream_filter_dash = \
+    adaptationlogic/AbstractAdaptationLogic.cpp \
+    adaptationlogic/AbstractAdaptationLogic.h \
+    adaptationlogic/AdaptationLogicFactory.cpp \
+    adaptationlogic/AdaptationLogicFactory.h \
+    adaptationlogic/AlwaysBestAdaptationLogic.cpp \
+    adaptationlogic/AlwaysBestAdaptationLogic.h \
+    adaptationlogic/IAdaptationLogic.h \
+    adaptationlogic/IDownloadRateObserver.h \
+    adaptationlogic/NullAdaptationLogic.h \
+    adaptationlogic/RateBasedAdaptationLogic.h \
+    adaptationlogic/RateBasedAdaptationLogic.cpp \
+    exceptions/AttributeNotPresentException.h \
+    exceptions/ElementNotPresentException.h \
+    exceptions/EOFException.h \
+    http/Chunk.cpp \
+    http/Chunk.h \
+    http/HTTPConnection.cpp \
+    http/HTTPConnection.h \
+    http/HTTPConnectionManager.cpp \
+    http/HTTPConnectionManager.h \
+    http/IHTTPConnection.h \
+    mpd/Accessibility.h \
+    mpd/BaseUrl.h \
+    mpd/BasicCMManager.cpp \
+    mpd/BasicCMManager.h \
+    mpd/BasicCMParser.cpp \
+    mpd/BasicCMParser.h \
+    mpd/ContentDescription.cpp \
+    mpd/ContentDescription.h \
+    mpd/ContentProtection.h \
+    mpd/Group.cpp \
+    mpd/Group.h \
+    mpd/IMPDManager.h \
+    mpd/IMPDParser.h \
+    mpd/InitSegment.cpp \
+    mpd/InitSegment.h \
+    mpd/ISegment.h \
+    mpd/MPD.cpp \
+    mpd/MPD.h \
+    mpd/MPDManagerFactory.cpp \
+    mpd/MPDManagerFactory.h \
+    mpd/NullManager.cpp \
+    mpd/NullManager.h \
+    mpd/Period.cpp \
+    mpd/Period.h \
+    mpd/ProgramInformation.cpp \
+    mpd/ProgramInformation.h \
+    mpd/Rating.h \
+    mpd/Representation.cpp \
+    mpd/Representation.h \
+    mpd/SchemeInformation.cpp \
+    mpd/SchemeInformation.h \
+    mpd/Segment.cpp \
+    mpd/Segment.h \
+    mpd/SegmentInfo.cpp \
+    mpd/SegmentInfo.h \
+    mpd/TrickModeType.cpp \
+    mpd/TrickModeType.h \
+    mpd/Viewpoint.h \
+    xml/DOMHelper.cpp \
+    xml/DOMHelper.h \
+    xml/DOMParser.cpp \
+    xml/DOMParser.h \
+    xml/Node.cpp \
+    xml/Node.h \
+    dash.cpp \
+    DASHManager.cpp \
+    DASHManager.h \
+    $(NULL)
+libvlc_LTLIBRARIES += libstream_filter_dash_plugin.la
diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.cpp
new file mode 100644 (file)
index 0000000..5a5c1bc
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * AbstractAdaptationLogic.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "AbstractAdaptationLogic.h"
+
+using namespace dash::logic;
+using namespace dash::xml;
+using namespace dash::mpd;
+using namespace dash::exception;
+
+AbstractAdaptationLogic::AbstractAdaptationLogic    (IMPDManager *mpdManager)
+{
+    this->bpsAvg        = 0;
+    this->bpsLastChunk  = 0;
+    this->mpdManager    = mpdManager;
+}
+AbstractAdaptationLogic::~AbstractAdaptationLogic   ()
+{
+}
+
+void AbstractAdaptationLogic::downloadRateChanged    (long bpsAvg, long bpsLastChunk)
+{
+    this->bpsAvg        = bpsAvg;
+    this->bpsLastChunk  = bpsLastChunk;
+}
+long AbstractAdaptationLogic::getBpsAvg              ()
+{
+    return this->bpsAvg;
+}
+long AbstractAdaptationLogic::getBpsLastChunk        ()
+{
+    return this->bpsLastChunk;
+}
diff --git a/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AbstractAdaptationLogic.h
new file mode 100644 (file)
index 0000000..d66c0dc
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * AbstractAdaptationLogic.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ABSTRACTADAPTATIONLOGIC_H_
+#define ABSTRACTADAPTATIONLOGIC_H_
+
+#include "adaptationlogic/IAdaptationLogic.h"
+#include "xml/Node.h"
+#include "http/Chunk.h"
+#include "mpd/MPD.h"
+#include "mpd/IMPDManager.h"
+#include "mpd/Period.h"
+#include "mpd/Representation.h"
+#include "mpd/InitSegment.h"
+#include "mpd/Segment.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/EOFException.h"
+
+namespace dash
+{
+    namespace logic
+    {
+        class AbstractAdaptationLogic : public IAdaptationLogic
+        {
+            public:
+                AbstractAdaptationLogic             (dash::mpd::IMPDManager *mpdManager);
+                virtual ~AbstractAdaptationLogic    ();
+
+                virtual dash::http::Chunk*  getNextChunk            () throw(dash::exception::EOFException) = 0;
+                virtual void                downloadRateChanged     (long bpsAvg, long bpsLastChunk);
+
+                long                        getBpsAvg               ();
+                long                        getBpsLastChunk         ();
+
+            private:
+                long                    bpsAvg;
+                long                    bpsLastChunk;
+                dash::mpd::IMPDManager  *mpdManager;
+        };
+    }
+}
+
+#endif /* ABSTRACTADAPTATIONLOGIC_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.cpp
new file mode 100644 (file)
index 0000000..3e28652
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * AdaptationLogicFactory.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "AdaptationLogicFactory.h"
+
+using namespace dash::logic;
+using namespace dash::xml;
+using namespace dash::mpd;
+
+AdaptationLogicFactory::AdaptationLogicFactory  ()
+{
+
+}
+AdaptationLogicFactory::~AdaptationLogicFactory ()
+{
+
+}
+
+IAdaptationLogic* AdaptationLogicFactory::create (IAdaptationLogic::LogicType logic, IMPDManager *mpdManager)
+{
+    switch(logic)
+    {
+        case IAdaptationLogic::Default:         return new NullAdaptationLogic          (mpdManager);
+        case IAdaptationLogic::AlwaysBest:      return new AlwaysBestAdaptationLogic    (mpdManager);
+        case IAdaptationLogic::AlwaysLowest:    return new NullAdaptationLogic          (mpdManager);
+        case IAdaptationLogic::RateBased:       return new RateBasedAdaptationLogic     (mpdManager);
+
+        default:                                return new NullAdaptationLogic          (mpdManager);
+    }
+}
diff --git a/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h b/modules/stream_filter/dash/adaptationlogic/AdaptationLogicFactory.h
new file mode 100644 (file)
index 0000000..9988d2e
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * AdaptationLogicFactory.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ADAPTATIONLOGICFACTORY_H_
+#define ADAPTATIONLOGICFACTORY_H_
+
+#include "adaptationlogic/IAdaptationLogic.h"
+#include "xml/Node.h"
+#include "mpd/IMPDManager.h"
+#include "adaptationlogic/AlwaysBestAdaptationLogic.h"
+#include "adaptationlogic/NullAdaptationLogic.h"
+#include "adaptationlogic/RateBasedAdaptationLogic.h"
+
+namespace dash
+{
+    namespace logic
+    {
+        class AdaptationLogicFactory
+        {
+            public:
+                AdaptationLogicFactory          ();
+                virtual ~AdaptationLogicFactory ();
+
+                IAdaptationLogic* create (IAdaptationLogic::LogicType logic, dash::mpd::IMPDManager *mpdManager);
+        };
+    }
+}
+
+#endif /* ADAPTATIONLOGICFACTORY_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
new file mode 100644 (file)
index 0000000..55798c5
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * AlwaysBestAdaptationLogic.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "AlwaysBestAdaptationLogic.h"
+
+using namespace dash::logic;
+using namespace dash::xml;
+using namespace dash::http;
+using namespace dash::mpd;
+using namespace dash::exception;
+
+AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic    (IMPDManager *mpdManager) : AbstractAdaptationLogic(mpdManager)
+{
+    this->mpdManager    = mpdManager;
+    this->count         = 0;
+    this->initSchedule();
+}
+AlwaysBestAdaptationLogic::~AlwaysBestAdaptationLogic   ()
+{
+}
+
+Chunk*  AlwaysBestAdaptationLogic::getNextChunk () throw(EOFException)
+{
+    if(this->schedule.size() == 0)
+        throw EOFException();
+
+    if(this->count == this->schedule.size())
+        throw EOFException();
+
+    for(int i = 0; i < this->schedule.size(); i++)
+    {
+        if(this->count == i)
+        {
+            Chunk *chunk = new Chunk();
+            chunk->setUrl(this->schedule.at(i)->getSourceUrl());
+            this->count++;
+            return chunk;
+        }
+    }
+    return NULL;
+}
+void    AlwaysBestAdaptationLogic::initSchedule ()
+{
+    if(this->mpdManager != NULL)
+    {
+        std::vector<Period *> periods = this->mpdManager->getPeriods();
+
+        for(int i = 0; i < periods.size(); i++)
+        {
+            Representation *best = this->mpdManager->getBestRepresentation(periods.at(i));
+
+            if(best != NULL)
+            {
+                std::vector<ISegment *> segments = this->mpdManager->getSegments(best);
+                for(int j = 0; j < segments.size(); j++)
+                {
+                    this->schedule.push_back(segments.at(j));
+                }
+            }
+        }
+    }
+}
diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
new file mode 100644 (file)
index 0000000..9c8273f
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * AlwaysBestAdaptationLogic.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ALWAYSBESTADAPTATIONLOGIC_H_
+#define ALWAYSBESTADAPTATIONLOGIC_H_
+
+#include "adaptationlogic/AbstractAdaptationLogic.h"
+#include "http/Chunk.h"
+#include "xml/Node.h"
+#include "mpd/IMPDManager.h"
+#include "mpd/Period.h"
+#include "mpd/Segment.h"
+#include "exceptions/EOFException.h"
+#include "mpd/BasicCMManager.h"
+#include "mpd/ISegment.h"
+#include <vector>
+
+namespace dash
+{
+    namespace logic
+    {
+        class AlwaysBestAdaptationLogic : public AbstractAdaptationLogic
+        {
+            public:
+                AlwaysBestAdaptationLogic           (dash::mpd::IMPDManager *mpdManager);
+                virtual ~AlwaysBestAdaptationLogic  ();
+
+                dash::http::Chunk* getNextChunk () throw(dash::exception::EOFException);
+
+            private:
+                std::vector<dash::mpd::ISegment *>  schedule;
+                dash::mpd::IMPDManager              *mpdManager;
+                int                                 count;
+
+                void initSchedule();
+        };
+    }
+}
+
+#endif /* ALWAYSBESTADAPTATIONLOGIC_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
new file mode 100644 (file)
index 0000000..ef38604
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * IAdaptationLogic.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef IADAPTATIONLOGIC_H_
+#define IADAPTATIONLOGIC_H_
+
+#include <http/Chunk.h>
+#include <adaptationlogic/IDownloadRateObserver.h>
+#include <exceptions/EOFException.h>
+
+namespace dash
+{
+    namespace logic
+    {
+        class IAdaptationLogic : public IDownloadRateObserver
+        {
+            public:
+
+                enum LogicType
+                {
+                    Default,
+                    AlwaysBest,
+                    AlwaysLowest,
+                    RateBased,
+                };
+
+                virtual dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException) = 0;
+
+        };
+    }
+}
+
+#endif /* IADAPTATIONLOGIC_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/IDownloadRateObserver.h b/modules/stream_filter/dash/adaptationlogic/IDownloadRateObserver.h
new file mode 100644 (file)
index 0000000..cc4759c
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * IDownloadRateObserver.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef IDOWNLOADRATEOBSERVER_H_
+#define IDOWNLOADRATEOBSERVER_H_
+
+namespace dash
+{
+    namespace logic
+    {
+        class IDownloadRateObserver
+        {
+            public:
+                virtual void downloadRateChanged(long bpsAvg, long bpsLastChunk) = 0;
+        };
+    }
+}
+
+#endif /* IDOWNLOADRATEOBSERVER_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/NullAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/NullAdaptationLogic.h
new file mode 100644 (file)
index 0000000..a5e88ed
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * NullAdaptationLogic.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef NULLADAPTATIONLOGIC_H_
+#define NULLADAPTATIONLOGIC_H_
+
+#include "adaptationlogic/AbstractAdaptationLogic.h"
+#include "http/Chunk.h"
+#include "xml/Node.h"
+#include "mpd/IMPDManager.h"
+#include "exceptions/EOFException.h"
+
+namespace dash
+{
+    namespace logic
+    {
+        class NullAdaptationLogic : public AbstractAdaptationLogic
+        {
+            public:
+                NullAdaptationLogic         (dash::mpd::IMPDManager *mpdManager) : AbstractAdaptationLogic(mpdManager)  {}
+                virtual ~NullAdaptationLogic()                                                                          {}
+
+                dash::http::Chunk* getNextChunk () throw(dash::exception::EOFException) { throw dash::exception::EOFException(); }
+        };
+    }
+}
+
+#endif /* NULLADAPTATIONLOGIC_H_ */
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
new file mode 100644 (file)
index 0000000..0e57965
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * RateBasedAdaptationLogic.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "RateBasedAdaptationLogic.h"
+
+using namespace dash::logic;
+using namespace dash::xml;
+using namespace dash::http;
+using namespace dash::mpd;
+using namespace dash::exception;
+
+RateBasedAdaptationLogic::RateBasedAdaptationLogic  (IMPDManager *mpdManager) : AbstractAdaptationLogic(mpdManager)
+{
+    this->mpdManager    = mpdManager;
+    this->currentPeriod = this->mpdManager->getFirstPeriod();
+    this->count         = 0;
+}
+RateBasedAdaptationLogic::~RateBasedAdaptationLogic ()
+{
+}
+
+Chunk*  RateBasedAdaptationLogic::getNextChunk () throw(EOFException)
+{
+    if(this->mpdManager == NULL)
+        throw EOFException();
+
+    if(this->currentPeriod == NULL)
+        throw EOFException();
+
+    long bitrate = this->getBpsAvg();
+
+    Representation *rep = this->mpdManager->getRepresentation(this->currentPeriod, bitrate);
+
+    if(rep == NULL)
+        throw EOFException();
+
+    std::vector<ISegment *> segments = this->mpdManager->getSegments(rep);
+
+    if(this->count == segments.size())
+    {
+        this->currentPeriod = this->mpdManager->getNextPeriod(this->currentPeriod);
+        this->count = 0;
+        return this->getNextChunk();
+    }
+
+    for(int i = 0; i < segments.size(); i++)
+    {
+        if(i == this->count)
+        {
+            this->count++;
+            Chunk *chunk = new Chunk();
+            chunk->setUrl(segments.at(i)->getSourceUrl());
+            return chunk;
+        }
+    }
+}
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
new file mode 100644 (file)
index 0000000..2db342a
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * RateBasedAdaptationLogic.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef RATEBASEDADAPTATIONLOGIC_H_
+#define RATEBASEDADAPTATIONLOGIC_H_
+
+#include "adaptationlogic/AbstractAdaptationLogic.h"
+#include "xml/Node.h"
+#include "mpd/IMPDManager.h"
+#include "http/Chunk.h"
+#include "exceptions/EOFException.h"
+#include "mpd/BasicCMManager.h"
+
+namespace dash
+{
+    namespace logic
+    {
+        class RateBasedAdaptationLogic : public AbstractAdaptationLogic
+        {
+            public:
+                RateBasedAdaptationLogic            (dash::mpd::IMPDManager *mpdManager);
+                virtual ~RateBasedAdaptationLogic   ();
+
+                dash::http::Chunk* getNextChunk () throw(dash::exception::EOFException);
+
+            private:
+                dash::mpd::IMPDManager  *mpdManager;
+                int                     count;
+                dash::mpd::Period       *currentPeriod;
+        };
+    }
+}
+
+#endif /* RATEBASEDADAPTATIONLOGIC_H_ */
diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
new file mode 100644 (file)
index 0000000..f94e94e
--- /dev/null
@@ -0,0 +1,222 @@
+/*****************************************************************************
+ * dash.cpp: DASH module
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <limits.h>
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_demux.h>
+#include <vlc_stream.h>
+#include <vlc_modules.h>
+#include <vlc_input.h>
+
+#include <errno.h>
+#include <string>
+#include <map>
+#include <fcntl.h>
+#include <iostream>
+#include <stdio.h>
+
+#include "DASHManager.h"
+#include "xml/DOMParser.h"
+#include "http/HTTPConnectionManager.h"
+#include "adaptationlogic/IAdaptationLogic.h"
+
+#define SEEK 0
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+static int  Open    (vlc_object_t *);
+static void Close   (vlc_object_t *);
+
+vlc_module_begin ()
+        set_shortname( N_("DASH"))
+        set_description( N_("Dynamic Adaptive Streaming over HTTP") )
+        set_capability( "stream_filter", 19 )
+        set_category( CAT_INPUT )
+        set_subcategory( SUBCAT_INPUT_STREAM_FILTER )
+        set_callbacks( Open, Close )
+vlc_module_end ()
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+struct stream_sys_t
+{
+        dash::DASHManager                   *p_dashManager;
+        dash::http::HTTPConnectionManager   *p_conManager;
+        dash::xml::Node                     *p_node;
+        int                                 position;
+        bool                                isLive;
+};
+
+static int  Read            (stream_t *p_stream, void *p_buffer, unsigned int i_len);
+static int  Peek            (stream_t *p_stream, const uint8_t **pp_peek, unsigned int i_peek);
+static int  Control         (stream_t *p_stream, int i_query, va_list args);
+static bool IsDash          (stream_t *p_stream, dash::xml::DOMParser *p_parser);
+/*****************************************************************************
+ * Open:
+ *****************************************************************************/
+static int Open(vlc_object_t *p_this)
+{
+    stream_t *p_stream = (stream_t*) p_this;
+
+    dash::xml::DOMParser *p_parser = new dash::xml::DOMParser(p_stream->p_source);
+
+    if(!IsDash(p_stream, p_parser))
+    {
+        delete(p_parser);
+        return VLC_EGENERIC;
+    }
+
+    stream_sys_t *p_sys = (stream_sys_t *) malloc(sizeof(stream_sys_t));
+
+    if (unlikely(p_sys == NULL))
+        return VLC_ENOMEM;
+
+    dash::http::HTTPConnectionManager   *p_conManager   = new dash::http::HTTPConnectionManager(p_stream);
+    dash::xml::Node                     *p_node         = p_parser->getRootNode();
+    dash::DASHManager                   *p_dashManager  = new dash::DASHManager(p_conManager,
+                                                                                p_node,
+                                                                                dash::logic::IAdaptationLogic::RateBased,
+                                                                                p_parser->getProfile(p_node));
+    delete(p_parser);
+
+    p_sys->p_dashManager    = p_dashManager;
+    p_sys->p_node           = p_node;
+    p_sys->p_conManager     = p_conManager;
+    p_sys->position         = 0;
+    p_sys->isLive           = true;
+    p_stream->p_sys         = p_sys;
+    p_stream->pf_read       = Read;
+    p_stream->pf_peek       = Peek;
+    p_stream->pf_control    = Control;
+
+    msg_Dbg(p_this,"DASH filter: open (%s)", p_stream->psz_path);
+
+    return VLC_SUCCESS;
+}
+/*****************************************************************************
+ * Close:
+ *****************************************************************************/
+static void Close(vlc_object_t *p_this)
+{
+    stream_t                            *p_stream       = (stream_t*) p_this;
+    stream_sys_t                        *p_sys          = (stream_sys_t *) p_stream->p_sys;
+    dash::DASHManager                   *p_dashManager  = p_sys->p_dashManager;
+    dash::http::HTTPConnectionManager   *p_conManager   = p_sys->p_conManager;
+    dash::xml::Node                     *p_node         = p_sys->p_node;
+
+    delete(p_conManager);
+    delete(p_dashManager);
+    delete(p_node);
+    free(p_sys);
+}
+/*****************************************************************************
+ * Callbacks:
+ *****************************************************************************/
+static int  Read            (stream_t *p_stream, void *p_buffer, unsigned int i_len)
+{
+    stream_sys_t        *p_sys          = (stream_sys_t *) p_stream->p_sys;
+    dash::DASHManager   *p_dashManager  = p_sys->p_dashManager;
+    int                 i_ret           = 0;
+
+    i_ret = p_dashManager->read(p_buffer, i_len);
+
+    if (i_ret < 0)
+    {
+        switch (errno)
+        {
+            case EINTR:
+            case EAGAIN:
+                break;
+            default:
+                msg_Dbg(p_stream, "DASH Read: failed to read (%m)");
+                return 0;
+        }
+        return 0;
+    }
+
+    p_sys->position += i_ret;
+
+    return i_ret;
+}
+static int  Peek            (stream_t *p_stream, const uint8_t **pp_peek, unsigned int i_peek)
+{
+    stream_sys_t        *p_sys          = (stream_sys_t *) p_stream->p_sys;
+    dash::DASHManager   *p_dashManager  = p_sys->p_dashManager;
+
+    return p_dashManager->peek(pp_peek, i_peek);
+}
+static int  Control         (stream_t *p_stream, int i_query, va_list args)
+{
+    stream_sys_t *p_sys = p_stream->p_sys;
+
+    switch (i_query)
+    {
+        case STREAM_CAN_SEEK:
+        case STREAM_CAN_FASTSEEK:
+            /*TODO Support Seek */
+            *(va_arg (args, bool *)) = SEEK;
+            break;
+        case STREAM_GET_POSITION:
+            *(va_arg (args, uint64_t *)) = p_sys->position;
+            break;
+        case STREAM_SET_POSITION:
+            return VLC_EGENERIC;
+        case STREAM_GET_SIZE:
+            if(p_sys->isLive)
+                *(va_arg (args, uint64_t *)) = 0;
+            break;
+        default:
+            return VLC_EGENERIC;
+    }
+    return VLC_SUCCESS;
+}
+/*****************************************************************************
+ * Helpers:
+ *****************************************************************************/
+static bool IsDash          (stream_t *p_stream, dash::xml::DOMParser *p_parser)
+{
+    if(!p_parser->isDash())
+    {
+        msg_Dbg(p_stream,"DASH filter: file is no mpd");
+        return false;
+    }
+
+    if(!p_parser->parse())
+    {
+        msg_Dbg(p_stream,"DASH filter: could not parse file");
+        return false;
+    }
+
+    return true;
+}
diff --git a/modules/stream_filter/dash/exceptions/AttributeNotPresentException.h b/modules/stream_filter/dash/exceptions/AttributeNotPresentException.h
new file mode 100644 (file)
index 0000000..9e85986
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * AttributeNotPresentException.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ATTRIBUTENOTPRESENTEXCEPTION_H_
+#define ATTRIBUTENOTPRESENTEXCEPTION_H_
+
+#include <stdexcept>
+
+namespace dash
+{
+    namespace exception
+    {
+        class AttributeNotPresentException : public std::exception
+        {
+            public:
+                AttributeNotPresentException() : std::exception() {}
+        };
+    }
+}
+
+#endif /* ATTRIBUTENOTPRESENTEXCEPTION_H_ */
diff --git a/modules/stream_filter/dash/exceptions/EOFException.h b/modules/stream_filter/dash/exceptions/EOFException.h
new file mode 100644 (file)
index 0000000..06a95d1
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * EOFException.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef EOFEXCEPTION_H_
+#define EOFEXCEPTION_H_
+
+#include <stdexcept>
+
+namespace dash
+{
+    namespace exception
+    {
+        class EOFException : public std::exception
+        {
+            public:
+                EOFException() : std::exception() {}
+        };
+    }
+}
+
+#endif /* EOFEXCEPTION_H_ */
diff --git a/modules/stream_filter/dash/exceptions/ElementNotPresentException.h b/modules/stream_filter/dash/exceptions/ElementNotPresentException.h
new file mode 100644 (file)
index 0000000..7e2fc0f
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * ElementNotPresentException.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ELEMENTNOTPRESENTEXCEPTION_H_
+#define ELEMENTNOTPRESENTEXCEPTION_H_
+
+#include <stdexcept>
+
+namespace dash
+{
+    namespace exception
+    {
+        class ElementNotPresentException : public std::exception
+        {
+            public:
+                ElementNotPresentException() : std::exception() {}
+
+        };
+    }
+}
+
+#endif /* ELEMENTNOTPRESENTEXCEPTION_H_ */
diff --git a/modules/stream_filter/dash/http/Chunk.cpp b/modules/stream_filter/dash/http/Chunk.cpp
new file mode 100644 (file)
index 0000000..023c7e6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Chunk.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Chunk.h"
+
+using namespace dash::http;
+
+Chunk::Chunk()
+{
+
+}
+Chunk::~Chunk()
+{
+}
+
+int         Chunk::getEndByte   ()
+{
+    return endByte;
+}
+int         Chunk::getStartByte ()
+{
+    return startByte;
+}
+std::string Chunk::getUrl       ()
+{
+    return url;
+}
+void        Chunk::setEndByte   (int endByte)
+{
+    this->endByte = endByte;
+}
+void        Chunk::setStartByte (int startByte)
+{
+    this->startByte = startByte;
+}
+void        Chunk::setUrl       (std::string url)
+{
+    this->url = url;
+}
diff --git a/modules/stream_filter/dash/http/Chunk.h b/modules/stream_filter/dash/http/Chunk.h
new file mode 100644 (file)
index 0000000..07055c3
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Chunk.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef CHUNK_H_
+#define CHUNK_H_
+
+#include <vector>
+#include <string>
+
+namespace dash
+{
+    namespace http
+    {
+        class Chunk
+        {
+            public:
+                Chunk           ();
+                virtual ~Chunk  ();
+
+                int         getEndByte      ();
+                int         getStartByte    ();
+                std::string getUrl          ();
+                void        setEndByte      (int endByte);
+                void        setStartByte    (int startByte);
+                void        setUrl          (std::string url);
+
+            private:
+                std::string                 url;
+                std::vector<std::string>    optionalUrls;
+                int                         startByte;
+                int                         endByte;
+
+        };
+    }
+}
+
+#endif /* CHUNK_H_ */
diff --git a/modules/stream_filter/dash/http/HTTPConnection.cpp b/modules/stream_filter/dash/http/HTTPConnection.cpp
new file mode 100644 (file)
index 0000000..07a4be2
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * HTTPConnection.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "HTTPConnection.h"
+
+using namespace dash::http;
+
+HTTPConnection::HTTPConnection  (std::string url, stream_t *stream)
+{
+    this->url       = url;
+    this->stream    = stream;
+}
+HTTPConnection::~HTTPConnection ()
+{
+
+}
+
+int             HTTPConnection::read            (void *p_buffer, size_t len)
+{
+    int size = stream_Read(this->urlStream, p_buffer, len);
+
+    if(size <= 0)
+        return 0;
+
+    return size;
+}
+int             HTTPConnection::peek            (const uint8_t **pp_peek, size_t i_peek)
+{
+    return stream_Peek(this->urlStream, pp_peek, i_peek);
+}
+void            HTTPConnection::parseURL        ()
+{
+    this->hostname = this->url;
+    this->hostname.erase(0, 7);
+    this->path = this->hostname;
+
+    size_t pos = this->hostname.find("/");
+
+    this->hostname  = this->hostname.substr(0, pos);
+    this->path      = this->path.substr(pos, this->path.size());
+
+    this->request = "GET " + this->path + " HTTP/1.1\r\n" +
+                    "Host: " + this->hostname + "\r\nConnection: close\r\n\r\n";
+}
+bool            HTTPConnection::init            ()
+{
+    this->urlStream = stream_UrlNew(this->stream, this->url.c_str());
+
+    if(!this->urlStream)
+        return false;
+
+    return true;
+
+}
+bool            HTTPConnection::parseHeader     ()
+{
+    std::string line = this->readLine();
+
+    while(line.compare("\r\n"))
+    {
+        line = this->readLine();
+    }
+
+    return true;
+}
+std::string     HTTPConnection::readLine        ()
+{
+    std::stringstream ss;
+    char c[1];
+    size_t size = net_Read(this->stream, this->httpSocket, NULL, c, 1, false);
+
+    while(size)
+    {
+        ss << c[0];
+        if(c[0] == '\n')
+            break;
+
+        size = net_Read(this->stream, this->httpSocket, NULL, c, 1, false);
+    }
+
+    if(size > 0)
+        return ss.str();
+
+    return "\r\n";
+}
+bool            HTTPConnection::sendData        (std::string data)
+{
+    size_t size = 0;
+    size = net_Write(this->stream, this->httpSocket, NULL, data.c_str(), data.size());
+    if (size == -1)
+    {
+        return false;
+    }
+    if (size != data.length())
+    {
+        this->sendData(data.substr(size, data.size()));
+    }
+
+    return true;
+}
+void            HTTPConnection::closeSocket     ()
+{
+    stream_Delete(this->urlStream);
+}
diff --git a/modules/stream_filter/dash/http/HTTPConnection.h b/modules/stream_filter/dash/http/HTTPConnection.h
new file mode 100644 (file)
index 0000000..fcf6012
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * HTTPConnection.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef HTTPCONNECTION_H_
+#define HTTPCONNECTION_H_
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_stream.h>
+#include <vlc_network.h>
+
+#include <string>
+#include <stdint.h>
+#include <iostream>
+#include <sstream>
+
+#include "http/IHTTPConnection.h"
+
+namespace dash
+{
+    namespace http
+    {
+        class HTTPConnection : public IHTTPConnection
+        {
+            public:
+                HTTPConnection          (std::string url, stream_t *stream);
+                virtual ~HTTPConnection ();
+
+                bool        init            ();
+                void        closeSocket     ();
+
+                virtual int     read        (void *p_buffer, size_t len);
+                virtual int     peek        (const uint8_t **pp_peek, size_t i_peek);
+
+            private:
+                int                     httpSocket;
+                std::string             url;
+                std::string             hostname;
+                std::string             path;
+                std::string             request;
+                stream_t                *stream;
+                stream_t                *urlStream;
+
+                void            parseURL        ();
+                bool            sendData        (std::string data);
+                bool            parseHeader     ();
+                std::string     readLine        ();
+        };
+    }
+}
+
+#endif /* HTTPCONNECTION_H_ */
diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp
new file mode 100644 (file)
index 0000000..fb71f30
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * HTTPConnectionManager.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "HTTPConnectionManager.h"
+
+using namespace dash::http;
+using namespace dash::logic;
+
+HTTPConnectionManager::HTTPConnectionManager    (stream_t *stream)
+{
+    this->timeSecSession    = 0;
+    this->bytesReadSession  = 0;
+    this->timeSecChunk      = 0;
+    this->bytesReadChunk    = 0;
+    this->bpsAvg            = 0;
+    this->bpsLastChunk      = 0;
+    this->chunkCount        = 0;
+    this->stream            = stream;
+}
+HTTPConnectionManager::~HTTPConnectionManager   ()
+{
+    this->closeAllConnections();
+}
+
+IHTTPConnection*    HTTPConnectionManager::getConnection            (std::string url)
+{
+    HTTPConnection *con = new HTTPConnection(url, this->stream);
+    con->init();
+    this->connections.push_back(con);
+    return con;
+}
+bool                HTTPConnectionManager::closeConnection          (IHTTPConnection *con)
+{
+    for(std::vector<HTTPConnection *>::iterator it = this->connections.begin(); it != this->connections.end(); ++it)
+    {
+        if(*it == con)
+        {
+            (*it)->closeSocket();
+            delete(*it);
+            this->connections.erase(it);
+            return true;
+        }
+    }
+    return false;
+}
+bool                HTTPConnectionManager::closeConnection          (Chunk *chunk)
+{
+    HTTPConnection *con = this->chunkMap[chunk];
+    bool ret = this->closeConnection(con);
+    this->chunkMap.erase(chunk);
+    delete(chunk);
+    return ret;
+}
+bool                HTTPConnectionManager::closeAllConnections      ()
+{
+    for(std::vector<HTTPConnection *>::iterator it = this->connections.begin(); it != this->connections.end(); ++it)
+    {
+        (*it)->closeSocket();
+        delete(*it);
+    }
+    this->connections.clear();
+    this->urlMap.clear();
+
+    std::map<Chunk *, HTTPConnection *>::iterator it;
+
+    for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it)
+    {
+        delete(it->first);
+    }
+
+    this->chunkMap.clear();
+}
+int                 HTTPConnectionManager::read                     (Chunk *chunk, void *p_buffer, size_t len)
+{
+    if(this->chunkMap.find(chunk) != this->chunkMap.end())
+    {
+        mtime_t start = mdate();
+        int ret = this->chunkMap[chunk]->read(p_buffer, len);
+        mtime_t end = mdate();
+
+        double time = ((double)(end - start)) / 1000000;
+
+        this->bytesReadSession += ret;
+        this->bytesReadChunk   += ret;
+        this->timeSecSession   += time;
+        this->timeSecChunk     += time;
+
+
+        if(this->timeSecSession > 0)
+            this->bpsAvg = (this->bytesReadSession / this->timeSecSession) * 8;
+
+        if(this->timeSecChunk > 0)
+            this->bpsLastChunk = (this->bytesReadChunk / this->timeSecChunk) * 8;
+
+        if(this->bpsAvg < 0 || this->chunkCount < 2)
+            this->bpsAvg = 0;
+
+        if(this->bpsLastChunk < 0 || this->chunkCount < 2)
+            this->bpsLastChunk = 0;
+
+        this->notify();
+
+        if(ret <= 0)
+            this->closeConnection(chunk);
+
+        return ret;
+    }
+    else
+    {
+        this->bytesReadChunk    = 0;
+        this->timeSecChunk      = 0;
+
+        HTTPConnection *con = this->initConnection(chunk);
+        return this->read(chunk, p_buffer, len);
+    }
+}
+int                 HTTPConnectionManager::peek                     (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek)
+{
+    if(this->chunkMap.find(chunk) != this->chunkMap.end())
+        return this->chunkMap[chunk]->peek(pp_peek, i_peek);
+
+    HTTPConnection *con = this->initConnection(chunk);
+    return this->peek(chunk, pp_peek, i_peek);
+}
+HTTPConnection*     HTTPConnectionManager::initConnection           (Chunk *chunk)
+{
+    HTTPConnection *con = new HTTPConnection(chunk->getUrl(), this->stream);
+    con->init();
+    this->connections.push_back(con);
+    this->chunkMap[chunk] = con;
+    this->chunkCount++;
+    return con;
+}
+void                HTTPConnectionManager::attach                   (IDownloadRateObserver *observer)
+{
+    this->rateObservers.push_back(observer);
+}
+void                HTTPConnectionManager::notify                   ()
+{
+    for(int i = 0; i < this->rateObservers.size(); i++)
+        this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk);
+}
diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h
new file mode 100644 (file)
index 0000000..64f3bbe
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * HTTPConnectionManager.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef HTTPCONNECTIONMANAGER_H_
+#define HTTPCONNECTIONMANAGER_H_
+
+#include <vlc_common.h>
+
+#include <string>
+#include <vector>
+#include <iostream>
+#include <ctime>
+#include <map>
+#include <limits.h>
+
+#include "http/HTTPConnection.h"
+#include "http/Chunk.h"
+#include "adaptationlogic/IDownloadRateObserver.h"
+
+namespace dash
+{
+    namespace http
+    {
+        class HTTPConnectionManager
+        {
+            public:
+                HTTPConnectionManager           (stream_t *stream);
+                virtual ~HTTPConnectionManager  ();
+
+                bool                closeAllConnections ();
+                bool                closeConnection     (IHTTPConnection *con);
+                IHTTPConnection*    getConnection       (std::string url);
+                int                 read                (Chunk *chunk, void *p_buffer, size_t len);
+                int                 peek                (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek);
+                void                attach              (dash::logic::IDownloadRateObserver *observer);
+                void                notify              ();
+
+            private:
+                std::vector<HTTPConnection *>                       connections;
+                std::map<Chunk *, HTTPConnection *>                 chunkMap;
+                std::map<std::string, HTTPConnection *>             urlMap;
+                std::vector<dash::logic::IDownloadRateObserver *>   rateObservers;
+                long                                                bpsAvg;
+                long                                                bpsLastChunk;
+                long                                                bytesReadSession;
+                double                                              timeSecSession;
+                long                                                bytesReadChunk;
+                double                                              timeSecChunk;
+                stream_t                                            *stream;
+                int                                                 chunkCount;
+
+                bool            closeConnection (Chunk *chunk);
+                HTTPConnection* initConnection  (Chunk *chunk);
+
+        };
+    }
+}
+
+#endif /* HTTPCONNECTIONMANAGER_H_ */
diff --git a/modules/stream_filter/dash/http/IHTTPConnection.h b/modules/stream_filter/dash/http/IHTTPConnection.h
new file mode 100644 (file)
index 0000000..54e30c0
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * IHTTPConnection.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef IHTTPCONNECTION_H_
+#define IHTTPCONNECTION_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+namespace dash
+{
+    namespace http
+    {
+        class IHTTPConnection
+        {
+            public:
+                virtual int     read        (void *p_buffer, size_t len)              = 0;
+                virtual int     peek        (const uint8_t **pp_peek, size_t i_peek)  = 0;
+        };
+    }
+}
+
+#endif /* IHTTPCONNECTION_H_ */
diff --git a/modules/stream_filter/dash/mpd/Accessibility.h b/modules/stream_filter/dash/mpd/Accessibility.h
new file mode 100644 (file)
index 0000000..4dbac78
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Accessibility.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ACCESSIBILITY_H_
+#define ACCESSIBILITY_H_
+
+#include "mpd/ContentDescription.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Accessibility : public ContentDescription
+        {
+        };
+    }
+}
+
+#endif /* ACCESSIBILITY_H_ */
diff --git a/modules/stream_filter/dash/mpd/BaseUrl.h b/modules/stream_filter/dash/mpd/BaseUrl.h
new file mode 100644 (file)
index 0000000..02088e3
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * BaseUrl.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef BASEURL_H_
+#define BASEURL_H_
+
+#include <string>
+
+namespace dash
+{
+    namespace mpd
+    {
+        class BaseUrl
+        {
+            public:
+                BaseUrl         (std::string url)   { this->url = url; }
+                virtual ~BaseUrl()                  {}
+
+                std::string getUrl() { return this->url; }
+
+            private:
+                std::string url;
+        };
+    }
+}
+
+#endif /* BASEURL_H_ */
diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.cpp b/modules/stream_filter/dash/mpd/BasicCMManager.cpp
new file mode 100644 (file)
index 0000000..f982b0a
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * BasicCMManager.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "BasicCMManager.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+BasicCMManager::BasicCMManager  (MPD *mpd)
+{
+    this->mpd = mpd;
+}
+BasicCMManager::~BasicCMManager ()
+{
+}
+
+std::vector<ISegment*>  BasicCMManager::getSegments             (Representation *rep)
+{
+    std::vector<ISegment *> retSegments;
+    try
+    {
+        SegmentInfo* info = rep->getSegmentInfo();
+        InitSegment* init = info->getInitSegment();
+
+        retSegments.push_back(init);
+
+        std::vector<Segment *> segments = info->getSegments();
+
+        for(int i = 0; i < segments.size(); i++)
+            retSegments.push_back(segments.at(i));
+    }
+    catch(ElementNotPresentException &e)
+    {
+        /*TODO Debug */
+    }
+
+    return retSegments;
+}
+std::vector<Period*>    BasicCMManager::getPeriods              ()
+{
+    return this->mpd->getPeriods();
+}
+Representation*         BasicCMManager::getBestRepresentation   (Period *period)
+{
+    std::vector<Group *> groups = period->getGroups();
+
+    long            bitrate  = 0;
+    Representation  *best    = NULL;
+
+    for(int i = 0; i < groups.size(); i++)
+    {
+        std::vector<Representation *> reps = groups.at(i)->getRepresentations();
+        for(int j = 0; j < reps.size(); j++)
+        {
+            try
+            {
+                long currentBitrate = atol(reps.at(j)->getBandwidth().c_str());
+                if(currentBitrate > bitrate)
+                {
+                    bitrate = currentBitrate;
+                    best    = reps.at(j);
+                }
+            }
+            catch(AttributeNotPresentException &e)
+            {
+                /* TODO DEBUG */
+            }
+        }
+    }
+
+    return best;
+}
+Period*                 BasicCMManager::getFirstPeriod          ()
+{
+    std::vector<Period *> periods = this->mpd->getPeriods();
+
+    if(periods.size() == 0)
+        return NULL;
+
+    return periods.at(0);
+}
+Representation*         BasicCMManager::getRepresentation       (Period *period, long bitrate)
+{
+    std::vector<Group *> groups = period->getGroups();
+
+    Representation  *best       = NULL;
+    long            bestDif  = -1;
+
+    for(int i = 0; i < groups.size(); i++)
+    {
+        std::vector<Representation *> reps = groups.at(i)->getRepresentations();
+        for(int j = 0; j < reps.size(); j++)
+        {
+            try
+            {
+                long currentBitrate = atol(reps.at(j)->getBandwidth().c_str());
+                long dif = bitrate - currentBitrate;
+
+                if(bestDif == -1)
+                {
+                    bestDif = dif;
+                    best = reps.at(j);
+                }
+                else
+                {
+                    if(dif >= 0 && dif < bestDif)
+                    {
+                        bestDif = dif;
+                        best = reps.at(j);
+                    }
+                }
+
+            }
+            catch(AttributeNotPresentException &e)
+            {
+                /* TODO DEBUG */
+            }
+        }
+    }
+
+    return best;
+}
+Period*                 BasicCMManager::getNextPeriod           (Period *period)
+{
+    std::vector<Period *> periods = this->mpd->getPeriods();
+
+    for(int i = 0; i < periods.size(); i++)
+    {
+        if(periods.at(i) == period && (i + 1) < periods.size())
+            return periods.at(i + 1);
+    }
+
+    return NULL;
+}
diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.h b/modules/stream_filter/dash/mpd/BasicCMManager.h
new file mode 100644 (file)
index 0000000..9c399c9
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * BasicCMManager.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef BASICCMMANAGER_H_
+#define BASICCMMANAGER_H_
+
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "mpd/MPD.h"
+#include "mpd/Period.h"
+#include "mpd/Group.h"
+#include "mpd/Representation.h"
+#include "mpd/SegmentInfo.h"
+#include "mpd/InitSegment.h"
+#include "mpd/Segment.h"
+#include "mpd/ISegment.h"
+#include "mpd/IMPDManager.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class BasicCMManager : public IMPDManager
+        {
+            public:
+                BasicCMManager          (MPD *mpd);
+                virtual ~BasicCMManager ();
+
+                std::vector<Period *>   getPeriods              ();
+                Period*                 getFirstPeriod          ();
+                Period*                 getNextPeriod           (Period *period);
+                Representation*         getBestRepresentation   (Period *period);
+                std::vector<ISegment *> getSegments             (Representation *rep);
+                Representation*         getRepresentation       (Period *period, long bitrate);
+
+            private:
+                MPD *mpd;
+        };
+    }
+}
+
+#endif /* BASICCMMANAGER_H_ */
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
new file mode 100644 (file)
index 0000000..e508baf
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * BasicCMParser.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "BasicCMParser.h"
+
+using namespace dash::mpd;
+using namespace dash::xml;
+
+BasicCMParser::BasicCMParser    (Node *root)
+{
+    this->root = root;
+}
+BasicCMParser::~BasicCMParser   ()
+{
+}
+
+bool    BasicCMParser::parse                ()
+{
+    this->setMPD();
+    return true;
+}
+void    BasicCMParser::setMPD               ()
+{
+    this->mpd = new MPD(this->root->getAttributes());
+    this->setMPDBaseUrl(this->root);
+    this->setPeriods(this->root);
+}
+void    BasicCMParser::setMPDBaseUrl        (Node *root)
+{
+    std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(root, "BaseURL");
+
+    for(int i = 0; i < baseUrls.size(); i++)
+    {
+        BaseUrl *url = new BaseUrl(baseUrls.at(i)->getText());
+        this->mpd->addBaseUrl(url);
+    }
+}
+void    BasicCMParser::setPeriods           (Node *root)
+{
+    std::vector<Node *> periods = DOMHelper::getElementByTagName(root, "Period", false);
+
+    for(int i = 0; i < periods.size(); i++)
+    {
+        Period *period = new Period(periods.at(i)->getAttributes());
+        this->setGroups(periods.at(i), period);
+        this->mpd->addPeriod(period);
+    }
+}
+void    BasicCMParser::setGroups            (Node *root, Period *period)
+{
+    std::vector<Node *> groups = DOMHelper::getElementByTagName(root, "Group", false);
+
+    for(int i = 0; i < groups.size(); i++)
+    {
+        Group *group = new Group(groups.at(i)->getAttributes());
+        this->setRepresentations(groups.at(i), group);
+        period->addGroup(group);
+    }
+}
+void    BasicCMParser::setRepresentations   (Node *root, Group *group)
+{
+    std::vector<Node *> representations = DOMHelper::getElementByTagName(root, "Representation", false);
+
+    for(int i = 0; i < representations.size(); i++)
+    {
+        Representation *rep = new Representation(representations.at(i)->getAttributes());
+        this->setSegmentInfo(representations.at(i), rep);
+        group->addRepresentation(rep);
+    }
+}
+void    BasicCMParser::setSegmentInfo       (Node *root, Representation *rep)
+{
+    std::vector<Node *> segmentInfo = DOMHelper::getChildElementByTagName(root, "SegmentInfo");
+
+    for(int i = 0; i < segmentInfo.size(); i++)
+    {
+        SegmentInfo *info = new SegmentInfo(segmentInfo.at(i)->getAttributes());
+        this->setInitSegment(segmentInfo.at(i), info);
+        this->setSegments(segmentInfo.at(i), info);
+        rep->setSegmentInfo(info);
+        return;
+    }
+}
+void    BasicCMParser::setInitSegment       (Node *root, SegmentInfo *info)
+{
+    std::vector<Node *> initSeg = DOMHelper::getChildElementByTagName(root, "InitialisationSegmentURL");
+
+    for(int i = 0; i < initSeg.size(); i++)
+    {
+        InitSegment *seg = new InitSegment(initSeg.at(i)->getAttributes());
+        info->setInitSegment(seg);
+        return;
+    }
+}
+void    BasicCMParser::setSegments          (Node *root, SegmentInfo *info)
+{
+    std::vector<Node *> segments = DOMHelper::getElementByTagName(root, "Url", false);
+
+    for(int i = 0; i < segments.size(); i++)
+    {
+        Segment *seg = new Segment(segments.at(i)->getAttributes());
+        info->addSegment(seg);
+    }
+}
+MPD*    BasicCMParser::getMPD               ()
+{
+    return this->mpd;
+}
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.h b/modules/stream_filter/dash/mpd/BasicCMParser.h
new file mode 100644 (file)
index 0000000..5813b91
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * BasicCMParser.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef BASICCMPARSER_H_
+#define BASICCMPARSER_H_
+
+#include "xml/Node.h"
+#include "xml/DOMHelper.h"
+#include "mpd/IMPDParser.h"
+#include "mpd/MPD.h"
+#include "mpd/Period.h"
+#include "mpd/Group.h"
+#include "mpd/Representation.h"
+#include "mpd/BaseUrl.h"
+#include "mpd/SegmentInfo.h"
+#include "mpd/Segment.h"
+#include "mpd/InitSegment.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class BasicCMParser : public IMPDParser
+        {
+            public:
+                BasicCMParser           (dash::xml::Node *root);
+                virtual ~BasicCMParser  ();
+
+                bool    parse  ();
+                MPD*    getMPD ();
+
+            private:
+                dash::xml::Node *root;
+                MPD             *mpd;
+
+                void    setMPD              ();
+                void    setPeriods          (dash::xml::Node *root);
+                void    setGroups           (dash::xml::Node *root, Period *period);
+                void    setRepresentations  (dash::xml::Node *root, Group *group);
+                void    setSegmentInfo      (dash::xml::Node *root, Representation *rep);
+                void    setInitSegment      (dash::xml::Node *root, SegmentInfo *info);
+                void    setSegments         (dash::xml::Node *root, SegmentInfo *info);
+                void    setMPDBaseUrl       (dash::xml::Node *root);
+        };
+    }
+}
+
+#endif /* BASICCMPARSER_H_ */
diff --git a/modules/stream_filter/dash/mpd/ContentDescription.cpp b/modules/stream_filter/dash/mpd/ContentDescription.cpp
new file mode 100644 (file)
index 0000000..6854a03
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * ContentDescription.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "ContentDescription.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+ContentDescription::ContentDescription  (std::map<std::string,std::string> attributes)
+{
+    this->attributes        = attributes;
+    this->schemeInformation = NULL;
+}
+ContentDescription::~ContentDescription ()
+{
+    delete(this->schemeInformation);
+}
+
+SchemeInformation*  ContentDescription::getSchemeInformation    () throw(ElementNotPresentException)
+{
+    if(this->schemeInformation == NULL)
+        throw ElementNotPresentException();
+
+    return this->schemeInformation;
+}
+std::string         ContentDescription::getSchemeIdUri          () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("schemeIdUri") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["schmeIdUri"];
+
+}
+void                ContentDescription::setSchemeInformation    (SchemeInformation *schemeInfo)
+{
+    this->schemeInformation = schemeInfo;
+}
diff --git a/modules/stream_filter/dash/mpd/ContentDescription.h b/modules/stream_filter/dash/mpd/ContentDescription.h
new file mode 100644 (file)
index 0000000..d777f84
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * ContentDescription.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef CONTENTDESCRIPTION_H_
+#define CONTENTDESCRIPTION_H_
+
+#include <string>
+#include <map>
+
+#include "mpd/SchemeInformation.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class ContentDescription
+        {
+            public:
+                ContentDescription          (std::map<std::string, std::string>  attributes);
+                virtual ~ContentDescription ();
+
+                std::string         getSchemeIdUri          () throw(dash::exception::AttributeNotPresentException);
+                SchemeInformation*  getSchemeInformation    () throw(dash::exception::ElementNotPresentException);
+                void                setSchemeInformation    (SchemeInformation *schemeInfo);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                SchemeInformation                   *schemeInformation;
+        };
+    }
+}
+
+#endif /* CONTENTDESCRIPTION_H_ */
diff --git a/modules/stream_filter/dash/mpd/ContentProtection.h b/modules/stream_filter/dash/mpd/ContentProtection.h
new file mode 100644 (file)
index 0000000..c51886d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * ContentProtection.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef CONTENTPROTECTION_H_
+#define CONTENTPROTECTION_H_
+
+#include "mpd/ContentDescription.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class ContentProtection : public ContentDescription
+        {
+        };
+    }
+}
+
+#endif /* CONTENTPROTECTION_H_ */
diff --git a/modules/stream_filter/dash/mpd/Group.cpp b/modules/stream_filter/dash/mpd/Group.cpp
new file mode 100644 (file)
index 0000000..1807f04
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Group.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "Group.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+Group::Group    (std::map<std::string, std::string>  attributes)
+{
+    this->attributes        = attributes;
+    this->contentProtection = NULL;
+    this->accessibility     = NULL;
+    this->viewpoint         = NULL;
+    this->rating            = NULL;
+}
+Group::~Group   ()
+{
+    for(int i = 0; i < this->representations.size(); i++)
+        delete(this->representations.at(i));
+
+    delete(this->contentProtection);
+    delete(this->rating);
+    delete(this->viewpoint);
+    delete(this->accessibility);
+}
+
+std::string                     Group::getWidth                 () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("width") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["width"];
+}
+std::string                     Group::getNumberOfChannels      () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("numberOfChannels") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["numberOfChannels"];
+}
+std::string                     Group::getLang                  () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("lang") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["lang"];
+}
+std::string                     Group::getParY                  () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("pary") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["pary"];
+}
+std::string                     Group::getParX                  () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("parx") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["parx"];
+}
+std::string                     Group::getSamplingRate          () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("samplingRate") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["samplingRate"];
+}
+std::string                     Group::getMimeType              () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("mimeType") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["mimeType"];
+}
+std::string                     Group::getSubSegmentAlignment   () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("subsegmentAlignmentFlag") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["subsegmentAlignmentFlag"];
+}
+std::string                     Group::getFrameRate             () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("frameRate") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["frameRate"];
+}
+std::string                     Group::getHeight                () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("height") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["height"];
+}
+Viewpoint*                      Group::getViewpoint             () throw(ElementNotPresentException)
+{
+    if(this->viewpoint == NULL)
+        throw ElementNotPresentException();
+
+    return this->viewpoint;
+}
+Rating*                         Group::getRating                () throw(ElementNotPresentException)
+{
+    if(this->rating == NULL)
+        throw ElementNotPresentException();
+
+    return this->rating;
+}
+Accessibility*                  Group::getAccessibility         () throw(ElementNotPresentException)
+{
+    if(this->accessibility == NULL)
+        throw ElementNotPresentException();
+
+    return this->accessibility;
+}
+ContentProtection*              Group::getContentProtection     () throw(ElementNotPresentException)
+{
+    if(this->contentProtection == NULL)
+        throw ElementNotPresentException();
+
+    return this->contentProtection;
+}
+std::vector<Representation*>    Group::getRepresentations       ()
+{
+    return this->representations;
+}
+void                            Group::addRepresentation        (Representation *rep)
+{
+    this->representations.push_back(rep);
+}
+void                            Group::setRating                (Rating *rating)
+{
+    this->rating = rating;
+}
+void                            Group::setContentProtection     (ContentProtection *protection)
+{
+    this->contentProtection = protection;
+}
+void                            Group::setAccessibility         (Accessibility *accessibility)
+{
+    this->accessibility = accessibility;
+}
+void                            Group::setViewpoint             (Viewpoint *viewpoint)
+{
+    this->viewpoint = viewpoint;
+}
diff --git a/modules/stream_filter/dash/mpd/Group.h b/modules/stream_filter/dash/mpd/Group.h
new file mode 100644 (file)
index 0000000..0580953
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Group.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef GROUP_H_
+#define GROUP_H_
+
+#include <vector>
+#include <string>
+#include <map>
+
+#include "mpd/Representation.h"
+#include "mpd/ContentProtection.h"
+#include "mpd/Accessibility.h"
+#include "mpd/Viewpoint.h"
+#include "mpd/Rating.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Group
+        {
+            public:
+                Group           (std::map<std::string, std::string>  attributes);
+                virtual ~Group  ();
+
+                std::string                     getWidth                () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getHeight               () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getParX                 () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getParY                 () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getLang                 () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getMimeType             () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getFrameRate            () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getNumberOfChannels     () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getSamplingRate         () throw(dash::exception::AttributeNotPresentException);
+                std::string                     getSubSegmentAlignment  () throw(dash::exception::AttributeNotPresentException);
+                std::vector<Representation *>   getRepresentations      ();
+                Viewpoint*                      getViewpoint            () throw(dash::exception::ElementNotPresentException);
+                ContentProtection*              getContentProtection    () throw(dash::exception::ElementNotPresentException);
+                Accessibility*                  getAccessibility        () throw(dash::exception::ElementNotPresentException);
+                Rating*                         getRating               () throw(dash::exception::ElementNotPresentException);
+
+                void addRepresentation      (Representation *rep);
+                void setViewpoint           (Viewpoint *viewpoint);
+                void setContentProtection   (ContentProtection *protection);
+                void setAccessibility       (Accessibility *accessibility);
+                void setRating              (Rating *rating);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                std::vector<Representation *>       representations;
+                ContentProtection                   *contentProtection;
+                Accessibility                       *accessibility;
+                Viewpoint                           *viewpoint;
+                Rating                              *rating;
+        };
+    }
+}
+
+#endif /* GROUP_H_ */
diff --git a/modules/stream_filter/dash/mpd/IMPDManager.h b/modules/stream_filter/dash/mpd/IMPDManager.h
new file mode 100644 (file)
index 0000000..7b6491d
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * IMPDManager.h
+ *
+ *  Created on: Apr 22, 2011
+ *      Author: Christopher Müller
+ */
+
+#ifndef IMPDMANAGER_H_
+#define IMPDMANAGER_H_
+
+#include "mpd/Period.h"
+#include "mpd/Representation.h"
+#include "mpd/ISegment.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        enum Profile
+        {
+            NotValid,
+            Full2011,
+            Basic,
+            BasicCM,
+        };
+        class IMPDManager
+        {
+            public:
+                virtual std::vector<Period *>   getPeriods              ()                              = 0;
+                virtual Period*                 getFirstPeriod          ()                              = 0;
+                virtual Period*                 getNextPeriod           (Period *period)                = 0;
+                virtual Representation*         getBestRepresentation   (Period *period)                = 0;
+                virtual std::vector<ISegment *> getSegments             (Representation *rep)           = 0;
+                virtual Representation*         getRepresentation       (Period *period, long bitrate)  = 0;
+        };
+    }
+}
+#endif /* IMPDMANAGER_H_ */
diff --git a/modules/stream_filter/dash/mpd/IMPDParser.h b/modules/stream_filter/dash/mpd/IMPDParser.h
new file mode 100644 (file)
index 0000000..cea7b38
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * IMPDParser.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef IMPDPARSER_H_
+#define IMPDPARSER_H_
+
+#include "mpd/MPD.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class IMPDParser
+        {
+            public:
+                virtual bool    parse  () = 0;
+                virtual MPD*    getMPD () = 0;
+        };
+    }
+}
+
+#endif /* IMPDPARSER_H_ */
diff --git a/modules/stream_filter/dash/mpd/ISegment.h b/modules/stream_filter/dash/mpd/ISegment.h
new file mode 100644 (file)
index 0000000..7464021
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * ISegment.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ISEGMENT_H_
+#define ISEGMENT_H_
+
+#include <string>
+
+#include "exceptions/AttributeNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class ISegment
+        {
+            public:
+                virtual std::string getSourceUrl() throw(dash::exception::AttributeNotPresentException) = 0;
+        };
+    }
+}
+
+#endif /* ISEGMENT_H_ */
diff --git a/modules/stream_filter/dash/mpd/InitSegment.cpp b/modules/stream_filter/dash/mpd/InitSegment.cpp
new file mode 100644 (file)
index 0000000..1c86c5c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * InitSegment.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "InitSegment.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+InitSegment::InitSegment    (std::map<std::string, std::string>  attributes)
+{
+    this->attributes = attributes;
+}
+InitSegment::~InitSegment   ()
+{
+}
+
+
+std::string InitSegment::getSourceUrl () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("sourceURL") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["sourceURL"];
+}
diff --git a/modules/stream_filter/dash/mpd/InitSegment.h b/modules/stream_filter/dash/mpd/InitSegment.h
new file mode 100644 (file)
index 0000000..41dd040
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * InitSegment.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef INITSEGMENT_H_
+#define INITSEGMENT_H_
+
+#include <map>
+#include <string>
+
+#include "exceptions/AttributeNotPresentException.h"
+#include "mpd/ISegment.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class InitSegment : public ISegment
+        {
+            public:
+                InitSegment         (std::map<std::string, std::string>  attributes);
+                virtual ~InitSegment();
+
+                std::string getSourceUrl() throw(dash::exception::AttributeNotPresentException);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+        };
+    }
+}
+
+#endif /* INITSEGMENT_H_ */
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
new file mode 100644 (file)
index 0000000..1157f65
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * MPD.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "MPD.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+MPD::MPD    (std::map<std::string, std::string> attributes)
+{
+    this->attributes    = attributes;
+    this->programInfo   = NULL;
+}
+MPD::MPD    ()
+{
+
+}
+MPD::~MPD   ()
+{
+    for(int i = 0; i < this->periods.size(); i++)
+        delete(this->periods.at(i));
+
+    for(int i = 0; i < this->baseUrls.size(); i++)
+        delete(this->baseUrls.at(i));
+
+    delete(this->programInfo);
+}
+
+std::vector<Period*>    MPD::getPeriods             ()
+{
+    return this->periods;
+}
+std::vector<BaseUrl*>   MPD::getBaseUrls            ()
+{
+    return this->baseUrls;
+}
+std::string             MPD::getMinBufferTime       () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("minBufferTime") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["minBufferTime"];
+}
+std::string             MPD::getType                () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("type") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["type"];
+}
+std::string             MPD::getDuration            () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("mediaPresentationDuration") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["mediaPresentationDuration"];
+}
+ProgramInformation*     MPD::getProgramInformation  () throw(ElementNotPresentException)
+{
+    if(this->programInfo == NULL)
+        throw ElementNotPresentException();
+
+    return this->programInfo;
+}
+void                    MPD::addBaseUrl             (BaseUrl *url)
+{
+    this->baseUrls.push_back(url);
+}
+void                    MPD::addPeriod              (Period *period)
+{
+    this->periods.push_back(period);
+}
+void                    MPD::setProgramInformation  (ProgramInformation *progInfo)
+{
+    this->programInfo = progInfo;
+}
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
new file mode 100644 (file)
index 0000000..732d38b
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * MPD.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef MPD_H_
+#define MPD_H_
+
+#include <vector>
+#include <string>
+#include <map>
+
+#include "mpd/Period.h"
+#include "mpd/BaseUrl.h"
+#include "mpd/ProgramInformation.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class MPD
+        {
+            public:
+                MPD         (std::map<std::string, std::string> attributes);
+                MPD         ();
+                virtual ~MPD();
+
+                std::string             getType                 () throw(dash::exception::AttributeNotPresentException);
+                std::string             getDuration             () throw(dash::exception::AttributeNotPresentException);
+                std::string             getMinBufferTime        () throw(dash::exception::AttributeNotPresentException);
+                std::vector<BaseUrl *>  getBaseUrls             ();
+                std::vector<Period *>   getPeriods              ();
+                ProgramInformation*     getProgramInformation   () throw(dash::exception::ElementNotPresentException);
+
+                void    addPeriod               (Period *period);
+                void    addBaseUrl              (BaseUrl *url);
+                void    setProgramInformation   (ProgramInformation *progInfo);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                std::vector<Period *>               periods;
+                std::vector<BaseUrl *>              baseUrls;
+                ProgramInformation                  *programInfo;
+        };
+    }
+}
+#endif /* MPD_H_ */
diff --git a/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp b/modules/stream_filter/dash/mpd/MPDManagerFactory.cpp
new file mode 100644 (file)
index 0000000..fdf3e2e
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * MPDManagerFactory.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Apr 20, 2011
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "mpd/MPDManagerFactory.h"
+
+using namespace dash::mpd;
+using namespace dash::xml;
+
+MPDManagerFactory::MPDManagerFactory()
+{
+    // TODO Auto-generated constructor stub
+
+}
+
+MPDManagerFactory::~MPDManagerFactory()
+{
+    // TODO Auto-generated destructor stub
+}
+
+IMPDManager* MPDManagerFactory::create                  (Profile profile, Node *root)
+{
+    switch(profile)
+    {
+        case mpd::Basic:    return new NullManager();
+        case mpd::BasicCM:  return this->createBasicCMManager(root);
+        case mpd::Full2011: return new NullManager();
+        case mpd::NotValid: return new NullManager();
+
+        default:            return new NullManager();
+    }
+}
+IMPDManager* MPDManagerFactory::createBasicCMManager    (Node *root)
+{
+    BasicCMParser *parser = new BasicCMParser(root);
+
+    if(!parser->parse())
+        return new NullManager();
+
+    BasicCMManager *manager =  new BasicCMManager(parser->getMPD());
+
+    delete(parser);
+
+    return manager;
+}
diff --git a/modules/stream_filter/dash/mpd/MPDManagerFactory.h b/modules/stream_filter/dash/mpd/MPDManagerFactory.h
new file mode 100644 (file)
index 0000000..6741696
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * MPDManagerFactory.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Apr 20, 2011
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef MPDMANAGERFACTORY_H_
+#define MPDMANAGERFACTORY_H_
+
+#include "mpd/IMPDManager.h"
+#include "mpd/NullManager.h"
+#include "mpd/BasicCMManager.h"
+#include "mpd/BasicCMParser.h"
+#include "xml/Node.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class MPDManagerFactory
+        {
+            public:
+                MPDManagerFactory           ();
+                virtual ~MPDManagerFactory  ();
+
+                IMPDManager* create(Profile profile, dash::xml::Node *root);
+
+            private:
+                IMPDManager* createBasicCMManager(dash::xml::Node *root);
+        };
+    }
+}
+
+#endif /* MPDMANAGERFACTORY_H_ */
diff --git a/modules/stream_filter/dash/mpd/NullManager.cpp b/modules/stream_filter/dash/mpd/NullManager.cpp
new file mode 100644 (file)
index 0000000..4568b83
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * NullManager.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Apr 20, 2011
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "mpd/NullManager.h"
+
+using namespace dash::mpd;
+
+NullManager::NullManager    ()
+{
+
+}
+NullManager::~NullManager   ()
+{
+}
+
+std::vector<Period *>   NullManager::getPeriods              ()
+{
+    return std::vector<Period *>();
+}
+Period*                 NullManager::getFirstPeriod          ()
+{
+    return NULL;
+}
+Period*                 NullManager::getNextPeriod           (Period *period)
+{
+    return NULL;
+}
+Representation*         NullManager::getBestRepresentation   (Period *period)
+{
+    return NULL;
+}
+std::vector<ISegment *> NullManager::getSegments             (Representation *rep)
+{
+    return std::vector<ISegment *>();
+}
+Representation*         NullManager::getRepresentation       (Period *period, long bitrate)
+{
+    return NULL;
+}
diff --git a/modules/stream_filter/dash/mpd/NullManager.h b/modules/stream_filter/dash/mpd/NullManager.h
new file mode 100644 (file)
index 0000000..fc17bfa
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * NullManager.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Apr 20, 2011
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef NULLMANAGER_H_
+#define NULLMANAGER_H_
+
+#include "mpd/IMPDManager.h"
+
+#include "mpd/Period.h"
+#include "mpd/Representation.h"
+#include "mpd/ISegment.h"
+#include "mpd/IMPDManager.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class NullManager : public IMPDManager
+        {
+            public:
+                NullManager         ();
+                virtual ~NullManager();
+
+                std::vector<Period *>   getPeriods              ();
+                Period*                 getFirstPeriod          ();
+                Period*                 getNextPeriod           (Period *period);
+                Representation*         getBestRepresentation   (Period *period);
+                std::vector<ISegment *> getSegments             (Representation *rep);
+                Representation*         getRepresentation       (Period *period, long bitrate);
+        };
+    }
+}
+
+#endif /* NULLMANAGER_H_ */
diff --git a/modules/stream_filter/dash/mpd/Period.cpp b/modules/stream_filter/dash/mpd/Period.cpp
new file mode 100644 (file)
index 0000000..4a795be
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Period.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Period.h"
+
+using namespace dash::mpd;
+
+Period::Period  (std::map<std::string, std::string> attributes)
+{
+    this->attributes = attributes;
+}
+Period::~Period ()
+{
+    for(int i = 0; i < this->groups.size(); i++)
+        delete(this->groups.at(i));
+}
+
+std::vector<Group*> Period::getGroups   ()
+{
+    return this->groups;
+}
+void                Period::addGroup    (Group *group)
+{
+    this->groups.push_back(group);
+}
diff --git a/modules/stream_filter/dash/mpd/Period.h b/modules/stream_filter/dash/mpd/Period.h
new file mode 100644 (file)
index 0000000..d019bc4
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Period.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifndef PERIOD_H_
+#define PERIOD_H_
+
+#include <vector>
+#include <string>
+#include <map>
+
+#include "mpd/Group.h"
+#include "mpd/Representation.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Period
+        {
+            public:
+                Period          (std::map<std::string, std::string> attributes);
+                virtual ~Period ();
+
+                std::vector<Group *>    getGroups   ();
+                void                    addGroup    (Group *group);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                std::vector<Group *>                groups;
+
+
+        };
+    }
+}
+
+#endif /* PERIOD_H_ */
diff --git a/modules/stream_filter/dash/mpd/ProgramInformation.cpp b/modules/stream_filter/dash/mpd/ProgramInformation.cpp
new file mode 100644 (file)
index 0000000..669ee8e
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * ProgramInformation.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "ProgramInformation.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+ProgramInformation::ProgramInformation  (std::map<std::string, std::string> attr)
+{
+    this->attributes    = attr;
+}
+ProgramInformation::~ProgramInformation ()
+{
+}
+
+std::string ProgramInformation::getTitle                () throw(ElementNotPresentException)
+{
+    if(this->title.empty())
+        throw ElementNotPresentException();
+
+    return this->title;
+}
+std::string ProgramInformation::getCopyright            () throw(ElementNotPresentException)
+{
+    if(this->copyright.empty())
+        throw ElementNotPresentException();
+
+    return this->copyright;
+}
+std::string ProgramInformation::getSource               () throw(ElementNotPresentException)
+{
+    if(this->source.empty())
+        throw ElementNotPresentException();
+
+    return this->source;
+}
+std::string ProgramInformation::getMoreInformationUrl   () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("moreInformationURL") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["moreInformationURL"];
+
+}
+void        ProgramInformation::setTitle                (std::string title)
+{
+    this->title = title;
+}
+void        ProgramInformation::setCopyright            (std::string copyright)
+{
+    this->copyright = copyright;
+}
+void        ProgramInformation::setSource               (std::string source)
+{
+    this->source = source;
+}
diff --git a/modules/stream_filter/dash/mpd/ProgramInformation.h b/modules/stream_filter/dash/mpd/ProgramInformation.h
new file mode 100644 (file)
index 0000000..44b22f8
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * ProgramInformation.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef PROGRAMINFORMATION_H_
+#define PROGRAMINFORMATION_H_
+
+#include <string>
+#include <map>
+
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class ProgramInformation
+        {
+            public:
+                ProgramInformation          (std::map<std::string, std::string> attr);
+                virtual ~ProgramInformation ();
+
+                std::string getMoreInformationUrl   () throw(dash::exception::AttributeNotPresentException);
+                std::string getTitle                () throw(dash::exception::ElementNotPresentException);
+                std::string getSource               () throw(dash::exception::ElementNotPresentException);
+                std::string getCopyright            () throw(dash::exception::ElementNotPresentException);
+
+                void setTitle       (std::string title);
+                void setSource      (std::string source);
+                void setCopyright   (std::string copyright);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                std::string                         title;
+                std::string                         source;
+                std::string                         copyright;
+        };
+    }
+}
+
+#endif /* PROGRAMINFORMATION_H_ */
diff --git a/modules/stream_filter/dash/mpd/Rating.h b/modules/stream_filter/dash/mpd/Rating.h
new file mode 100644 (file)
index 0000000..e2831de
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Rating.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef RATING_H_
+#define RATING_H_
+
+#include "mpd/ContentDescription.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Rating : public ContentDescription
+        {
+        };
+    }
+}
+
+#endif /* RATING_H_ */
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
new file mode 100644 (file)
index 0000000..160e763
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * Representation.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Representation.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+Representation::Representation  (std::map<std::string, std::string>  attributes)
+{
+    this->attributes        = attributes;
+    this->contentProtection = NULL;
+    this->trickModeType     = NULL;
+    this->segmentInfo       = NULL;
+}
+Representation::~Representation ()
+{
+    delete(this->segmentInfo);
+    delete(this->contentProtection);
+    delete(this->trickModeType);
+}
+
+std::string         Representation::getFrameRate            () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("frameRate") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["frameRate"];
+
+}
+std::string         Representation::getSamplingRate         () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("samplingRate") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["samplingRate"];
+
+}
+std::string         Representation::getDependencyId         () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("dependencyId") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["dependencyId"];
+
+}
+std::string         Representation::getId                   () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("id") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["id"];
+
+}
+std::string         Representation::getLang                 () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("lang") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["lang"];
+
+}
+std::string         Representation::getParX                 () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("parx") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["parx"];
+
+}
+std::string         Representation::getParY                 () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("pary") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["pary"];
+
+}
+std::string         Representation::getHeight               () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("height") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["height"];
+
+}
+std::string         Representation::getWidth                () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("width") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["width"];
+
+}
+std::string         Representation::getBandwidth            () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("bandwidth") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["bandwidth"];
+
+}
+std::string         Representation::getNumberOfChannels     () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("numberOfChannels") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["numberOfChannels"];
+
+}
+SegmentInfo*        Representation::getSegmentInfo          () throw(ElementNotPresentException)
+{
+    if(this->segmentInfo == NULL)
+        throw ElementNotPresentException();
+
+    return this->segmentInfo;
+}
+TrickModeType*      Representation::getTrickModeType        () throw(ElementNotPresentException)
+{
+    if(this->segmentInfo == NULL)
+        throw ElementNotPresentException();
+
+    return this->trickModeType;
+}
+ContentProtection*  Representation::getContentProtection    () throw(ElementNotPresentException)
+{
+    if(this->contentProtection == NULL)
+        throw ElementNotPresentException();
+
+    return this->contentProtection;
+}
+void                Representation::setTrickModeType        (TrickModeType *trickModeType)
+{
+    this->trickModeType = trickModeType;
+}
+void                Representation::setContentProtection    (ContentProtection *protection)
+{
+    this->contentProtection = protection;
+}
+void                Representation::setSegmentInfo          (SegmentInfo *info)
+{
+    this->segmentInfo = info;
+}
diff --git a/modules/stream_filter/dash/mpd/Representation.h b/modules/stream_filter/dash/mpd/Representation.h
new file mode 100644 (file)
index 0000000..1b6debf
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Representation.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef REPRESENTATION_H_
+#define REPRESENTATION_H_
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "mpd/SegmentInfo.h"
+#include "mpd/TrickModeType.h"
+#include "mpd/ContentProtection.h"
+#include "exceptions/AttributeNotPresentException.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Representation
+        {
+            public:
+                Representation          (std::map<std::string, std::string>  attributes);
+                virtual ~Representation ();
+
+                std::string         getWidth                () throw(dash::exception::AttributeNotPresentException);
+                std::string         getHeight               () throw(dash::exception::AttributeNotPresentException);
+                std::string         getParX                 () throw(dash::exception::AttributeNotPresentException);
+                std::string         getParY                 () throw(dash::exception::AttributeNotPresentException);
+                std::string         getLang                 () throw(dash::exception::AttributeNotPresentException);
+                std::string         getFrameRate            () throw(dash::exception::AttributeNotPresentException);
+                std::string         getId                   () throw(dash::exception::AttributeNotPresentException);
+                std::string         getBandwidth            () throw(dash::exception::AttributeNotPresentException);
+                std::string         getDependencyId         () throw(dash::exception::AttributeNotPresentException);
+                std::string         getNumberOfChannels     () throw(dash::exception::AttributeNotPresentException);
+                std::string         getSamplingRate         () throw(dash::exception::AttributeNotPresentException);
+                SegmentInfo*        getSegmentInfo          () throw(dash::exception::ElementNotPresentException);
+                TrickModeType*      getTrickModeType        () throw(dash::exception::ElementNotPresentException);
+                ContentProtection*  getContentProtection    () throw(dash::exception::ElementNotPresentException);
+
+                void    setSegmentInfo         (SegmentInfo *info);
+                void    setTrickModeType       (TrickModeType *trickModeType);
+                void    setContentProtection   (ContentProtection *protection);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                SegmentInfo                         *segmentInfo;
+                TrickModeType                       *trickModeType;
+                ContentProtection                   *contentProtection;
+
+        };
+    }
+}
+
+#endif /* REPRESENTATION_H_ */
diff --git a/modules/stream_filter/dash/mpd/SchemeInformation.cpp b/modules/stream_filter/dash/mpd/SchemeInformation.cpp
new file mode 100644 (file)
index 0000000..829e3ce
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * SchemeInformation.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "SchemeInformation.h"
+
+using namespace dash::mpd;
+
+SchemeInformation::SchemeInformation    ()
+{
+
+}
+SchemeInformation::~SchemeInformation   ()
+{
+}
diff --git a/modules/stream_filter/dash/mpd/SchemeInformation.h b/modules/stream_filter/dash/mpd/SchemeInformation.h
new file mode 100644 (file)
index 0000000..8ca967e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * SchemeInformation.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef SCHEMEINFORMATION_H_
+#define SCHEMEINFORMATION_H_
+
+namespace dash
+{
+    namespace mpd
+    {
+        class SchemeInformation
+        {
+            public:
+                SchemeInformation           ();
+                virtual ~SchemeInformation  ();
+        };
+    }
+}
+
+#endif /* SCHEMEINFORMATION_H_ */
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
new file mode 100644 (file)
index 0000000..86634fa
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Segment.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Segment.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+Segment::Segment    (std::map<std::string, std::string>  attributes)
+{
+    this->attributes = attributes;
+}
+Segment::~Segment   ()
+{
+}
+
+std::string Segment::getSourceUrl () throw(AttributeNotPresentException)
+{
+    if(this->attributes.find("sourceURL") == this->attributes.end())
+        throw AttributeNotPresentException();
+
+    return this->attributes["sourceURL"];
+}
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
new file mode 100644 (file)
index 0000000..1f45d5d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Segment.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef SEGMENT_H_
+#define SEGMENT_H_
+
+#include <map>
+#include <string>
+
+#include "exceptions/AttributeNotPresentException.h"
+#include "mpd/ISegment.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Segment : public ISegment
+        {
+            public:
+                Segment             (std::map<std::string, std::string>  attributes);
+                virtual ~Segment    ();
+
+                std::string getSourceUrl() throw(dash::exception::AttributeNotPresentException);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+        };
+    }
+}
+
+#endif /* SEGMENT_H_ */
diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.cpp b/modules/stream_filter/dash/mpd/SegmentInfo.cpp
new file mode 100644 (file)
index 0000000..cf66359
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * SegmentInfo.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "SegmentInfo.h"
+
+using namespace dash::mpd;
+using namespace dash::exception;
+
+SegmentInfo::SegmentInfo(std::map<std::string,std::string> attr)
+{
+    this->attributes    = attr;
+    this->initSeg       = NULL;
+}
+SegmentInfo::~SegmentInfo   ()
+{
+    for(int i = 0; i < this->segments.size(); i++)
+        delete(this->segments.at(i));
+
+    delete(this->initSeg);
+}
+
+InitSegment*            SegmentInfo::getInitSegment     () throw(ElementNotPresentException)
+{
+    if(this->initSeg == NULL)
+        throw ElementNotPresentException();
+
+    return this->initSeg;
+}
+std::vector<Segment*>   SegmentInfo::getSegments        ()
+{
+    return this->segments;
+}
+void                    SegmentInfo::addSegment         (Segment *seg)
+{
+    this->segments.push_back(seg);
+}
+void                    SegmentInfo::setInitSegment     (InitSegment *initSeg)
+{
+    this->initSeg = initSeg;
+}
diff --git a/modules/stream_filter/dash/mpd/SegmentInfo.h b/modules/stream_filter/dash/mpd/SegmentInfo.h
new file mode 100644 (file)
index 0000000..43cce91
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * SegmentInfo.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef SEGMENTINFO_H_
+#define SEGMENTINFO_H_
+
+#include <vector>
+#include <string>
+#include <map>
+
+#include "mpd/Segment.h"
+#include "mpd/InitSegment.h"
+#include "exceptions/ElementNotPresentException.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class SegmentInfo
+        {
+            public:
+                SegmentInfo             (std::map<std::string, std::string> attr);
+                virtual ~SegmentInfo    ();
+
+                InitSegment*            getInitSegment  () throw(dash::exception::ElementNotPresentException);
+                std::vector<Segment *>  getSegments     ();
+                void                    setInitSegment  (InitSegment *initSeg);
+                void                    addSegment      (Segment *seg);
+
+            private:
+                std::map<std::string, std::string>  attributes;
+                InitSegment                         *initSeg;
+                std::vector<Segment *>              segments;
+        };
+    }
+}
+
+#endif /* SEGMENTINFO_H_ */
diff --git a/modules/stream_filter/dash/mpd/TrickModeType.cpp b/modules/stream_filter/dash/mpd/TrickModeType.cpp
new file mode 100644 (file)
index 0000000..8e4a587
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * TrickModeType.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "TrickModeType.h"
+
+using namespace dash::mpd;
+
+TrickModeType::TrickModeType    ()
+{
+
+}
+TrickModeType::~TrickModeType   ()
+{
+}
diff --git a/modules/stream_filter/dash/mpd/TrickModeType.h b/modules/stream_filter/dash/mpd/TrickModeType.h
new file mode 100644 (file)
index 0000000..9f61d0a
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * TrickModeType.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef TRICKMODETYPE_H_
+#define TRICKMODETYPE_H_
+
+#include <string>
+#include <map>
+
+namespace dash
+{
+    namespace mpd
+    {
+        class TrickModeType
+        {
+            public:
+                TrickModeType           ();
+                virtual ~TrickModeType  ();
+
+                std::string getAlternatePlayoutRate();
+
+            private:
+                std::map<std::string, std::string>  attributes;
+        };
+    }
+}
+#endif /* TRICKMODETYPE_H_ */
diff --git a/modules/stream_filter/dash/mpd/Viewpoint.h b/modules/stream_filter/dash/mpd/Viewpoint.h
new file mode 100644 (file)
index 0000000..ea33154
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Viewpoint.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VIEWPOINT_H_
+#define VIEWPOINT_H_
+
+#include "mpd/ContentDescription.h"
+
+namespace dash
+{
+    namespace mpd
+    {
+        class Viewpoint : public ContentDescription
+        {
+        };
+    }
+}
+
+#endif /* VIEWPOINT_H_ */
diff --git a/modules/stream_filter/dash/xml/DOMHelper.cpp b/modules/stream_filter/dash/xml/DOMHelper.cpp
new file mode 100644 (file)
index 0000000..a053237
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * DOMHelper.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "DOMHelper.h"
+
+using namespace dash::xml;
+
+std::vector<Node *> DOMHelper::getElementByTagName      (Node *root, std::string name, bool selfContain)
+{
+    std::vector<Node *> elements;
+
+    for(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, std::string name)
+{
+    std::vector<Node *> elements;
+
+    for(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, 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(int i = 0; i < root->getSubNodes().size(); i++)
+    {
+        getElementsByTagName(root->getSubNodes().at(i), name, elements, selfContain);
+    }
+}
diff --git a/modules/stream_filter/dash/xml/DOMHelper.h b/modules/stream_filter/dash/xml/DOMHelper.h
new file mode 100644 (file)
index 0000000..75a93bb
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * DOMHelper.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef DOMHELPER_H_
+#define DOMHELPER_H_
+
+#include <vector>
+#include <string>
+
+#include "xml/Node.h"
+
+namespace dash
+{
+    namespace xml
+    {
+        class DOMHelper
+        {
+            public:
+                static std::vector<Node *> getElementByTagName      (Node *root, std::string name, bool selfContain);
+                static std::vector<Node *> getChildElementByTagName (Node *root, std::string name);
+
+            private:
+                static void getElementsByTagName(Node *root, std::string name, std::vector<Node *> *elements, bool selfContain);
+        };
+    }
+}
+
+#endif /* DOMHELPER_H_ */
diff --git a/modules/stream_filter/dash/xml/DOMParser.cpp b/modules/stream_filter/dash/xml/DOMParser.cpp
new file mode 100644 (file)
index 0000000..0cd74d6
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * DOMParser.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "DOMParser.h"
+
+using namespace dash::xml;
+using namespace dash::http;
+using namespace dash::mpd;
+
+DOMParser::DOMParser    (stream_t *stream)
+{
+    this->stream = stream;
+    this->init();
+}
+DOMParser::~DOMParser   ()
+{
+    if(this->vlc_reader)
+        xml_ReaderDelete(this->vlc_reader);
+}
+
+Node*   DOMParser::getRootNode              ()
+{
+    return this->root;
+}
+bool    DOMParser::parse                    ()
+{
+    this->vlc_xml = xml_Create(this->stream);
+
+    if(!this->vlc_xml)
+        return false;
+
+    this->vlc_reader = xml_ReaderCreate(this->vlc_xml, this->stream);
+
+    if(!this->vlc_reader)
+        return false;
+
+    this->root = this->processNode();
+
+    return true;
+}
+Node*   DOMParser::processNode              ()
+{
+    const char *data;
+    int type = xml_ReaderNextNode(this->vlc_reader, &data);
+    if(type != XML_READER_TEXT && type != XML_READER_NONE && type != XML_READER_ENDELEM)
+    {
+        Node *node = new Node();
+
+        std::string name    = data;
+        bool        isEmpty = xml_ReaderIsEmptyElement(this->vlc_reader);
+        node->setName(name);
+
+        this->addAttributesToNode(node);
+
+        if(isEmpty)
+            return node;
+
+        Node *subnode = NULL;
+
+        while(subnode = this->processNode())
+            node->addSubNode(subnode);
+
+        return node;
+    }
+    return NULL;
+}
+void    DOMParser::addAttributesToNode      (Node *node)
+{
+    const char *attrValue;
+    const char *attrName;
+
+    while((attrName = xml_ReaderNextAttr(this->vlc_reader, &attrValue)) != NULL)
+    {
+        std::string key     = attrName;
+        std::string value   = attrValue;
+        node->addAttribute(key, value);
+    }
+}
+void    DOMParser::print                    (Node *node, int offset)
+{
+    for(int i = 0; i < offset; i++)
+        msg_Dbg(this->stream, " ");
+
+    msg_Dbg(this->stream, "%s", node->getName().c_str());
+
+    std::vector<std::string> keys = node->getAttributeKeys();
+
+    for(int i = 0; i < keys.size(); i++)
+        msg_Dbg(this->stream, " %s=%s", keys.at(i).c_str(), node->getAttributeValue(keys.at(i)).c_str());
+
+    msg_Dbg(this->stream, "\n");
+
+    offset++;
+
+    for(int i = 0; i < node->getSubNodes().size(); i++)
+    {
+        this->print(node->getSubNodes().at(i), offset);
+    }
+}
+void    DOMParser::init                     ()
+{
+    this->root          = NULL;
+    this->vlc_reader    = NULL;
+}
+void    DOMParser::print                    ()
+{
+    this->print(this->root, 0);
+}
+Profile DOMParser::getProfile               (dash::xml::Node *node)
+{
+    std::string profile = node->getAttributeValue("profiles");
+
+    if(!profile.compare("urn:mpeg:mpegB:profile:dash:isoff-basic-on-demand:cm"))
+        return dash::mpd::BasicCM;
+
+    return dash::mpd::NotValid;
+}
+bool    DOMParser::isDash                   ()
+{
+    const uint8_t *peek, *peek_end;
+
+    int64_t i_size = stream_Peek(this->stream, &peek, 2048);
+    if(i_size < 1)
+        return false;
+
+    peek_end = peek + i_size;
+    while(peek <= peek_end)
+    {
+        const char *p = strstr((const char*)peek, "urn:mpeg:mpegB:schema:DASH:MPD:DIS2011");
+        if (p != NULL)
+            return true;
+        peek++;
+    };
+
+    return false;
+}
diff --git a/modules/stream_filter/dash/xml/DOMParser.h b/modules/stream_filter/dash/xml/DOMParser.h
new file mode 100644 (file)
index 0000000..5d47412
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * DOMParser.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef DOMPARSER_H_
+#define DOMPARSER_H_
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_stream.h>
+#include <vlc_xml.h>
+
+#include <string.h>
+#include <vector>
+#include <iostream>
+#include <cstdio>
+#include <fstream>
+#include <stdio.h>
+
+#include "xml/Node.h"
+#include "http/IHTTPConnection.h"
+#include "mpd/IMPDManager.h"
+
+namespace dash
+{
+    namespace xml
+    {
+        class DOMParser
+        {
+            public:
+                DOMParser           (stream_t *stream);
+                virtual ~DOMParser  ();
+
+                bool                parse       ();
+                Node*               getRootNode ();
+                void                print       ();
+                dash::mpd::Profile  getProfile  (dash::xml::Node *node);
+                bool                isDash      ();
+
+            private:
+                Node                *root;
+                stream_t            *stream;
+
+                xml_t               *vlc_xml;
+                xml_reader_t        *vlc_reader;
+
+                void    init                    ();
+                Node*   processNode             ();
+                void    addAttributesToNode     (Node *node);
+                void    print                   (Node *node, int offset);
+        };
+    }
+}
+
+#endif /* DOMPARSER_H_ */
diff --git a/modules/stream_filter/dash/xml/Node.cpp b/modules/stream_filter/dash/xml/Node.cpp
new file mode 100644 (file)
index 0000000..20914a8
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Node.cpp
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "Node.h"
+
+using namespace dash::xml;
+
+Node::Node  ()
+{
+}
+Node::~Node ()
+{
+    for(int i = 0; i < this->subNodes.size(); i++)
+        delete(this->subNodes.at(i));
+}
+
+std::vector<Node*>                  Node::getSubNodes           ()
+{
+    return this->subNodes;
+}
+void                                Node::addSubNode            (Node *node)
+{
+    this->subNodes.push_back(node);
+}
+std::string                         Node::getName               ()
+{
+    return this->name;
+}
+void                                Node::setName               (std::string name)
+{
+    this->name = name;
+}
+std::string                         Node::getAttributeValue     (std::string key)
+{
+    return this->attributes[key];
+}
+void                                Node::addAttribute          (std::string key, std::string value)
+{
+    this->attributes[key] = value;
+}
+std::vector<std::string>            Node::getAttributeKeys      ()
+{
+    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               ()
+{
+    return false;
+}
+std::string                         Node::getText               ()
+{
+    return "";
+}
+std::map<std::string,std::string>   Node::getAttributes         ()
+{
+    return this->attributes;
+}
diff --git a/modules/stream_filter/dash/xml/Node.h b/modules/stream_filter/dash/xml/Node.h
new file mode 100644 (file)
index 0000000..4a28c5f
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Node.h
+ *****************************************************************************
+ * Copyright (C) 2010 - 2011 Klagenfurt University
+ *
+ * Created on: Aug 10, 2010
+ * Authors: Christopher Mueller <christopher.mueller@itec.uni-klu.ac.at>
+ *          Christian Timmerer  <christian.timmerer@itec.uni-klu.ac.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef NODE_H_
+#define NODE_H_
+
+#include <vector>
+#include <string>
+#include <map>
+#include <iostream>
+
+namespace dash
+{
+    namespace xml
+    {
+        class Node
+        {
+            public:
+                Node            ();
+                virtual ~Node   ();
+
+                std::vector<Node *>                 getSubNodes         ();
+                void                                addSubNode          (Node *node);
+                std::string                         getName             ();
+                void                                setName             (std::string name);
+                void                                addAttribute        (std::string key, std::string value);
+                std::string                         getAttributeValue   (std::string key);
+                std::vector<std::string>            getAttributeKeys    ();
+                bool                                hasText             ();
+                std::string                         getText             ();
+                std::map<std::string, std::string>  getAttributes       ();
+
+            private:
+                std::vector<Node *>                 subNodes;
+                std::map<std::string, std::string>  attributes;
+                std::string                         name;
+
+        };
+    }
+}
+
+#endif /* NODE_H_ */