X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Fdecoder.cc;h=4e136d619e075b3d49f52e147365ded667cd3d15;hb=521c09170d9e62cd72cc2da66c41816761008a4b;hp=61e63460bae8469d4650e6fa65932ef8b4a74fef;hpb=dedac27070ac5ad65265a0db1fa316b3e436cea7;p=dcpomatic.git diff --git a/src/lib/decoder.cc b/src/lib/decoder.cc index 61e63460b..4e136d619 100644 --- a/src/lib/decoder.cc +++ b/src/lib/decoder.cc @@ -21,57 +21,50 @@ * @brief Parent class for decoders of content. */ -#include -#include -#include #include "film.h" -#include "format.h" -#include "job.h" -#include "options.h" -#include "exceptions.h" -#include "image.h" -#include "util.h" -#include "log.h" #include "decoder.h" -#include "delay_line.h" -#include "subtitle.h" -#include "filter_graph.h" +#include "decoded.h" -using std::string; -using std::stringstream; -using std::min; -using std::pair; -using std::list; +#include "i18n.h" + +using std::cout; using boost::shared_ptr; -using boost::optional; /** @param f Film. - * @param o Options. - * @param j Job that we are running within, or 0 + * @param o Decode options. */ -Decoder::Decoder (boost::shared_ptr f, boost::shared_ptr o, Job* j) +Decoder::Decoder (shared_ptr f) : _film (f) - , _opt (o) - , _job (j) + , _done (false) { - _film_connection = f->Changed.connect (bind (&Decoder::film_changed, this, _1)); + } -/** Seek. - * @param p Position as a source timestamp in seconds. - * @return true on error. - */ -bool -Decoder::seek (double p) +shared_ptr +Decoder::peek () { - throw DecodeError ("decoder does not support seek"); + while (!_done && _pending.empty ()) { + _done = pass (); + } + + if (_done) { + return shared_ptr (); + } + + return _pending.front (); } -/** Seek so that the next frame we will produce is the same as the last one. - * @return true on error. - */ -bool -Decoder::seek_to_last () +void +Decoder::consume () +{ + if (!_pending.empty ()) { + _pending.pop_front (); + } +} + +void +Decoder::seek (ContentTime, bool) { - throw DecodeError ("decoder does not support seek"); + _pending.clear (); + _done = false; }