From 0053962182e9ea906f15cb1e702b6f0b4a9923a6 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Wed, 26 Oct 2016 23:30:13 -0700 Subject: [PATCH] SourceImpl: add PutError(). The error message is stored as a normal frame with unknown pixel format. --- src/Frame.h | 4 +++- src/SourceImpl.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Frame.h b/src/Frame.h index 721c7b3f96..19a86590bf 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -62,7 +62,9 @@ class Frame { return *this; } - explicit operator bool() const { return m_data; } + explicit operator bool() const { + return m_data && m_data->pixelFormat != VideoMode::kUnknown; + } operator llvm::StringRef() const { if (!m_data) return llvm::StringRef{}; diff --git a/src/SourceImpl.h b/src/SourceImpl.h index 166f5beb66..5fff01d434 100644 --- a/src/SourceImpl.h +++ b/src/SourceImpl.h @@ -118,6 +118,9 @@ class SourceImpl { protected: void PutFrame(VideoMode::PixelFormat pixelFormat, llvm::StringRef data, Frame::Time time); + void PutError(llvm::StringRef msg, Frame::Time time) { + PutFrame(VideoMode::kUnknown, msg, time); + } // Notification functions for corresponding atomics virtual void NumSinksChanged() = 0;