[vlc-commits] demux: adaptative: use property template for seglist duration

Francois Cartegnie git at videolan.org
Fri May 15 21:29:30 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 15 15:51:28 2015 +0200| [295d44df4174a6c584703d4e078508c7bb56dd44] | committer: Francois Cartegnie

demux: adaptative: use property template for seglist duration

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

 modules/demux/adaptative/playlist/SegmentInfoCommon.cpp  |   13 +------------
 modules/demux/adaptative/playlist/SegmentInfoCommon.h    |    4 +---
 modules/demux/adaptative/playlist/SegmentInformation.cpp |    4 ++--
 modules/demux/dash/mpd/IsoffMainParser.cpp               |    6 +++---
 4 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/modules/demux/adaptative/playlist/SegmentInfoCommon.cpp b/modules/demux/adaptative/playlist/SegmentInfoCommon.cpp
index 7f00fab..e0b3a18 100644
--- a/modules/demux/adaptative/playlist/SegmentInfoCommon.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInfoCommon.cpp
@@ -32,26 +32,15 @@ using namespace adaptative::playlist;
 
 SegmentInfoCommon::SegmentInfoCommon( ICanonicalUrl *parent ) :
     ICanonicalUrl( parent ), Initializable(), Indexable(),
-    duration( 0 ),
     startIndex( 0 )
 {
+    duration.Set(0);
 }
 
 SegmentInfoCommon::~SegmentInfoCommon()
 {
 }
 
-time_t      SegmentInfoCommon::getDuration() const
-{
-    return this->duration;
-}
-
-void        SegmentInfoCommon::setDuration( time_t duration )
-{
-    if ( duration >= 0 )
-        this->duration = duration;
-}
-
 int         SegmentInfoCommon::getStartIndex() const
 {
     return this->startIndex;
diff --git a/modules/demux/adaptative/playlist/SegmentInfoCommon.h b/modules/demux/adaptative/playlist/SegmentInfoCommon.h
index e6d92b8..c312fa4 100644
--- a/modules/demux/adaptative/playlist/SegmentInfoCommon.h
+++ b/modules/demux/adaptative/playlist/SegmentInfoCommon.h
@@ -46,15 +46,13 @@ namespace adaptative
             public:
                 SegmentInfoCommon( ICanonicalUrl *parent = NULL );
                 virtual ~SegmentInfoCommon();
-                time_t                  getDuration() const;
-                void                    setDuration( time_t duration );
                 int                     getStartIndex() const;
                 void                    setStartIndex( int startIndex );
                 void                    appendBaseURL( const std::string& url );
                 virtual Url             getUrlSegment() const; /* impl */
+                Property<uint64_t>      duration;
 
             private:
-                time_t                  duration;
                 int                     startIndex;
                 std::list<std::string>  baseURLs;
         };
diff --git a/modules/demux/adaptative/playlist/SegmentInformation.cpp b/modules/demux/adaptative/playlist/SegmentInformation.cpp
index dbb67ce..93f1d27 100644
--- a/modules/demux/adaptative/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptative/playlist/SegmentInformation.cpp
@@ -183,7 +183,7 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
     else if ( (segList = inheritSegmentList()) )
     {
         timescale = segList->inheritTimescale();
-        duration = segList->getDuration();
+        duration = segList->duration.Get();
     }
 
     if(duration)
@@ -217,7 +217,7 @@ mtime_t SegmentInformation::getPlaybackTimeBySegmentNumber(uint64_t number) cons
     else if ( (segList = inheritSegmentList()) )
     {
         timescale = segList->inheritTimescale();
-        time = number * segList->getDuration();
+        time = number * segList->duration.Get();
     }
 
     if(time)
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index fa37eee..df27879 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -298,7 +298,7 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
             parseInitSegment(DOMHelper::getFirstChildElementByName(segListNode, "Initialization"), list, info);
 
             if(segListNode->hasAttribute("duration"))
-                list->setDuration(Integer<mtime_t>(segListNode->getAttributeValue("duration")));
+                list->duration.Set(Integer<uint64_t>(segListNode->getAttributeValue("duration")));
 
             if(segListNode->hasAttribute("timescale"))
                 list->timescale.Set(Integer<uint64_t>(segListNode->getAttributeValue("timescale")));
@@ -323,10 +323,10 @@ size_t IsoffMainParser::parseSegmentList(Node * segListNode, SegmentInformation
                     seg->setByteRange(atoi(range.substr(0, pos).c_str()), atoi(range.substr(pos + 1, range.size()).c_str()));
                 }
 
-                if(totaltime || list->getDuration())
+                if(totaltime || list->duration.Get())
                 {
                     seg->startTime.Set(totaltime);
-                    totaltime += list->getDuration();
+                    totaltime += list->duration.Get();
                 }
 
                 list->addSegment(seg);



More information about the vlc-commits mailing list