Commit eb1dd719 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: dash: fix parent context for init segments

parent 51e7ebd5
...@@ -52,7 +52,6 @@ IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream) ...@@ -52,7 +52,6 @@ IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream)
{ {
root = root_; root = root_;
mpd = NULL; mpd = NULL;
currentRepresentation = NULL;
p_stream = stream; p_stream = stream;
} }
...@@ -229,7 +228,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation ...@@ -229,7 +228,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++)
{ {
this->currentRepresentation = new Representation(adaptationSet, getMPD()); Representation *currentRepresentation = new Representation(adaptationSet, getMPD());
Node *repNode = representations.at(i); Node *repNode = representations.at(i);
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL"); std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
...@@ -240,13 +239,13 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation ...@@ -240,13 +239,13 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
currentRepresentation->setId(repNode->getAttributeValue("id")); currentRepresentation->setId(repNode->getAttributeValue("id"));
if(repNode->hasAttribute("width")) if(repNode->hasAttribute("width"))
this->currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str())); currentRepresentation->setWidth(atoi(repNode->getAttributeValue("width").c_str()));
if(repNode->hasAttribute("height")) if(repNode->hasAttribute("height"))
this->currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str())); currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));
if(repNode->hasAttribute("bandwidth")) if(repNode->hasAttribute("bandwidth"))
this->currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str())); currentRepresentation->setBandwidth(atoi(repNode->getAttributeValue("bandwidth").c_str()));
if(repNode->hasAttribute("mimeType")) if(repNode->hasAttribute("mimeType"))
currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType")); currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));
...@@ -269,7 +268,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation ...@@ -269,7 +268,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
} }
} }
adaptationSet->addRepresentation(this->currentRepresentation); adaptationSet->addRepresentation(currentRepresentation);
} }
} }
size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformation *info) size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformation *info)
...@@ -307,14 +306,14 @@ size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformat ...@@ -307,14 +306,14 @@ size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformat
if(initSeg) if(initSeg)
{ {
SegmentBase *base = new SegmentBase(); SegmentBase *base = new SegmentBase();
parseInitSegment(initSeg, base); parseInitSegment(initSeg, base, info);
info->setSegmentBase(base); info->setSegmentBase(base);
} }
} }
else else
{ {
SegmentBase *base = new SegmentBase(); SegmentBase *base = new SegmentBase();
parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base); parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base, info);
info->setSegmentBase(base); info->setSegmentBase(base);
} }
...@@ -329,9 +328,9 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation ...@@ -329,9 +328,9 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
{ {
std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false); std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);
SegmentList *list; SegmentList *list;
if(!segments.empty() && (list = new (std::nothrow) SegmentList())) if((list = new (std::nothrow) SegmentList()))
{ {
parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list); parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);
if(segListNode->hasAttribute("duration")) if(segListNode->hasAttribute("duration"))
list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration"))); list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
...@@ -376,12 +375,12 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation ...@@ -376,12 +375,12 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
return total; return total;
} }
void IsoffMainParser::parseInitSegment(Node *initNode, Initializable<Segment> *init) void IsoffMainParser::parseInitSegment(Node *initNode, Initializable<Segment> *init, SegmentInformation *parent)
{ {
if(!initNode) if(!initNode)
return; return;
Segment *seg = new InitSegment( currentRepresentation ); Segment *seg = new InitSegment( parent );
seg->setSourceUrl(initNode->getAttributeValue("sourceURL")); seg->setSourceUrl(initNode->getAttributeValue("sourceURL"));
if(initNode->hasAttribute("range")) if(initNode->hasAttribute("range"))
......
...@@ -57,7 +57,6 @@ namespace dash ...@@ -57,7 +57,6 @@ namespace dash
{ {
class Period; class Period;
class AdaptationSet; class AdaptationSet;
class Representation;
class MPD; class MPD;
using namespace adaptative::playlist; using namespace adaptative::playlist;
...@@ -76,7 +75,7 @@ namespace dash ...@@ -76,7 +75,7 @@ namespace dash
void setMPDAttributes (); void setMPDAttributes ();
void setAdaptationSets (xml::Node *periodNode, Period *period); void setAdaptationSets (xml::Node *periodNode, Period *period);
void setRepresentations (xml::Node *adaptationSetNode, AdaptationSet *adaptationSet); void setRepresentations (xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
void parseInitSegment (xml::Node *, Initializable<Segment> *); void parseInitSegment (xml::Node *, Initializable<Segment> *, SegmentInformation *);
void parseTimeline (xml::Node *, MediaSegmentTemplate *); void parseTimeline (xml::Node *, MediaSegmentTemplate *);
void parsePeriods (xml::Node *); void parsePeriods (xml::Node *);
size_t parseSegmentInformation(xml::Node *, SegmentInformation *); size_t parseSegmentInformation(xml::Node *, SegmentInformation *);
...@@ -88,7 +87,6 @@ namespace dash ...@@ -88,7 +87,6 @@ namespace dash
xml::Node *root; xml::Node *root;
MPD *mpd; MPD *mpd;
stream_t *p_stream; stream_t *p_stream;
Representation *currentRepresentation;
}; };
class IsoTime class IsoTime
......
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