[vlc-commits] dash: Don't hardcode the isLive information.

Hugo Beauzée-Luyssen git at videolan.org
Tue Jan 24 23:21:50 CET 2012


vlc/vlc-1.2 | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Nov 28 17:31:37 2011 +0100| [bac93c6f9a06f53260e6e51f7a609d8df3a6bd41] | committer: Jean-Baptiste Kempf

dash: Don't hardcode the isLive information.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 5cc04d06d766a9616f8b9bc8da39ed7c06df225c)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_filter/dash/dash.cpp               |    2 +-
 modules/stream_filter/dash/mpd/BasicCMManager.cpp |    5 +++++
 modules/stream_filter/dash/mpd/BasicCMManager.h   |    1 +
 modules/stream_filter/dash/mpd/IMPDManager.h      |    3 +++
 modules/stream_filter/dash/mpd/MPD.cpp            |   19 +++++++++++--------
 modules/stream_filter/dash/mpd/MPD.h              |    2 +-
 6 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
index 6c33bd8..896550d 100644
--- a/modules/stream_filter/dash/dash.cpp
+++ b/modules/stream_filter/dash/dash.cpp
@@ -106,7 +106,7 @@ static int Open(vlc_object_t *p_obj)
     p_sys->p_node           = p_node;
     p_sys->p_conManager     = p_conManager;
     p_sys->position         = 0;
-    p_sys->isLive           = true;
+    p_sys->isLive           = p_dashManager->getMpdManager()->getMPD()->isLive();
     p_stream->p_sys         = p_sys;
     p_stream->pf_read       = Read;
     p_stream->pf_peek       = Peek;
diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.cpp b/modules/stream_filter/dash/mpd/BasicCMManager.cpp
index 4a488c6..235a0a5 100644
--- a/modules/stream_filter/dash/mpd/BasicCMManager.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMManager.cpp
@@ -158,3 +158,8 @@ Period*                 BasicCMManager::getNextPeriod           (Period *period)
 
     return NULL;
 }
+
+const MPD*      BasicCMManager::getMPD() const
+{
+    return this->mpd;
+}
diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.h b/modules/stream_filter/dash/mpd/BasicCMManager.h
index ee8072a..e27dc10 100644
--- a/modules/stream_filter/dash/mpd/BasicCMManager.h
+++ b/modules/stream_filter/dash/mpd/BasicCMManager.h
@@ -57,6 +57,7 @@ namespace dash
                 Representation*         getBestRepresentation   (Period *period);
                 std::vector<ISegment *> getSegments             (Representation *rep);
                 Representation*         getRepresentation       (Period *period, long bitrate);
+                const MPD*              getMPD                  () const;
 
             private:
                 MPD *mpd;
diff --git a/modules/stream_filter/dash/mpd/IMPDManager.h b/modules/stream_filter/dash/mpd/IMPDManager.h
index c5a3e6e..de264f8 100644
--- a/modules/stream_filter/dash/mpd/IMPDManager.h
+++ b/modules/stream_filter/dash/mpd/IMPDManager.h
@@ -16,6 +16,8 @@ namespace dash
 {
     namespace mpd
     {
+        class MPD;
+
         enum Profile
         {
             NotValid,
@@ -32,6 +34,7 @@ namespace dash
                 virtual Representation*         getBestRepresentation   (Period *period)                = 0;
                 virtual std::vector<ISegment *> getSegments             (Representation *rep)           = 0;
                 virtual Representation*         getRepresentation       (Period *period, long bitrate)  = 0;
+                virtual const MPD*              getMPD                  () const = 0;
                 virtual ~IMPDManager(){}
         };
     }
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index 46addc5..309cbbd 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -65,14 +65,6 @@ const std::string&             MPD::getMinBufferTime       () const throw(Attrib
     return it->second;
 }
 
-const std::string&             MPD::getType                () const throw(AttributeNotPresentException)
-{
-    AttributesMap::const_iterator     it = this->attributes.find( "type" );
-    if( it == this->attributes.end() )
-        throw AttributeNotPresentException();
-
-    return it->second;
-}
 const std::string&             MPD::getDuration            () const throw(AttributeNotPresentException)
 {
     AttributesMap::const_iterator     it = this->attributes.find("mediaPresentationDuration");
@@ -101,3 +93,14 @@ void                    MPD::setProgramInformation  (ProgramInformation *progInf
 {
     this->programInfo = progInfo;
 }
+
+bool                    MPD::isLive() const
+{
+    AttributesMap::const_iterator     it = this->attributes.find("mediaPresentationDuration");
+
+    /*
+        Standard specifies a default of "On-Demand",
+        so anything that is not "Live" is "On-Demand"
+    */
+    return ( it != this->attributes.end() && it->second == "Live" );
+}
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
index 2a69142..80ee6a9 100644
--- a/modules/stream_filter/dash/mpd/MPD.h
+++ b/modules/stream_filter/dash/mpd/MPD.h
@@ -47,7 +47,7 @@ namespace dash
                 MPD         (const AttributesMap& attributes);
                 virtual ~MPD();
 
-                const std::string&             getType                 () const throw(dash::exception::AttributeNotPresentException);
+                bool                           isLive() const;
                 const std::string&             getDuration             () const throw(dash::exception::AttributeNotPresentException);
                 const std::string&             getMinBufferTime        () const throw(dash::exception::AttributeNotPresentException);
                 const std::vector<BaseUrl *>&  getBaseUrls      () const;



More information about the vlc-commits mailing list