[vlc-commits] stream_filter: dash: add init flag on segments

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 20 12:26:27 2014 +0100| [22af55ce63dda6844b5d25d870a9d8c380628a23] | committer: Francois Cartegnie

stream_filter: dash: add init flag on segments

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp   |    6 +++---
 modules/stream_filter/dash/mpd/BasicCMParser.h     |    2 +-
 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |    2 +-
 modules/stream_filter/dash/mpd/Representation.cpp  |   17 ++++++++---------
 modules/stream_filter/dash/mpd/Segment.cpp         |   10 ++++++++--
 modules/stream_filter/dash/mpd/Segment.h           |    4 +++-
 6 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index 3a27907..973b82e 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -341,7 +341,7 @@ bool    BasicCMParser::setSegmentInfo       (Node *root, Representation *rep)
     return false;
 }
 
-Segment*    BasicCMParser::parseSegment( Node* node )
+Segment*    BasicCMParser::parseSegment( Node* node, bool init )
 {
     const std::map<std::string, std::string>    attr = node->getAttributes();
     std::map<std::string, std::string>::const_iterator  it;
@@ -368,7 +368,7 @@ Segment*    BasicCMParser::parseSegment( Node* node )
             seg = new SegmentTemplate( runtimeToken, this->currentRepresentation );
         }
         else
-            seg = new Segment( this->currentRepresentation );
+            seg = new Segment( this->currentRepresentation, init );
         if ( url.find( this->p_stream->psz_access ) != 0 ) //Relative url
             url = this->url + url;
         seg->setSourceUrl( url );
@@ -408,7 +408,7 @@ void    BasicCMParser::setInitSegment       (Node *root, SegmentInfoCommon *info
                      " other InitialisationSegmentURL will be dropped."  );
     if ( initSeg.size() == 1 )
     {
-        Segment     *seg = parseSegment( initSeg.at(0) );
+        Segment     *seg = parseSegment( initSeg.at(0), true );
         if ( seg != NULL )
             info->setInitialisationSegment( seg );
     }
diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.h b/modules/stream_filter/dash/mpd/BasicCMParser.h
index 91232f0..2c6091d 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.h
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.h
@@ -66,7 +66,7 @@ namespace dash
                 bool    parseCommonAttributesElements( dash::xml::Node *node,
                                                        CommonAttributesElements *common,
                                                        CommonAttributesElements *parent ) const;
-                Segment*    parseSegment( xml::Node* node );
+                Segment*    parseSegment( xml::Node* node, bool init = false );
                 ProgramInformation*     parseProgramInformation();
 
             private:
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index eae8f8d..f303beb 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -137,7 +137,7 @@ void    IsoffMainParser::setInitSegment     (dash::xml::Node *segBaseNode, Segme
 
     if(initSeg.size() > 0)
     {
-        Segment *seg = new Segment( this->currentRepresentation );
+        Segment *seg = new Segment( currentRepresentation, true );
         seg->setSourceUrl(initSeg.at(0)->getAttributeValue("sourceURL"));
 
         if(initSeg.at(0)->hasAttribute("range"))
diff --git a/modules/stream_filter/dash/mpd/Representation.cpp b/modules/stream_filter/dash/mpd/Representation.cpp
index 98fa03d..de3e374 100644
--- a/modules/stream_filter/dash/mpd/Representation.cpp
+++ b/modules/stream_filter/dash/mpd/Representation.cpp
@@ -192,17 +192,16 @@ std::vector<std::string> Representation::toString() const
 {
     std::vector<std::string> ret;
     ret.push_back(std::string("  Representation"));
-    ret.push_back(std::string("    InitSeg url=")
-                  .append(segmentBase->getInitSegment()->getSourceUrl()));
-    if (segmentList)
+    std::vector<Segment *> list = getSegments();
+    std::vector<Segment *>::const_iterator l;
+    for(l = list.begin(); l < list.end(); l++)
     {
-        std::vector<Segment *>::const_iterator l;
-        for(l = segmentList->getSegments().begin();
-            l < segmentList->getSegments().end(); l++)
-        {
+        if ((*l)->isInit())
+            ret.push_back(std::string("    InitSeg url=")
+                          .append((*l)->getUrlSegment()));
+        else
             ret.push_back(std::string("    Segment url=")
-                          .append((*l)->getSourceUrl()));
-        }
+                          .append((*l)->getUrlSegment()));
     }
     return ret;
 }
diff --git a/modules/stream_filter/dash/mpd/Segment.cpp b/modules/stream_filter/dash/mpd/Segment.cpp
index 127849d..7d3dcb1 100644
--- a/modules/stream_filter/dash/mpd/Segment.cpp
+++ b/modules/stream_filter/dash/mpd/Segment.cpp
@@ -33,11 +33,12 @@
 using namespace dash::mpd;
 using namespace dash::http;
 
-Segment::Segment(const Representation *parent) :
+Segment::Segment(const Representation *parent, bool isinit) :
         ICanonicalUrl( parent ),
         startByte  (-1),
         endByte    (-1),
-        parentRepresentation( parent )
+        parentRepresentation( parent ),
+        init( isinit )
 {
     assert( parent != NULL );
     if ( parent->getSegmentInfo() != NULL && parent->getSegmentInfo()->getDuration() >= 0 )
@@ -96,3 +97,8 @@ std::string Segment::getUrlSegment() const
         ret.append(sourceUrl);
     return ret;
 }
+
+bool Segment::isInit() const
+{
+    return init;
+}
diff --git a/modules/stream_filter/dash/mpd/Segment.h b/modules/stream_filter/dash/mpd/Segment.h
index fc231f4..547fb28 100644
--- a/modules/stream_filter/dash/mpd/Segment.h
+++ b/modules/stream_filter/dash/mpd/Segment.h
@@ -40,7 +40,7 @@ namespace dash
         class Segment : public ICanonicalUrl
         {
             public:
-                Segment( const Representation *parent );
+                Segment( const Representation *parent, bool isinit = false );
                 virtual ~Segment(){}
                 virtual void        setSourceUrl( const std::string &url );
                 /**
@@ -49,6 +49,7 @@ namespace dash
                  *          when using an UrlTemplate
                  */
                 virtual bool                            isSingleShot    () const;
+                virtual bool                            isInit          () const;
                 virtual void                            done            ();
                 virtual void                            setByteRange    (int start, int end);
                 virtual dash::http::Chunk*              toChunk         ();
@@ -61,6 +62,7 @@ namespace dash
                 int                     endByte;
                 const Representation*   parentRepresentation;
                 int                     size;
+                bool                    init;
         };
     }
 }



More information about the vlc-commits mailing list