Remove uses of boost::system::error_code::message(), which seem to cause the pure...
[dcpomatic.git] / src / lib / decoder.cc
index 2308bbd98fe5d3a3a7dedba52bd9a32b90c42e96..30244b40b5eae2591bbde3301e4ddb5e3f033f20 100644 (file)
  *  @brief Parent class for decoders of content.
  */
 
-#include <iostream>
 #include "film.h"
-#include "exceptions.h"
-#include "util.h"
 #include "decoder.h"
+#include "decoded.h"
 
 #include "i18n.h"
 
-using std::string;
+using std::cout;
 using boost::shared_ptr;
 
 /** @param f Film.
@@ -37,13 +35,36 @@ using boost::shared_ptr;
  */
 Decoder::Decoder (shared_ptr<const Film> f)
        : _film (f)
+       , _done (false)
 {
-       _film_connection = f->Changed.connect (bind (&Decoder::film_changed, this, _1));
+
+}
+
+shared_ptr<Decoded>
+Decoder::peek ()
+{
+       while (!_done && _pending.empty ()) {
+               _done = pass ();
+       }
+
+       if (_done && _pending.empty ()) {
+               return shared_ptr<Decoded> ();
+       }
+
+       return _pending.front ();
+}
+
+void
+Decoder::consume ()
+{
+       if (!_pending.empty ()) {
+               _pending.pop_front ();
+       }
 }
 
-/** @return true on error */
-bool
-Decoder::seek (Time)
+void
+Decoder::seek (ContentTime, bool)
 {
-       throw DecodeError (N_("decoder does not support seek"));
+       _pending.clear ();
+       _done = false;
 }