@@ -37,6 +37,11 @@ private:
std::map<PixelFormat, std::vector<SizeRange>> formats_;
};
+enum class StreamDirection {
+ Input,
+ Output
+};
+
struct StreamConfiguration {
StreamConfiguration();
StreamConfiguration(const StreamFormats &formats);
@@ -46,6 +51,8 @@ struct StreamConfiguration {
unsigned int stride;
unsigned int frameSize;
+ StreamDirection direction;
+
unsigned int bufferCount;
std::optional<ColorSpace> colorSpace;
@@ -53,6 +60,8 @@ struct StreamConfiguration {
Stream *stream() const { return stream_; }
void setStream(Stream *stream) { stream_ = stream; }
const StreamFormats &formats() const { return formats_; }
+ bool isOutput() const { return direction == StreamDirection::Output; }
+ bool isInput() const { return direction == StreamDirection::Input; }
std::string toString() const;
@@ -68,6 +77,7 @@ enum class StreamRole {
StillCapture,
VideoRecording,
Viewfinder,
+ RawInput
};
std::ostream &operator<<(std::ostream &out, StreamRole role);
@@ -280,8 +280,8 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const
* handlers provide StreamFormats.
*/
StreamConfiguration::StreamConfiguration()
- : pixelFormat(0), stride(0), frameSize(0), bufferCount(0),
- stream_(nullptr)
+ : pixelFormat(0), stride(0), frameSize(0),
+ direction(StreamDirection::Output), bufferCount(0), stream_(nullptr)
{
}
@@ -409,6 +409,9 @@ std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg)
{
out << cfg.size << "-" << cfg.pixelFormat << "/"
<< ColorSpace::toString(cfg.colorSpace);
+ if (cfg.direction == StreamDirection::Input)
+ out << "/"
+ << "in";
return out;
}
We are now going to support input streams as well as output streams, for example for passing in the Bayer image for raw re-processing. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> --- include/libcamera/stream.h | 10 ++++++++++ src/libcamera/stream.cpp | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-)