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)
}
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)
......
......@@ -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();
};
......
......@@ -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.
*/
......
......@@ -77,3 +77,8 @@ Chunk* RateBasedAdaptationLogic::getNextChunk() throw(EOFException)
}
return NULL;
}
const Representation *RateBasedAdaptationLogic::getCurrentRepresentation() const
{
return this->mpdManager->getRepresentation( this->currentPeriod, this->getBpsAvg() );
}
......@@ -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;
......
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