[vlc-commits] demux: dash: fix parent context for init segments
Francois Cartegnie
git at videolan.org
Thu Apr 30 20:50:23 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 30 14:21:02 2015 +0200| [eb1dd7199043ea24cfdb3a2192237577e55505c8] | committer: Francois Cartegnie
demux: dash: fix parent context for init segments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb1dd7199043ea24cfdb3a2192237577e55505c8
---
modules/demux/dash/mpd/IsoffMainParser.cpp | 23 +++++++++++------------
modules/demux/dash/mpd/IsoffMainParser.h | 4 +---
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index 65cbd8e..073a5e8 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -52,7 +52,6 @@ IsoffMainParser::IsoffMainParser (Node *root_, stream_t *stream)
{
root = root_;
mpd = NULL;
- currentRepresentation = NULL;
p_stream = stream;
}
@@ -229,7 +228,7 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
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);
std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(repNode, "BaseURL");
@@ -240,13 +239,13 @@ void IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
currentRepresentation->setId(repNode->getAttributeValue("id"));
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"))
- this->currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));
+ currentRepresentation->setHeight(atoi(repNode->getAttributeValue("height").c_str()));
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"))
currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));
@@ -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)
@@ -307,14 +306,14 @@ size_t IsoffMainParser::parseSegmentBase(Node * segmentBaseNode, SegmentInformat
if(initSeg)
{
SegmentBase *base = new SegmentBase();
- parseInitSegment(initSeg, base);
+ parseInitSegment(initSeg, base, info);
info->setSegmentBase(base);
}
}
else
{
SegmentBase *base = new SegmentBase();
- parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base);
+ parseInitSegment(DOMHelper::getFirstChildElementByName(segmentBaseNode, "Initialization"), base, info);
info->setSegmentBase(base);
}
@@ -329,9 +328,9 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
{
std::vector<Node *> segments = DOMHelper::getElementByTagName(segListNode, "SegmentURL", false);
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"))
list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
@@ -376,12 +375,12 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
return total;
}
-void IsoffMainParser::parseInitSegment(Node *initNode, Initializable<Segment> *init)
+void IsoffMainParser::parseInitSegment(Node *initNode, Initializable<Segment> *init, SegmentInformation *parent)
{
if(!initNode)
return;
- Segment *seg = new InitSegment( currentRepresentation );
+ Segment *seg = new InitSegment( parent );
seg->setSourceUrl(initNode->getAttributeValue("sourceURL"));
if(initNode->hasAttribute("range"))
diff --git a/modules/demux/dash/mpd/IsoffMainParser.h b/modules/demux/dash/mpd/IsoffMainParser.h
index dfae4c8..5df9df5 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.h
+++ b/modules/demux/dash/mpd/IsoffMainParser.h
@@ -57,7 +57,6 @@ namespace dash
{
class Period;
class AdaptationSet;
- class Representation;
class MPD;
using namespace adaptative::playlist;
@@ -76,7 +75,7 @@ namespace dash
void setMPDAttributes ();
void setAdaptationSets (xml::Node *periodNode, Period *period);
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 parsePeriods (xml::Node *);
size_t parseSegmentInformation(xml::Node *, SegmentInformation *);
@@ -88,7 +87,6 @@ namespace dash
xml::Node *root;
MPD *mpd;
stream_t *p_stream;
- Representation *currentRepresentation;
};
class IsoTime
More information about the vlc-commits
mailing list