summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/rpi/common/rpi_stream.h
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-05-03 13:20:35 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-05-04 20:59:24 +0300
commit0fbf6b57a7bd281c7d187244b7f480c0899cb94a (patch)
treea7ba047bbccecb53b097646a2a34e12248b61e1b /src/libcamera/pipeline/rpi/common/rpi_stream.h
parent6c71ee1f15305120ea0f339eb2ff61a25a518411 (diff)
pipeline: raspberrypi: Add stream flags to RPi::Stream
Add a flags_ field to indicate stream state information in RPi::Stream. This replaces the existing external_ and importOnly_ boolean flags. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/rpi/common/rpi_stream.h')
-rw-r--r--src/libcamera/pipeline/rpi/common/rpi_stream.h42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
index b8c74de3..6edd304b 100644
--- a/src/libcamera/pipeline/rpi/common/rpi_stream.h
+++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h
@@ -12,6 +12,7 @@
#include <unordered_map>
#include <vector>
+#include <libcamera/base/flags.h>
#include <libcamera/stream.h>
#include "libcamera/internal/v4l2_videodevice.h"
@@ -37,25 +38,41 @@ enum BufferMask {
class Stream : public libcamera::Stream
{
public:
+ enum class StreamFlag {
+ None = 0,
+ /*
+ * Indicates that this stream only imports buffers, e.g. the ISP
+ * input stream.
+ */
+ ImportOnly = (1 << 0),
+ /*
+ * Indicates that this stream is active externally, i.e. the
+ * buffers might be provided by (and returned to) the application.
+ */
+ External = (1 << 1),
+ };
+
+ using StreamFlags = Flags<StreamFlag>;
+
Stream()
- : id_(BufferMask::MaskID)
+ : flags_(StreamFlag::None), id_(BufferMask::MaskID)
{
}
- Stream(const char *name, MediaEntity *dev, bool importOnly = false)
- : external_(false), importOnly_(importOnly), name_(name),
+ Stream(const char *name, MediaEntity *dev, StreamFlags flags = StreamFlag::None)
+ : flags_(flags), name_(name),
dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(BufferMask::MaskID)
{
}
+ void setFlags(StreamFlags flags);
+ void clearFlags(StreamFlags flags);
+ StreamFlags getFlags() const;
+
V4L2VideoDevice *dev() const;
const std::string &name() const;
- bool isImporter() const;
void resetBuffers();
- void setExternal(bool external);
- bool isExternal() const;
-
void setExportedBuffers(std::vector<std::unique_ptr<FrameBuffer>> *buffers);
const BufferMap &getBuffers() const;
unsigned int getBufferId(FrameBuffer *buffer) const;
@@ -112,14 +129,7 @@ private:
void clearBuffers();
int queueToDevice(FrameBuffer *buffer);
- /*
- * Indicates that this stream is active externally, i.e. the buffers
- * might be provided by (and returned to) the application.
- */
- bool external_;
-
- /* Indicates that this stream only imports buffers, e.g. ISP input. */
- bool importOnly_;
+ StreamFlags flags_;
/* Stream name identifier. */
std::string name_;
@@ -182,4 +192,6 @@ public:
} /* namespace RPi */
+LIBCAMERA_FLAGS_ENABLE_OPERATORS(RPi::Stream::StreamFlag)
+
} /* namespace libcamera */