From fb8c63d69cbb7a4a32b6b9c81a92af1baf6c78fa Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Dec 2020 23:45:04 +0200 Subject: 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 Tested-by: Phi-Bang Nguyen Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/pipeline/simple/converter.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/libcamera/pipeline/simple/converter.cpp') 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((*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 SimpleConverter::formats(PixelFormat input) { if (!m2m_) -- cgit v1.2.1