Fix termination of decodes.
authorCarl Hetherington <cth@carlh.net>
Sat, 28 Dec 2013 00:12:32 +0000 (00:12 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Dec 2013 00:12:32 +0000 (00:12 +0000)
src/lib/decoder.cc
src/lib/decoder.h

index 7102f2aa4cdad341e69c5db352a52d4b9b587d54..4e136d619e075b3d49f52e147365ded667cd3d15 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "i18n.h"
 
+using std::cout;
 using boost::shared_ptr;
 
 /** @param f Film.
@@ -34,6 +35,7 @@ using boost::shared_ptr;
  */
 Decoder::Decoder (shared_ptr<const Film> f)
        : _film (f)
+       , _done (false)
 {
 
 }
@@ -41,9 +43,11 @@ Decoder::Decoder (shared_ptr<const Film> f)
 shared_ptr<Decoded>
 Decoder::peek ()
 {
-       while (_pending.empty() && !pass ()) {}
+       while (!_done && _pending.empty ()) {
+               _done = pass ();
+       }
 
-       if (_pending.empty ()) {
+       if (_done) {
                return shared_ptr<Decoded> ();
        }
 
@@ -62,4 +66,5 @@ void
 Decoder::seek (ContentTime, bool)
 {
        _pending.clear ();
+       _done = false;
 }
index 1c6aff3596c24d157c1d48d60249040a6fc45753..6646b0e76acc66b14edb78d698bd9c48412e07c4 100644 (file)
@@ -66,6 +66,7 @@ protected:
        boost::weak_ptr<const Film> _film;
 
        std::list<boost::shared_ptr<Decoded> > _pending;
+       bool _done;
 };
 
 #endif