[vlc-commits] demux: dash: add IsoTime helper

Francois Cartegnie git at videolan.org
Mon Dec 22 19:04:01 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Dec 19 18:18:54 2014 +0100| [e78f71391d5152f80c4eed2a81695dfe37011915] | committer: Francois Cartegnie

demux: dash: add IsoTime helper

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

 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |   14 ++++++++++++--
 modules/stream_filter/dash/mpd/IsoffMainParser.h   |   10 ++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index 07c94cc..fdaff37 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -65,11 +65,11 @@ void    IsoffMainParser::setMPDAttributes   ()
 
     it = attr.find("mediaPresentationDuration");
     if(it != attr.end())
-        this->mpd->setDuration(str_duration(it->second.c_str()));
+        this->mpd->setDuration(IsoTime(it->second));
 
     it = attr.find("minBufferTime");
     if(it != attr.end())
-        this->mpd->setMinBufferTime(str_duration( it->second.c_str()));
+        this->mpd->setMinBufferTime(IsoTime(it->second));
 
     it = attr.find("type");
     if(it != attr.end())
@@ -344,3 +344,13 @@ void    IsoffMainParser::print              ()
         }
     }
 }
+
+IsoTime::IsoTime(const std::string &str)
+{
+    time = str_duration(str.c_str());
+}
+
+IsoTime::operator mtime_t () const
+{
+    return time;
+}
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.h b/modules/stream_filter/dash/mpd/IsoffMainParser.h
index e7eafd3..15a079f 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.h
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.h
@@ -60,6 +60,16 @@ namespace dash
                 size_t  parseSegmentList    (dash::xml::Node *, SegmentInformation *);
                 size_t  parseSegmentTemplate(dash::xml::Node *, SegmentInformation *);
         };
+
+        class IsoTime
+        {
+            public:
+                IsoTime(const std::string&);
+                operator mtime_t() const;
+
+            private:
+                mtime_t time;
+        };
     }
 }
 



More information about the vlc-commits mailing list