Merge branch '1.0' into 1.0-seek
[dcpomatic.git] / src / lib / decoder.cc
index 637e0ddb291101af81f28115327f195a3e128116..18c5acd3551b3442eea6e8882d16f08f658f48b2 100644 (file)
@@ -34,5 +34,34 @@ using boost::shared_ptr;
 Decoder::Decoder (shared_ptr<const Film> f)
        : _film (f)
 {
-       _film_connection = f->Changed.connect (bind (&Decoder::film_changed, this, _1));
+
+}
+
+shared_ptr<Decoded>
+Decoder::peek ()
+{
+       while (_pending.empty () && !pass ()) {}
+
+       if (_pending.empty ()) {
+               return shared_ptr<Decoded> ();
+       }
+
+       return _pending.front ();
+}
+
+shared_ptr<Decoded>
+Decoder::get ()
+{
+       shared_ptr<Decoded> d = peek ();
+       if (d) {
+               _pending.pop_front ();
+       }
+
+       return d;
+}
+
+void
+Decoder::seek (ContentTime, bool)
+{
+       _pending.clear ();
 }