summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/simple/converter.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-26 23:45:04 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-03 00:59:04 +0200
commitfb8c63d69cbb7a4a32b6b9c81a92af1baf6c78fa (patch)
treed81132d1da5fca3410394b616c756bd5eed9380f /src/libcamera/pipeline/simple/converter.cpp
parent4502635b721ae5d8c36ab98a04879ae73da51ca3 (diff)
libcamera: pipeline: simple: converter: Replace open() with isValid()
Simplify the SimpleConverter interface by opening the M2M device in the constructor. The explicit call to open() is replaced by a check through a new isValid() function, and the unused close() function is removed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/simple/converter.cpp')
-rw-r--r--src/libcamera/pipeline/simple/converter.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
index 6b3249ea..f782fbc6 100644
--- a/src/libcamera/pipeline/simple/converter.cpp
+++ b/src/libcamera/pipeline/simple/converter.cpp
@@ -39,24 +39,16 @@ SimpleConverter::SimpleConverter(MediaDevice *media)
m2m_ = std::make_unique<V4L2M2MDevice>((*it)->deviceNode());
+ int ret = m2m_->open();
+ if (ret < 0) {
+ m2m_.reset();
+ return;
+ }
+
m2m_->output()->bufferReady.connect(this, &SimpleConverter::outputBufferReady);
m2m_->capture()->bufferReady.connect(this, &SimpleConverter::captureBufferReady);
}
-int SimpleConverter::open()
-{
- if (!m2m_)
- return -ENODEV;
-
- return m2m_->open();
-}
-
-void SimpleConverter::close()
-{
- if (m2m_)
- m2m_->close();
-}
-
std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input)
{
if (!m2m_)