32 struct StreamConfiguration;
42 bool isValid()
const override {
return m2m_ !=
nullptr; }
47 std::tuple<unsigned int, unsigned int>
51 const Size &size,
Alignment align = Alignment::Down)
override;
53 const Size &size,
Alignment align = Alignment::Down)
override;
56 const std::vector<std::reference_wrapper<StreamConfiguration>>
60 std::vector<std::unique_ptr<FrameBuffer>> *buffers)
override;
66 Alignment align = Alignment::Down)
override;
69 const std::map<const Stream *, FrameBuffer *> &outputs)
override;
72 std::pair<Rectangle, Rectangle>
inputCropBounds()
override {
return inputCropBounds_; }
76 class V4L2M2MStream :
protected Loggable 81 bool isValid()
const {
return m2m_ !=
nullptr; }
86 std::vector<std::unique_ptr<FrameBuffer>> *buffers);
93 int setInputSelection(
unsigned int target,
Rectangle *rect);
94 int getInputSelection(
unsigned int target,
Rectangle *rect);
99 std::string logPrefix()
const override;
107 std::unique_ptr<V4L2M2MDevice> m2m_;
109 unsigned int inputBufferCount_;
110 unsigned int outputBufferCount_;
112 std::pair<Rectangle, Rectangle> inputCropBounds_;
115 Size adjustSizes(
const Size &size,
const std::vector<SizeRange> &ranges,
118 std::unique_ptr<V4L2M2MDevice> m2m_;
120 std::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_;
121 std::map<FrameBuffer *, unsigned int> queue_;
122 std::pair<Rectangle, Rectangle> inputCropBounds_;
int setInputCrop(const Stream *stream, Rectangle *rect) override
Set the crop rectangle rect for stream.
Definition: converter_v4l2_m2m.cpp:586
bool isConfigured(const Stream *stream) const override
Check if a given stream is configured.
Definition: converter_v4l2_m2m.cpp:565
Video stream for a camera.
Definition: stream.h:75
Base class to support log message extensions.
Definition: log.h:91
Top-level libcamera namespace.
Definition: backtrace.h:17
SizeRange sizes(const Size &input) override
Retrieve the range of minimum and maximum output sizes for an input size.
Definition: converter_v4l2_m2m.cpp:341
int loadConfiguration([[maybe_unused]] const std::string &filename) override
Definition: converter_v4l2_m2m.h:41
Size adjustInputSize(const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down) override
Adjust the converter input size to a valid value.
Definition: converter_v4l2_m2m.cpp:407
Frame buffer data and its associated dynamic metadata.
Definition: framebuffer.h:48
Describe a two-dimensional size.
Definition: geometry.h:50
The V4L2 M2M converter implements the converter interface based on V4L2 M2M device.
Definition: converter_v4l2_m2m.h:36
Signal & slot implementation.
Describe a rectangle's position and dimensions.
Definition: geometry.h:240
int start() override
Start the converter streaming operation.
Definition: converter_v4l2_m2m.cpp:623
Signal< FrameBuffer * > outputBufferReady
A signal emitted on each frame buffer completion of the output queue.
Definition: converter.h:89
void stop() override
Stop the converter streaming operation.
Definition: converter_v4l2_m2m.cpp:641
std::vector< PixelFormat > formats(PixelFormat input) override
Definition: converter_v4l2_m2m.cpp:301
bool isValid() const override
Definition: converter_v4l2_m2m.h:42
int configure(const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration >> &outputCfg) override
Configure a set of output stream conversion from an input stream.
Definition: converter_v4l2_m2m.cpp:528
std::tuple< unsigned int, unsigned int > strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size) override
Retrieve the output stride and frame size for an input configutation.
Definition: converter_v4l2_m2m.cpp:390
int exportBuffers(const Stream *stream, unsigned int count, std::vector< std::unique_ptr< FrameBuffer >> *buffers) override
Export buffers from the converter device.
Definition: converter_v4l2_m2m.cpp:573
Describe a range of sizes.
Definition: geometry.h:198
Alignment
The alignment mode specified when adjusting the converter input or output sizes.
Definition: converter.h:44
int queueBuffers(FrameBuffer *input, const std::map< const Stream *, FrameBuffer *> &outputs) override
Queue buffers to converter device.
Definition: converter_v4l2_m2m.cpp:697
Size adjustOutputSize(const PixelFormat &pixFmt, const Size &size, Alignment align=Alignment::Down) override
Adjust the converter output size to a valid value.
Definition: converter_v4l2_m2m.cpp:426
Configuration parameters for a stream.
Definition: stream.h:40
V4L2M2MConverter(MediaDevice *media)
Construct a V4L2M2MConverter instance.
Definition: converter_v4l2_m2m.cpp:264
int validateOutput(StreamConfiguration *cfg, bool *adjusted, Alignment align=Alignment::Down) override
Validate and possibily adjust cfg to a valid converter output.
Definition: converter_v4l2_m2m.cpp:650
std::pair< Rectangle, Rectangle > inputCropBounds() override
Retrieve the crop bounds of the converter.
Definition: converter_v4l2_m2m.h:72
Abstract Base Class for converter.
Definition: converter.h:34