From 7b9c6d3afa80e3c299e30aa11d47253bbc5a8fa8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 14 Feb 2023 01:05:18 +0100 Subject: wip: Error when failing to read MXF frame. --- src/lib/decoder.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/lib/decoder.h') diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 327fdc5af..ae0c97ea6 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -68,6 +68,7 @@ public: { 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 + ERROR, ///< some survivable error occurred; output may not be correct }; static PassResult ok() { @@ -78,6 +79,10 @@ public: return { Type::FINISHED }; } + static PassResult error(std::string message) { + return { Type::ERROR, message }; + }; + bool is_ok() const { return _type == Type::OK; } @@ -86,12 +91,27 @@ public: return _type == Type::FINISHED; } + bool is_error() const { + return _type == Type::ERROR; + } + + std::string error_message() const { + DCPOMATIC_ASSERT(is_error()); + return _error_message; + } + private: PassResult(Type type) : _type(type) {} + PassResult(Type type, std::string error_message) + : _type(type) + , _error_message(error_message) + {} + Type _type; + std::string _error_message; }; /** Do some decoding and perhaps emit video, audio or subtitle data */ -- cgit v1.2.3