Commit dce9c498 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

dash: Representation: Return a usable bandwith value.

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent b4d90eb2
......@@ -80,7 +80,7 @@ Representation* BasicCMManager::getBestRepresentation (Period *period)
{
try
{
long currentBitrate = atol(reps.at(j)->getBandwidth().c_str());
long currentBitrate = reps.at(j)->getBandwidth();
if(currentBitrate > bitrate)
{
bitrate = currentBitrate;
......@@ -119,7 +119,7 @@ Representation* BasicCMManager::getRepresentation (Period *period,
{
try
{
long currentBitrate = atol(reps.at(j)->getBandwidth().c_str());
long currentBitrate = reps.at(j)->getBandwidth();
long dif = bitrate - currentBitrate;
if(bestDif == -1)
......
......@@ -25,6 +25,8 @@
# include "config.h"
#endif
#include <cstdlib>
#include "Representation.h"
using namespace dash::mpd;
......@@ -126,13 +128,13 @@ std::string Representation::getWidth () const throw(Attri
return it->second;
}
std::string Representation::getBandwidth () const throw(AttributeNotPresentException)
int Representation::getBandwidth () const
{
std::map<std::string, std::string>::const_iterator it = this->attributes.find("bandwidth");
if ( it == this->attributes.end())
throw AttributeNotPresentException();
return -1;
return it->second;
return atoi( it->second.c_str() ) / 8;
}
std::string Representation::getNumberOfChannels () const throw(AttributeNotPresentException)
......
......@@ -52,7 +52,12 @@ namespace dash
std::string getLang () const throw(dash::exception::AttributeNotPresentException);
std::string getFrameRate () const throw(dash::exception::AttributeNotPresentException);
std::string getId () const throw(dash::exception::AttributeNotPresentException);
std::string getBandwidth () const throw(dash::exception::AttributeNotPresentException);
/*
* @return The bitrate required for this representation
* in Bytes per seconds.
* -1 if an error occurs.
*/
int getBandwidth () const;
std::string getDependencyId () const throw(dash::exception::AttributeNotPresentException);
std::string getNumberOfChannels () const throw(dash::exception::AttributeNotPresentException);
std::string getSamplingRate () const throw(dash::exception::AttributeNotPresentException);
......
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