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:
@@ -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_)
|
||||
|
||||
Reference in New Issue
Block a user