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

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