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

dash: Adding an helper to compute a segment size

Conflicts:

	modules/stream_filter/dash/mpd/Segment.h
parent 7a14bb56
......@@ -26,6 +26,9 @@
#endif
#include "Segment.h"
#include "Representation.h"
#include <cassert>
using namespace dash::mpd;
using namespace dash::http;
......@@ -35,6 +38,11 @@ Segment::Segment(const Representation *parent) :
endByte (-1),
parentRepresentation( parent )
{
assert( parent != NULL );
if ( parent->getSegmentInfo() != NULL && parent->getSegmentInfo()->getDuration() >= 0 )
this->size = parent->getBandwidth() * parent->getSegmentInfo()->getDuration();
else
this->size = -1;
}
std::string Segment::getSourceUrl () const
......@@ -112,3 +120,8 @@ const Representation *Segment::getParentRepresentation() const
{
return this->parentRepresentation;
}
int Segment::getSize() const
{
return this->size;
}
......@@ -57,6 +57,7 @@ namespace dash
virtual int getEndByte () const;
virtual dash::http::Chunk* toChunk ();
const Representation* getParentRepresentation() const;
virtual int getSize() const;
protected:
std::string sourceUrl;
......@@ -64,6 +65,7 @@ namespace dash
int startByte;
int endByte;
const Representation* parentRepresentation;
int size;
};
}
}
......
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