[vlc-commits] stream_filter: dash: evaluate correctly live stream

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:53 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 10 14:47:02 2014 +0100| [09df186b596d2ffa1b01d6cad50b4636ab85eb53] | committer: Francois Cartegnie

stream_filter: dash: evaluate correctly live stream

Live profile can be replayed as static after broadcast.

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

 modules/stream_filter/dash/mpd/BasicCMParser.cpp   |    2 +-
 modules/stream_filter/dash/mpd/IsoffMainParser.cpp |    3 +++
 modules/stream_filter/dash/mpd/MPD.cpp             |   13 +++++++++----
 modules/stream_filter/dash/mpd/MPD.h               |    4 ++--
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/BasicCMParser.cpp b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
index f180585..1828412 100644
--- a/modules/stream_filter/dash/mpd/BasicCMParser.cpp
+++ b/modules/stream_filter/dash/mpd/BasicCMParser.cpp
@@ -71,7 +71,7 @@ bool    BasicCMParser::parse                (Profile profile)
         Standard specifies a default of "On-Demand",
         so anything that is not "Live" is "On-Demand"
     */
-    this->mpd->setLive( it != attr.end() && it->second == "Live" );
+
     it = attr.find( "availabilityStartTime" );
     if ( it == attr.end() && this->mpd->isLive() == true )
     {
diff --git a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
index 4f751a2..fe8f98a 100644
--- a/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
+++ b/modules/stream_filter/dash/mpd/IsoffMainParser.cpp
@@ -67,6 +67,9 @@ void    IsoffMainParser::setMPDAttributes   ()
     if(it != attr.end())
         this->mpd->setMinBufferTime(str_duration( it->second.c_str()));
 
+    it = attr.find("type");
+    if(it != attr.end())
+        mpd->setType(it->second);
 }
 
 void    IsoffMainParser::setAdaptationSets  (Node *periodNode, Period *period)
diff --git a/modules/stream_filter/dash/mpd/MPD.cpp b/modules/stream_filter/dash/mpd/MPD.cpp
index 80d7f29..12befa3 100644
--- a/modules/stream_filter/dash/mpd/MPD.cpp
+++ b/modules/stream_filter/dash/mpd/MPD.cpp
@@ -35,7 +35,6 @@ MPD::MPD (stream_t *stream_, Profile profile_) :
     ICanonicalUrl(),
     stream(stream_),
     profile( profile_ ),
-    live( false ),
     availabilityStartTime( -1 ),
     availabilityEndTime( -1 ),
     duration( -1 ),
@@ -126,12 +125,18 @@ void                    MPD::setProgramInformation  (ProgramInformation *progInf
 
 bool                    MPD::isLive() const
 {
-    return this->live;
+    if(type.empty())
+    {
+        Profile live(Profile::ISOLive);
+        return profile == live;
+    }
+    else
+        return (type != "static");
 }
 
-void                    MPD::setLive( bool live )
+void MPD::setType(const std::string &type_)
 {
-    this->live = live;
+    type = type_;
 }
 
 time_t MPD::getAvailabilityStartTime() const
diff --git a/modules/stream_filter/dash/mpd/MPD.h b/modules/stream_filter/dash/mpd/MPD.h
index e3e04dc..b9f961b 100644
--- a/modules/stream_filter/dash/mpd/MPD.h
+++ b/modules/stream_filter/dash/mpd/MPD.h
@@ -47,11 +47,11 @@ namespace dash
 
                 Profile                         getProfile() const;
                 bool                            isLive() const;
-                void                            setLive( bool live );
                 time_t                          getAvailabilityStartTime() const;
                 void                            setAvailabilityStartTime( time_t time );
                 time_t                          getAvailabilityEndTime() const;
                 void                            setAvailabilityEndTime( time_t time );
+                void                            setType(const std::string &);
                 time_t                          getDuration() const;
                 void                            setDuration( time_t duration );
                 time_t                          getMinUpdatePeriod() const;
@@ -76,7 +76,6 @@ namespace dash
             private:
                 stream_t                           *stream;
                 Profile                             profile;
-                bool                                live;
                 time_t                              availabilityStartTime;
                 time_t                              availabilityEndTime;
                 time_t                              duration;
@@ -86,6 +85,7 @@ namespace dash
                 std::vector<Period *>               periods;
                 std::vector<BaseUrl *>              baseUrls;
                 ProgramInformation                  *programInfo;
+                std::string                         type;
         };
     }
 }



More information about the vlc-commits mailing list