@@ -73,7 +73,12 @@ public:
std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; }
std::pair<Rectangle, Rectangle> inputCropBounds(const Stream *stream) override;
-private:
+ int allocateRequests(unsigned int count,
+ std::vector<std::unique_ptr<V4L2Request>> *requests);
+
+ bool supportsRequests();
+
+protected:
class V4L2M2MStream : protected Loggable
{
public:
@@ -122,6 +127,8 @@ private:
std::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_;
std::map<FrameBuffer *, unsigned int> queue_;
std::pair<Rectangle, Rectangle> inputCropBounds_;
+
+ std::shared_ptr<MediaDevice> media_;
};
} /* namespace libcamera */
@@ -9,6 +9,7 @@
#include "libcamera/internal/converter/converter_v4l2_m2m.h"
#include <algorithm>
+#include <errno.h>
#include <limits.h>
#include <memory>
#include <set>
@@ -266,7 +267,7 @@ void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer)
* \param[in] media The media device implementing the converter
*/
V4L2M2MConverter::V4L2M2MConverter(std::shared_ptr<MediaDevice> media)
- : Converter(media)
+ : Converter(media), media_(media)
{
if (deviceNode().empty())
return;
@@ -742,6 +743,37 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
return 0;
}
+/**
+ * \copydoc libcamera::MediaDevice::allocateRequests
+ */
+int V4L2M2MConverter::allocateRequests(unsigned int count,
+ std::vector<std::unique_ptr<V4L2Request>> *requests)
+{
+ /* \todo The acquire() must be moved to the right place. */
+ media_->acquire();
+ if (!media_->busy())
+ LOG(Converter, Error)
+ << "MediaDevice must be valid.";
+ int ret = media_->allocateRequests(count, requests);
+ media_->release();
+ return ret;
+}
+
+/**
+ * \copydoc libcamera::MediaDevice::supportsRequests
+ */
+bool V4L2M2MConverter::supportsRequests()
+{
+ /* \todo The acquire() must be moved to the right place. */
+ media_->acquire();
+ if (!media_->busy())
+ LOG(Converter, Error)
+ << "MediaDevice must be valid.";
+ bool ret = media_->supportsRequests();
+ media_->release();
+ return ret;
+}
+
/*
* \todo This should be extended to include Feature::Flag to denote
* what each converter supports feature-wise.
Add support for V4L2 reuests. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- ToDo: - Fix the place where the MediaObject is acquired/released --- .../internal/converter/converter_v4l2_m2m.h | 9 ++++- .../converter/converter_v4l2_m2m.cpp | 34 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-)