[vlc-commits] dash: added buffer and downloader to manager

Christopher Mueller git at videolan.org
Tue Feb 14 17:30:21 CET 2012


vlc | branch: master | Christopher Mueller <christopher.mueller at itec.aau.at> | Tue Feb 14 16:43:44 2012 +0100| [b6140023129c64eaf44692de44e361ad84e6f2dc] | committer: Hugo Beauzée-Luyssen

dash: added buffer and downloader to manager

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b6140023129c64eaf44692de44e361ad84e6f2dc
---

 modules/stream_filter/dash/DASHManager.cpp |   61 +++++++++-------------------
 modules/stream_filter/dash/DASHManager.h   |   12 ++++-
 2 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp
index 7060d3e..633bb21 100644
--- a/modules/stream_filter/dash/DASHManager.cpp
+++ b/modules/stream_filter/dash/DASHManager.cpp
@@ -32,17 +32,18 @@ using namespace dash::http;
 using namespace dash::xml;
 using namespace dash::logic;
 using namespace dash::mpd;
+using namespace dash::buffer;
 using namespace dash::exception;
 
 DASHManager::DASHManager    ( HTTPConnectionManager *conManager, MPD *mpd,
                               IAdaptationLogic::LogicType type, stream_t *stream) :
-    conManager( conManager ),
-    currentChunk( NULL ),
-    adaptationLogic( NULL ),
-    logicType( type ),
-    mpdManager( NULL ),
-    mpd( mpd ),
-    stream(stream)
+             conManager     ( conManager ),
+             currentChunk   ( NULL ),
+             adaptationLogic( NULL ),
+             logicType      ( type ),
+             mpdManager     ( NULL ),
+             mpd            ( mpd ),
+             stream         (stream)
 {
     this->mpdManager        = mpd::MPDManagerFactory::create( mpd );
     if ( this->mpdManager == NULL )
@@ -51,54 +52,30 @@ DASHManager::DASHManager    ( HTTPConnectionManager *conManager, MPD *mpd,
     if ( this->adaptationLogic == NULL )
         return ;
     this->conManager->attach(this->adaptationLogic);
+
+    this->buffer    = new BlockBuffer(this->stream);
+    this->downloader = new DASHDownloader(this->conManager, this->adaptationLogic, this->buffer);
 }
 DASHManager::~DASHManager   ()
 {
+    delete this->downloader;
+    delete this->buffer;
     delete this->adaptationLogic;
     delete this->mpdManager;
 }
 
+bool    DASHManager::start()
+{
+    return this->downloader->start();
+}
 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;
+    return this->buffer->get(p_buffer, len);
 }
 
 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;
+    return this->buffer->peek(pp_peek, i_peek);
 }
 
 const mpd::IMPDManager*         DASHManager::getMpdManager() const
diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h
index 8fc1c56..6c9d16a 100644
--- a/modules/stream_filter/dash/DASHManager.h
+++ b/modules/stream_filter/dash/DASHManager.h
@@ -31,6 +31,8 @@
 #include "adaptationlogic/AdaptationLogicFactory.h"
 #include "mpd/IMPDManager.h"
 #include "mpd/MPDManagerFactory.h"
+#include "buffer/BlockBuffer.h"
+#include "DASHDownloader.h"
 #include "exceptions/EOFException.h"
 #include "mpd/MPD.h"
 
@@ -43,9 +45,11 @@ namespace dash
                          logic::IAdaptationLogic::LogicType type, stream_t *stream);
             virtual ~DASHManager    ();
 
-            int read( void *p_buffer, size_t len );
-            int peek( const uint8_t **pp_peek, size_t i_peek );
-            const mpd::IMPDManager*         getMpdManager() const;
+            bool    start   ();
+            int     read    ( void *p_buffer, size_t len );
+            int     peek    ( const uint8_t **pp_peek, size_t i_peek );
+
+            const mpd::IMPDManager*         getMpdManager   () const;
             const logic::IAdaptationLogic*  getAdaptionLogic() const;
             const http::Chunk *getCurrentChunk() const;
 
@@ -57,6 +61,8 @@ namespace dash
             mpd::IMPDManager                    *mpdManager;
             mpd::MPD                            *mpd;
             stream_t                            *stream;
+            DASHDownloader                      *downloader;
+            buffer::BlockBuffer                 *buffer;
     };
 }
 



More information about the vlc-commits mailing list