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

dash: Store the parent representation for every segments.

Conflicts:

	modules/stream_filter/dash/mpd/Segment.cpp
	modules/stream_filter/dash/mpd/Segment.h
parent 466e3f44
......@@ -404,7 +404,7 @@ Segment* BasicCMParser::parseSegment( Node* node )
seg = new SegmentTemplate( runtimeToken, this->currentRepresentation );
}
else
seg = new Segment;
seg = new Segment( this->currentRepresentation );
if ( url.find( this->p_stream->psz_access ) != 0 ) //Relative url
url = this->url + url;
seg->setSourceUrl( url );
......
......@@ -34,7 +34,8 @@ using namespace dash::xml;
IsoffMainParser::IsoffMainParser (Node *root, stream_t *p_stream) :
root (root),
p_stream (p_stream),
mpd (NULL)
mpd (NULL),
currentRepresentation( NULL )
{
}
IsoffMainParser::~IsoffMainParser ()
......@@ -113,6 +114,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
for(size_t i = 0; i < representations.size(); i++)
{
Representation *rep = new Representation;
this->currentRepresentation = rep;
this->setSegmentBase(representations.at(i), rep);
this->setSegmentList(representations.at(i), rep);
rep->setBandwidth(atoi(representations.at(i)->getAttributeValue("bandwidth").c_str()));
......@@ -148,7 +150,7 @@ void IsoffMainParser::setInitSegment (dash::xml::Node *segBaseNode, Segme
if(initSeg.size() > 0)
{
Segment *seg = new Segment();
Segment *seg = new Segment( this->currentRepresentation );
seg->setSourceUrl(initSeg.at(0)->getAttributeValue("sourceURL"));
if(initSeg.at(0)->hasAttribute("range"))
......@@ -170,7 +172,7 @@ void IsoffMainParser::setSegments (dash::xml::Node *segListNode, Segme
for(size_t i = 0; i < segments.size(); i++)
{
Segment *seg = new Segment();
Segment *seg = new Segment( this->currentRepresentation );
seg->setSourceUrl(segments.at(i)->getAttributeValue("media"));
if(segments.at(0)->hasAttribute("mediaRange"))
......
......@@ -62,6 +62,7 @@ namespace dash
dash::xml::Node *root;
stream_t *p_stream;
MPD *mpd;
Representation *currentRepresentation;
void setMPDAttributes ();
void setMPDBaseUrl ();
......
......@@ -30,11 +30,11 @@
using namespace dash::mpd;
using namespace dash::http;
Segment::Segment () :
Segment::Segment(const Representation *parent) :
startByte (-1),
endByte (-1)
endByte (-1),
parentRepresentation( parent )
{
}
std::string Segment::getSourceUrl () const
......@@ -99,7 +99,6 @@ dash::http::Chunk* Segment::toChunk ()
chunk->addOptionalUrl(ss.str());
ss.clear();
}
}
else
{
......@@ -108,3 +107,8 @@ dash::http::Chunk* Segment::toChunk ()
return chunk;
}
const Representation *Segment::getParentRepresentation() const
{
return this->parentRepresentation;
}
......@@ -35,10 +35,11 @@ namespace dash
{
namespace mpd
{
class Representation;
class Segment
{
public:
Segment();
Segment( const Representation *parent );
virtual ~Segment(){}
virtual std::string getSourceUrl() const;
virtual void setSourceUrl( const std::string &url );
......@@ -55,12 +56,14 @@ namespace dash
virtual int getStartByte () const;
virtual int getEndByte () const;
virtual dash::http::Chunk* toChunk ();
const Representation* getParentRepresentation() const;
protected:
std::string sourceUrl;
std::vector<BaseUrl *> baseUrls;
int startByte;
int endByte;
const Representation* parentRepresentation;
};
}
}
......
......@@ -39,8 +39,8 @@ using namespace dash::mpd;
SegmentTemplate::SegmentTemplate( bool containRuntimeIdentifier,
Representation* representation ) :
Segment( representation ),
containRuntimeIdentifier( containRuntimeIdentifier ),
representation( representation ),
beginTime( std::string::npos ),
beginIndex( std::string::npos ),
currentSegmentIndex( 0 )
......@@ -60,10 +60,10 @@ std::string SegmentTemplate::getSourceUrl() const
{
//FIXME: This should use the current representation SegmentInfo
//which "inherits" the SegmentInfoDefault values.
if ( this->representation->getParentGroup()->getSegmentInfoDefault() != NULL &&
this->representation->getParentGroup()->getSegmentInfoDefault()->getSegmentTimeline() != NULL )
if ( this->parentRepresentation->getParentGroup()->getSegmentInfoDefault() != NULL &&
this->parentRepresentation->getParentGroup()->getSegmentInfoDefault()->getSegmentTimeline() != NULL )
{
const SegmentTimeline::Element *el = this->representation->getParentGroup()->
const SegmentTimeline::Element *el = this->parentRepresentation->getParentGroup()->
getSegmentInfoDefault()->getSegmentTimeline()->getElement( this->currentSegmentIndex );
if ( el != NULL )
{
......
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