[vlc-commits] demux: adaptive: add demuxer flag for restart on switch

Francois Cartegnie git at videolan.org
Mon Jul 18 16:19:56 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jul 18 16:10:36 2016 +0200| [08c74d0b18d6b33b8e62b050ea7ce88f42026625] | committer: Francois Cartegnie

demux: adaptive: add demuxer flag for restart on switch

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

 modules/demux/adaptive/Streams.cpp          |    6 +++---
 modules/demux/adaptive/plumbing/Demuxer.cpp |   15 +++++++++++++--
 modules/demux/adaptive/plumbing/Demuxer.hpp |    5 ++++-
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index aedf574..74269b5 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -223,7 +223,7 @@ bool AbstractStream::restartDemux()
     {
         return startDemux();
     }
-    else if(demuxer->reinitsOnSeek())
+    else if(demuxer->needsRestartOnSeek())
     {
         /* Push all ES as recycling candidates */
         fakeesout->recycleAll();
@@ -427,10 +427,10 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
     if(!seekAble())
         return false;
 
-    bool ret = segmentTracker->setPositionByTime(time, demuxer->reinitsOnSeek(), tryonly);
+    bool ret = segmentTracker->setPositionByTime(time, demuxer->needsRestartOnSeek(), tryonly);
     if(!tryonly && ret)
     {
-        if(demuxer->reinitsOnSeek())
+        if(demuxer->needsRestartOnSeek())
         {
             if(currentChunk)
                 delete currentChunk;
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index abc25c0..e78e8c2 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -35,7 +35,8 @@ using namespace adaptive;
 AbstractDemuxer::AbstractDemuxer()
 {
     b_startsfromzero = false;
-    b_reinitsonseek =true;
+    b_reinitsonseek = true;
+    b_candetectswitches = true;
 }
 
 AbstractDemuxer::~AbstractDemuxer()
@@ -48,7 +49,17 @@ bool AbstractDemuxer::alwaysStartsFromZero() const
     return b_startsfromzero;
 }
 
-bool AbstractDemuxer::reinitsOnSeek() const
+bool AbstractDemuxer::needsRestartOnSwitch() const
+{
+    return !b_candetectswitches;
+}
+
+void AbstractDemuxer::setCanDetectSwitches( bool b )
+{
+    b_candetectswitches = b;
+}
+
+bool AbstractDemuxer::needsRestartOnSeek() const
 {
     return b_reinitsonseek;
 }
diff --git a/modules/demux/adaptive/plumbing/Demuxer.hpp b/modules/demux/adaptive/plumbing/Demuxer.hpp
index 54820f1..a239a35 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.hpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.hpp
@@ -38,11 +38,14 @@ namespace adaptive
             virtual bool create() = 0;
             virtual bool restart(CommandsQueue *) = 0;
             bool alwaysStartsFromZero() const;
-            bool reinitsOnSeek() const;
+            bool needsRestartOnSeek() const;
+            bool needsRestartOnSwitch() const;
+            void setCanDetectSwitches(bool);
 
         protected:
             bool b_startsfromzero;
             bool b_reinitsonseek;
+            bool b_candetectswitches;
     };
 
     class Demuxer : public AbstractDemuxer



More information about the vlc-commits mailing list