summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/converter.cpp20
-rw-r--r--src/libcamera/pipeline/simple/converter.h3
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp4
3 files changed, 9 insertions, 18 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_)
diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h
index d9ace52d..6e3df553 100644
--- a/src/libcamera/pipeline/simple/converter.h
+++ b/src/libcamera/pipeline/simple/converter.h
@@ -30,8 +30,7 @@ class SimpleConverter
public:
SimpleConverter(MediaDevice *media);
- int open();
- void close();
+ bool isValid() const { return m2m_ != nullptr; }
std::vector<PixelFormat> formats(PixelFormat input);
SizeRange sizes(const Size &input);
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 4a1f2052..9ad3aa62 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -763,9 +763,9 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)
/* Open the converter, if any. */
if (converter) {
converter_ = std::make_unique<SimpleConverter>(converter);
- if (converter_->open() < 0) {
+ if (!converter_->isValid()) {
LOG(SimplePipeline, Warning)
- << "Failed to open converter, disabling format conversion";
+ << "Failed to create converter, disabling format conversion";
converter_.reset();
} else {
converter_->bufferReady.connect(this, &SimplePipelineHandler::converterDone);