libcamera: pipeline: Manage resources with std::unique_ptr<>

Replace manual resource destruction with std::unique_ptr<> where
applicable. This removes the need for several destructors.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2020-12-09 13:13:38 +02:00
parent 1c2b54a017
commit 3129fcae43
7 changed files with 22 additions and 51 deletions
+1 -7
View File
@@ -24,7 +24,6 @@ namespace libcamera {
LOG_DECLARE_CATEGORY(SimplePipeline)
SimpleConverter::SimpleConverter(MediaDevice *media)
: m2m_(nullptr)
{
/*
* Locate the video node. There's no need to validate the pipeline
@@ -38,17 +37,12 @@ SimpleConverter::SimpleConverter(MediaDevice *media)
if (it == entities.end())
return;
m2m_ = new V4L2M2MDevice((*it)->deviceNode());
m2m_ = std::make_unique<V4L2M2MDevice>((*it)->deviceNode());
m2m_->output()->bufferReady.connect(this, &SimpleConverter::outputBufferReady);
m2m_->capture()->bufferReady.connect(this, &SimpleConverter::captureBufferReady);
}
SimpleConverter::~SimpleConverter()
{
delete m2m_;
}
int SimpleConverter::open()
{
if (!m2m_)