[vlc-commits] dash: Adding a getter for current representation

Hugo Beauzée-Luyssen git at videolan.org
Thu Feb 2 14:40:23 CET 2012


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Feb  1 10:56:05 2012 +0100| [e7a13d6b347b679d9246a9ba9219463d95501bae] | committer: Hugo Beauzée-Luyssen

dash: Adding a getter for current representation

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

 .../adaptationlogic/AlwaysBestAdaptationLogic.cpp  |    8 ++++++++
 .../adaptationlogic/AlwaysBestAdaptationLogic.h    |    2 ++
 .../dash/adaptationlogic/IAdaptationLogic.h        |    2 ++
 .../adaptationlogic/RateBasedAdaptationLogic.cpp   |    5 +++++
 .../adaptationlogic/RateBasedAdaptationLogic.h     |    1 +
 5 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
index bafd05d..0ec58de 100644
--- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.cpp
@@ -63,6 +63,14 @@ Chunk*  AlwaysBestAdaptationLogic::getNextChunk() throw(EOFException)
     }
     return NULL;
 }
+
+const Representation *AlwaysBestAdaptationLogic::getCurrentRepresentation() const
+{
+    if ( this->count < this->schedule.size() )
+        return this->schedule.at( this->count )->getParentRepresentation();
+    return NULL;
+}
+
 void    AlwaysBestAdaptationLogic::initSchedule ()
 {
     if(this->mpdManager != NULL)
diff --git a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
index 27282c9..bf16de3 100644
--- a/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/AlwaysBestAdaptationLogic.h
@@ -46,11 +46,13 @@ namespace dash
                 virtual ~AlwaysBestAdaptationLogic  ();
 
                 dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
+                const mpd::Representation *getCurrentRepresentation() const;
 
             private:
                 std::vector<mpd::Segment *>         schedule;
                 dash::mpd::IMPDManager              *mpdManager;
                 size_t                              count;
+                dash::mpd::Representation           *bestRepresentation;
 
                 void initSchedule();
         };
diff --git a/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
index 7a65716..446da7d 100644
--- a/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/IAdaptationLogic.h
@@ -28,6 +28,7 @@
 #include <http/Chunk.h>
 #include <adaptationlogic/IDownloadRateObserver.h>
 #include <exceptions/EOFException.h>
+#include "mpd/Representation.h"
 
 namespace dash
 {
@@ -46,6 +47,7 @@ namespace dash
                 };
 
                 virtual dash::http::Chunk*  getNextChunk() throw(dash::exception::EOFException) = 0;
+                virtual const dash::mpd::Representation *getCurrentRepresentation() const = 0;
                 /**
                  *  \return     The average bitrate in Bytes per second.
                  */
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
index 1833d05..0eb7887 100644
--- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
@@ -77,3 +77,8 @@ Chunk*  RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
     }
     return NULL;
 }
+
+const Representation *RateBasedAdaptationLogic::getCurrentRepresentation() const
+{
+    return this->mpdManager->getRepresentation( this->currentPeriod, this->getBpsAvg() );
+}
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
index 58d3740..913ec41 100644
--- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
@@ -42,6 +42,7 @@ namespace dash
                 RateBasedAdaptationLogic            (dash::mpd::IMPDManager *mpdManager);
 
                 dash::http::Chunk*      getNextChunk() throw(dash::exception::EOFException);
+                const dash::mpd::Representation *getCurrentRepresentation() const;
 
             private:
                 dash::mpd::IMPDManager  *mpdManager;



More information about the vlc-commits mailing list