[vlc-commits] stream_filter: dash: add support for SegmentLess representations

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:53 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 10 12:36:55 2014 +0100| [a8a3c8e423bf325b63154887cad0f87dfeeac616] | committer: Francois Cartegnie

stream_filter: dash: add support for SegmentLess representations

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8a3c8e423bf325b63154887cad0f87dfeeac616
---

 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |   38 +++++++++++++++-----
 modules/stream_filter/dash/mpd/IsoffMainParser.h   |    4 +--
 2 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index e2f2242..4f751a2 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -110,17 +110,39 @@ void    IsoffMainParser::setRepresentations (Node *adaptationSetNode, Adaptation
         if(repNode->hasAttribute("mimeType"))
             currentRepresentation->setMimeType(repNode->getAttributeValue("mimeType"));
 
-        this->setSegmentBase(repNode, this->currentRepresentation);
-        this->setSegmentList(repNode, this->currentRepresentation);
+        std::vector<Node *> segmentBase = DOMHelper::getElementByTagName(repNode, "SegmentBase", false);
+        std::vector<Node *> segmentList = DOMHelper::getElementByTagName(repNode, "SegmentList", false);
+
+        setSegmentBase(segmentBase, currentRepresentation);
+        setSegmentList(segmentList, currentRepresentation);
+
+        if(segmentBase.empty() && segmentList.empty())
+        {
+            /* unranged & segment less representation, add fake segment */
+            SegmentList *list = new SegmentList();
+            Segment *seg = new Segment(currentRepresentation);
+            if(list && seg)
+            {
+                list->addSegment(seg);
+                currentRepresentation->setSegmentList(list);
+            }
+            else
+            {
+                delete seg;
+                delete list;
+            }
+        }
+
         adaptationSet->addRepresentation(this->currentRepresentation);
     }
 }
 
-void    IsoffMainParser::setSegmentBase     (dash::xml::Node *repNode, Representation *rep)
+void    IsoffMainParser::setSegmentBase     (std::vector<Node *> &segmentBase, Representation *rep)
 {
-    std::vector<Node *> segmentBase = DOMHelper::getElementByTagName(repNode, "SegmentBase", false);
+    if(segmentBase.empty())
+        return;
 
-    if(segmentBase.front()->hasAttribute("indexRange"))
+    else if(segmentBase.front()->hasAttribute("indexRange"))
     {
         SegmentList *list = new SegmentList();
         Segment *seg;
@@ -151,17 +173,15 @@ void    IsoffMainParser::setSegmentBase     (dash::xml::Node *repNode, Represent
             rep->setSegmentBase(base);
         }
     }
-    else if(!segmentBase.empty())
+    else
     {
         SegmentBase *base = new SegmentBase();
         setInitSegment(segmentBase.front(), base);
         rep->setSegmentBase(base);
     }
 }
-void    IsoffMainParser::setSegmentList     (dash::xml::Node *repNode, Representation *rep)
+void    IsoffMainParser::setSegmentList     (std::vector<Node *> &segmentList, Representation *rep)
 {
-    std::vector<Node *> segmentList = DOMHelper::getElementByTagName(repNode, "SegmentList", false);
-
     if(segmentList.size() > 0)
     {
         SegmentList *list = new SegmentList();
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.h b/modules/stream_filter/dash/mpd/IsoffMainParser.h
index 01ada0c..a5a1cad 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.h
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.h
@@ -53,8 +53,8 @@ namespace dash
                 void    setMPDAttributes    ();
                 void    setAdaptationSets   (dash::xml::Node *periodNode, Period *period);
                 void    setRepresentations  (dash::xml::Node *adaptationSetNode, AdaptationSet *adaptationSet);
-                void    setSegmentBase      (dash::xml::Node *repNode, Representation *rep);
-                void    setSegmentList      (dash::xml::Node *repNode, Representation *rep);
+                void    setSegmentBase      (std::vector<xml::Node *> &, Representation *rep);
+                void    setSegmentList      (std::vector<xml::Node *> &, Representation *rep);
                 void    setInitSegment      (dash::xml::Node *segBaseNode, SegmentBase *base);
                 void    setSegments         (dash::xml::Node *segListNode, SegmentList *list);
         };



More information about the vlc-commits mailing list