diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-02-13 23:13:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-02-13 23:13:54 +0100 |
| commit | de5ad19f419a4443789236cc085a9a6b7df3ed1b (patch) | |
| tree | ac66bae40b70b2797f39aa423a33c1af04728372 /src/lib/decoder.h | |
| parent | a488be44fa7559553036d4b081ad8e115311500b (diff) | |
Cleanup: use a class for the Decoder::pass() return value.
Diffstat (limited to 'src/lib/decoder.h')
| -rw-r--r-- | src/lib/decoder.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 34153eafc..327fdc5af 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -61,10 +61,41 @@ public: std::shared_ptr<TextDecoder> only_text () const; - /** Do some decoding and perhaps emit video, audio or subtitle data. - * @return true if this decoder will emit no more data unless a seek() happens. - */ - virtual bool pass () = 0; + class PassResult + { + public: + enum class Type + { + OK, ///< there was no error and more data may be emitted on the next pass() + FINISHED, ///< this decoder will emit no more data unless a seek() happens + }; + + static PassResult ok() { + return { Type::OK }; + } + + static PassResult finished() { + return { Type::FINISHED }; + } + + bool is_ok() const { + return _type == Type::OK; + } + + bool is_finished() const { + return _type == Type::FINISHED; + } + + private: + PassResult(Type type) + : _type(type) + {} + + Type _type; + }; + + /** Do some decoding and perhaps emit video, audio or subtitle data */ + virtual PassResult pass() = 0; virtual void seek (dcpomatic::ContentTime time, bool accurate); virtual dcpomatic::ContentTime position () const; |
