[vlc-commits] demux:adaptive: store the IsoTime directly to vlc_tick_t

Steve Lhomme git at videolan.org
Tue Sep 18 14:08:09 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 11 14:36:07 2018 +0200| [f18894b58967ee61b86254bd5acd8f8897b68c67] | committer: Steve Lhomme

demux:adaptive: store the IsoTime directly to vlc_tick_t

They are never used as seconds

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

 modules/demux/adaptive/tools/Conversions.cpp |  4 ++--
 modules/demux/adaptive/tools/Conversions.hpp |  4 ++--
 modules/demux/dash/mpd/IsoffMainParser.cpp   | 16 ++++++++--------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/modules/demux/adaptive/tools/Conversions.cpp b/modules/demux/adaptive/tools/Conversions.cpp
index 346fb97546..213fbb2bcc 100644
--- a/modules/demux/adaptive/tools/Conversions.cpp
+++ b/modules/demux/adaptive/tools/Conversions.cpp
@@ -88,10 +88,10 @@ static time_t str_duration( const char *psz_duration )
 
 IsoTime::IsoTime(const std::string &str)
 {
-    time = str_duration(str.c_str());
+    time = vlc_tick_from_sec(str_duration(str.c_str()));
 }
 
-IsoTime::operator time_t () const
+IsoTime::operator vlc_tick_t () const
 {
     return time;
 }
diff --git a/modules/demux/adaptive/tools/Conversions.hpp b/modules/demux/adaptive/tools/Conversions.hpp
index 8d4341871d..003d838ee5 100644
--- a/modules/demux/adaptive/tools/Conversions.hpp
+++ b/modules/demux/adaptive/tools/Conversions.hpp
@@ -28,10 +28,10 @@ class IsoTime
 {
     public:
         IsoTime(const std::string&);
-        operator time_t() const;
+        operator vlc_tick_t() const;
 
     private:
-        time_t time;
+        vlc_tick_t time;
 };
 
 class UTCTime
diff --git a/modules/demux/dash/mpd/IsoffMainParser.cpp b/modules/demux/dash/mpd/IsoffMainParser.cpp
index b7ae533be4..368a8aa583 100644
--- a/modules/demux/dash/mpd/IsoffMainParser.cpp
+++ b/modules/demux/dash/mpd/IsoffMainParser.cpp
@@ -95,23 +95,23 @@ void    IsoffMainParser::parseMPDAttributes   (MPD *mpd, xml::Node *node)
 
     it = attr.find("mediaPresentationDuration");
     if(it != attr.end())
-        mpd->duration.Set(IsoTime(it->second) * CLOCK_FREQ);
+        mpd->duration.Set(IsoTime(it->second));
 
     it = attr.find("minBufferTime");
     if(it != attr.end())
-        mpd->setMinBuffering(IsoTime(it->second) * CLOCK_FREQ);
+        mpd->setMinBuffering(IsoTime(it->second));
 
     it = attr.find("minimumUpdatePeriod");
     if(it != attr.end())
     {
-        vlc_tick_t minupdate = IsoTime(it->second) * CLOCK_FREQ;
+        vlc_tick_t minupdate = IsoTime(it->second);
         if(minupdate > 0)
             mpd->minUpdatePeriod.Set(minupdate);
     }
 
     it = attr.find("maxSegmentDuration");
     if(it != attr.end())
-        mpd->maxSegmentDuration.Set(IsoTime(it->second) * CLOCK_FREQ);
+        mpd->maxSegmentDuration.Set(IsoTime(it->second));
 
     it = attr.find("type");
     if(it != attr.end())
@@ -123,11 +123,11 @@ void    IsoffMainParser::parseMPDAttributes   (MPD *mpd, xml::Node *node)
 
     it = attr.find("timeShiftBufferDepth");
         if(it != attr.end())
-            mpd->timeShiftBufferDepth.Set(IsoTime(it->second) * CLOCK_FREQ);
+            mpd->timeShiftBufferDepth.Set(IsoTime(it->second));
 
     it = attr.find("suggestedPresentationDelay");
     if(it != attr.end())
-        mpd->suggestedPresentationDelay.Set(IsoTime(it->second) * CLOCK_FREQ);
+        mpd->suggestedPresentationDelay.Set(IsoTime(it->second));
 }
 
 void IsoffMainParser::parsePeriods(MPD *mpd, Node *root)
@@ -143,9 +143,9 @@ void IsoffMainParser::parsePeriods(MPD *mpd, Node *root)
             continue;
         parseSegmentInformation(*it, period, &nextid);
         if((*it)->hasAttribute("start"))
-            period->startTime.Set(IsoTime((*it)->getAttributeValue("start")) * CLOCK_FREQ);
+            period->startTime.Set(IsoTime((*it)->getAttributeValue("start")));
         if((*it)->hasAttribute("duration"))
-            period->duration.Set(IsoTime((*it)->getAttributeValue("duration")) * CLOCK_FREQ);
+            period->duration.Set(IsoTime((*it)->getAttributeValue("duration")));
         std::vector<Node *> baseUrls = DOMHelper::getChildElementByTagName(*it, "BaseURL");
         if(!baseUrls.empty())
             period->baseUrl.Set( new Url( baseUrls.front()->getText() ) );



More information about the vlc-commits mailing list