demux: adaptive: add eof flag to commands queue
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 30 Jun 2016 15:35:45 +0000 (17:35 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 9 Jul 2016 11:10:55 +0000 (13:10 +0200)
modules/demux/adaptive/plumbing/CommandsQueue.cpp
modules/demux/adaptive/plumbing/CommandsQueue.hpp

index 79cf540..8b74e6c 100644 (file)
@@ -199,6 +199,7 @@ CommandsQueue::CommandsQueue( CommandsFactory *f )
     pcr = VLC_TS_INVALID;
     b_drop = false;
     b_flushing = false;
+    b_eof = false;
     commandsFactory = f;
     vlc_mutex_init(&lock);
 }
@@ -306,6 +307,7 @@ void CommandsQueue::Abort( bool b_reset )
         bufferinglevel = VLC_TS_INVALID;
         pcr = VLC_TS_INVALID;
         b_flushing = false;
+        b_eof = false;
     }
     vlc_mutex_unlock(&lock);
 }
@@ -341,6 +343,23 @@ bool CommandsQueue::isFlushing() const
     return b;
 }
 
+void CommandsQueue::setEOF()
+{
+    vlc_mutex_lock(&lock);
+    b_eof = true;
+    LockedCommit();
+    b_flushing = !commands.empty();
+    vlc_mutex_unlock(&lock);
+}
+
+bool CommandsQueue::isEOF() const
+{
+    vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
+    bool b = b_eof;
+    vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
+    return b;
+}
+
 mtime_t CommandsQueue::getDemuxedAmount() const
 {
     return bufferinglevel - getFirstDTS();
index 42d55ef..d459978 100644 (file)
@@ -146,7 +146,9 @@ namespace adaptive
             bool isEmpty() const;
             void setDrop( bool );
             void setFlush();
+            void setEOF();
             bool isFlushing() const;
+            bool isEOF() const;
             mtime_t getDemuxedAmount() const;
             mtime_t getBufferingLevel() const;
             mtime_t getFirstDTS() const;
@@ -162,6 +164,7 @@ namespace adaptive
             mtime_t pcr;
             bool b_flushing;
             bool b_drop;
+            bool b_eof;
     };
 }