Commit e7a13d6b authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

dash: Adding a getter for current representation

parent ec59c3fb
...@@ -63,6 +63,14 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk() throw(EOFException) ...@@ -63,6 +63,14 @@ Chunk* AlwaysBestAdaptationLogic::getNextChunk() throw(EOFException)
} }
return NULL; 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 () void AlwaysBestAdaptationLogic::initSchedule ()
{ {
if(this->mpdManager != NULL) if(this->mpdManager != NULL)
......
...@@ -46,11 +46,13 @@ namespace dash ...@@ -46,11 +46,13 @@ namespace dash
virtual ~AlwaysBestAdaptationLogic (); virtual ~AlwaysBestAdaptationLogic ();
dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException); dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
const mpd::Representation *getCurrentRepresentation() const;
private: private:
std::vector<mpd::Segment *> schedule; std::vector<mpd::Segment *> schedule;
dash::mpd::IMPDManager *mpdManager; dash::mpd::IMPDManager *mpdManager;
size_t count; size_t count;
dash::mpd::Representation *bestRepresentation;
void initSchedule(); void initSchedule();
}; };
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <http/Chunk.h> #include <http/Chunk.h>
#include <adaptationlogic/IDownloadRateObserver.h> #include <adaptationlogic/IDownloadRateObserver.h>
#include <exceptions/EOFException.h> #include <exceptions/EOFException.h>
#include "mpd/Representation.h"
namespace dash namespace dash
{ {
...@@ -46,6 +47,7 @@ namespace dash ...@@ -46,6 +47,7 @@ namespace dash
}; };
virtual dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException) = 0; 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. * \return The average bitrate in Bytes per second.
*/ */
......
...@@ -77,3 +77,8 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException) ...@@ -77,3 +77,8 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
} }
return NULL; return NULL;
} }
const Representation *RateBasedAdaptationLogic::getCurrentRepresentation() const
{
return this->mpdManager->getRepresentation( this->currentPeriod, this->getBpsAvg() );
}
...@@ -42,6 +42,7 @@ namespace dash ...@@ -42,6 +42,7 @@ namespace dash
RateBasedAdaptationLogic (dash::mpd::IMPDManager *mpdManager); RateBasedAdaptationLogic (dash::mpd::IMPDManager *mpdManager);
dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException); dash::http::Chunk* getNextChunk() throw(dash::exception::EOFException);
const dash::mpd::Representation *getCurrentRepresentation() const;
private: private:
dash::mpd::IMPDManager *mpdManager; dash::mpd::IMPDManager *mpdManager;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment