* @brief Parent class for decoders of content.
*/
-#include <iostream>
#include "film.h"
-#include "exceptions.h"
-#include "util.h"
#include "decoder.h"
#include "i18n.h"
-using std::string;
using boost::shared_ptr;
/** @param f Film.
Decoder::Decoder (shared_ptr<const Film> f)
: _film (f)
{
- _film_connection = f->Changed.connect (bind (&Decoder::film_changed, this, _1));
+
}
-/** Seek to a position as a content timestamp in seconds.
- * @return true on error.
- */
-bool
-Decoder::seek (double)
+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)
{
- throw DecodeError (N_("decoder does not support seek"));
+ _pending.clear ();
}