[vlc-commits] [Git][videolan/vlc][master] demux: adaptive: replace mtime() method with type conversion for UTCTime

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jul 18 07:19:00 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
bb9df9f1 by François Cartegnie at 2025-07-18T06:59:53+00:00
demux: adaptive: replace mtime() method with type conversion for UTCTime

- - - - -


6 changed files:

- modules/demux/adaptive/test/tools/Conversions.cpp
- modules/demux/adaptive/tools/Conversions.cpp
- modules/demux/adaptive/tools/Conversions.hpp
- modules/demux/dash/mpd/IsoffMainParser.cpp
- modules/demux/hls/HLSStreams.cpp
- modules/demux/hls/playlist/Parser.cpp


Changes:

=====================================
modules/demux/adaptive/test/tools/Conversions.cpp
=====================================
@@ -30,28 +30,28 @@
 int Conversions_test()
 {
     UTCTime utc("1970-01-01T00:00:00.000+00:00");
-    Expect(utc.mtime() == 0);
+    Expect(utc == 0);
     utc = UTCTime("1970-01-01T10:00:00.000+10:00");
-    Expect(utc.mtime() == 0);
+    Expect(utc == 0);
     utc = UTCTime("1970-01-01T02:00:00.000+01:02");
-    Expect(utc.mtime() == vlc_tick_from_sec(7200 - 3720));
+    Expect(utc == vlc_tick_from_sec(7200 - 3720));
     utc = UTCTime("1970-01-01T02:00:00.000+0102");
-    Expect(utc.mtime() == vlc_tick_from_sec(7200 - 3720));
+    Expect(utc == vlc_tick_from_sec(7200 - 3720));
     utc = UTCTime("1970-01-01T01:10:00.000+1");
-    Expect(utc.mtime() == vlc_tick_from_sec(10*60));
+    Expect(utc == vlc_tick_from_sec(10*60));
     utc = UTCTime("2019-06-11Z");
-    Expect(utc.mtime() == vlc_tick_from_sec(1560211200));
+    Expect(utc == vlc_tick_from_sec(1560211200));
     utc = UTCTime("2019-06-11T16:52:05.100Z");
-    Expect(utc.mtime() == vlc_tick_from_sec(1560271925) + VLC_TICK_FROM_MS(100));
+    Expect(utc == vlc_tick_from_sec(1560271925) + VLC_TICK_FROM_MS(100));
     utc = UTCTime("2019-06-11T16:52:05.012Z");
-    Expect(utc.mtime() == vlc_tick_from_sec(1560271925) + VLC_TICK_FROM_MS(12));
+    Expect(utc == vlc_tick_from_sec(1560271925) + VLC_TICK_FROM_MS(12));
     utc = UTCTime("T16:52:05.012Z");
 
     /* Check non ms fractional */
     utc = UTCTime("2021-05-28T12:51:32+00:00");
-    Expect(utc.mtime() == vlc_tick_from_sec(1622206292));
+    Expect(utc == vlc_tick_from_sec(1622206292));
     utc = UTCTime("2021-05-28T12:51:32.996000+00:00");
-    Expect(utc.mtime() == vlc_tick_from_sec(1622206292)+VLC_TICK_FROM_MS(996));
+    Expect(utc == vlc_tick_from_sec(1622206292)+VLC_TICK_FROM_MS(996));
 
     IsoTime isotime("PT0H9M56.46S");
     Expect(isotime == (vlc_tick_from_sec(9*60+56)+VLC_TICK_FROM_MS(460)));


=====================================
modules/demux/adaptive/tools/Conversions.cpp
=====================================
@@ -194,7 +194,7 @@ UTCTime::UTCTime(const std::string &str)
     }
 }
 
-vlc_tick_t UTCTime::mtime() const
+UTCTime::operator vlc_tick_t () const
 {
     return t;
 }


=====================================
modules/demux/adaptive/tools/Conversions.hpp
=====================================
@@ -39,7 +39,7 @@ class UTCTime
 {
     public:
         UTCTime(const std::string&);
-        vlc_tick_t mtime() const;
+        operator vlc_tick_t() const;
 
     private:
         vlc_tick_t t;


=====================================
modules/demux/dash/mpd/IsoffMainParser.cpp
=====================================
@@ -139,11 +139,11 @@ void    IsoffMainParser::parseMPDAttributes   (MPD *mpd, xml::Node *node)
         }
         else if(attr.name == "availabilityStartTime")
         {
-            mpd->availabilityStartTime = UTCTime(attr.value).mtime();
+            mpd->availabilityStartTime = UTCTime(attr.value);
         }
         else if(attr.name == "availabilityEndTime")
         {
-            mpd->availabilityEndTime = UTCTime(attr.value).mtime();
+            mpd->availabilityEndTime = UTCTime(attr.value);
         }
         else if(attr.name == "timeShiftBufferDepth")
         {


=====================================
modules/demux/hls/HLSStreams.cpp
=====================================
@@ -142,7 +142,7 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
 
                 std::string::size_type pos = str.find("LOCAL:");
                 if(pos != std::string::npos && str.length() - pos >= 12+6)
-                    local = UTCTime("T" + str.substr(pos + 6, 12)).mtime();
+                    local = UTCTime("T" + str.substr(pos + 6, 12));
 
                 pos = str.find("MPEGTS:");
                 if(pos != std::string::npos && str.size() - pos > 7)


=====================================
modules/demux/hls/playlist/Parser.cpp
=====================================
@@ -392,7 +392,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, HLSRepresentation *rep, const std
 
             case SingleValueTag::EXTXPROGRAMDATETIME:
                 absReferenceTime = VLC_TICK_0 +
-                        UTCTime(static_cast<const SingleValueTag *>(tag)->getValue().value).mtime();
+                        UTCTime(static_cast<const SingleValueTag *>(tag)->getValue().value);
                 /* Reverse apply UTC timespec from first discont */
                 if(segmentstoappend.size() && segmentstoappend.back()->getDisplayTime() == VLC_TICK_INVALID)
                 {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bb9df9f18cfdbcc3a1ea4933221d0a3b4c4ed7c8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bb9df9f18cfdbcc3a1ea4933221d0a3b4c4ed7c8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list