libcamera: Switch from utils::make_unique to std::make_unique
Now that we're using C++-14, drop utils::make_unique for std::make_unique. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
9a61a13466
commit
acf18e4265
22 changed files with 29 additions and 49 deletions
|
@ -860,7 +860,7 @@ std::unique_ptr<CameraMetadata> CameraDevice::getResultMetadata(int frame_number
|
|||
* Currently: 12 entries, 36 bytes
|
||||
*/
|
||||
std::unique_ptr<CameraMetadata> resultMetadata =
|
||||
utils::make_unique<CameraMetadata>(15, 50);
|
||||
std::make_unique<CameraMetadata>(15, 50);
|
||||
if (!resultMetadata->isValid()) {
|
||||
LOG(HAL, Error) << "Failed to allocate static metadata";
|
||||
return nullptr;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "libipa/ipa_interface_wrapper.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
|
@ -113,7 +112,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
|
|||
|
||||
struct ipa_context *ipaCreate()
|
||||
{
|
||||
return new IPAInterfaceWrapper(utils::make_unique<IPAVimc>());
|
||||
return new IPAInterfaceWrapper(std::make_unique<IPAVimc>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace libcamera {
|
|||
*
|
||||
* struct ipa_context *ipaCreate()
|
||||
* {
|
||||
* return new IPAInterfaceWrapper(utils::make_unique<MyIPA>());
|
||||
* return new IPAInterfaceWrapper(std::make_unique<MyIPA>());
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
|
|
|
@ -278,7 +278,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
|
|||
|
||||
struct ipa_context *ipaCreate()
|
||||
{
|
||||
return new IPAInterfaceWrapper(utils::make_unique<IPARkISP1>());
|
||||
return new IPAInterfaceWrapper(std::make_unique<IPARkISP1>());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "message.h"
|
||||
#include "semaphore.h"
|
||||
#include "thread.h"
|
||||
#include "utils.h"
|
||||
|
||||
/**
|
||||
* \file bound_method.h
|
||||
|
@ -84,7 +83,7 @@ bool BoundMethodBase::activatePack(std::shared_ptr<BoundMethodPackBase> pack,
|
|||
|
||||
case ConnectionTypeQueued: {
|
||||
std::unique_ptr<Message> msg =
|
||||
utils::make_unique<InvokeMessage>(this, pack, nullptr, deleteMethod);
|
||||
std::make_unique<InvokeMessage>(this, pack, nullptr, deleteMethod);
|
||||
object_->postMessage(std::move(msg));
|
||||
return false;
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ bool BoundMethodBase::activatePack(std::shared_ptr<BoundMethodPackBase> pack,
|
|||
Semaphore semaphore;
|
||||
|
||||
std::unique_ptr<Message> msg =
|
||||
utils::make_unique<InvokeMessage>(this, pack, &semaphore, deleteMethod);
|
||||
std::make_unique<InvokeMessage>(this, pack, &semaphore, deleteMethod);
|
||||
object_->postMessage(std::move(msg));
|
||||
|
||||
semaphore.acquire();
|
||||
|
|
|
@ -414,7 +414,7 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &
|
|||
* \todo Find a way to preserve the control name for debugging
|
||||
* purpose.
|
||||
*/
|
||||
controlIds_.emplace_back(utils::make_unique<ControlId>(entry.id, "", type));
|
||||
controlIds_.emplace_back(std::make_unique<ControlId>(entry.id, "", type));
|
||||
|
||||
if (entry.offset != values.offset()) {
|
||||
LOG(Serializer, Error)
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "log.h"
|
||||
#include "media_device.h"
|
||||
#include "utils.h"
|
||||
|
||||
/**
|
||||
* \file device_enumerator.h
|
||||
|
@ -145,7 +144,7 @@ std::unique_ptr<DeviceEnumerator> DeviceEnumerator::create()
|
|||
std::unique_ptr<DeviceEnumerator> enumerator;
|
||||
|
||||
#ifdef HAVE_LIBUDEV
|
||||
enumerator = utils::make_unique<DeviceEnumeratorUdev>();
|
||||
enumerator = std::make_unique<DeviceEnumeratorUdev>();
|
||||
if (!enumerator->init())
|
||||
return enumerator;
|
||||
#endif
|
||||
|
@ -154,7 +153,7 @@ std::unique_ptr<DeviceEnumerator> DeviceEnumerator::create()
|
|||
* Either udev is not available or udev initialization failed. Fall back
|
||||
* on the sysfs enumerator.
|
||||
*/
|
||||
enumerator = utils::make_unique<DeviceEnumeratorSysfs>();
|
||||
enumerator = std::make_unique<DeviceEnumeratorSysfs>();
|
||||
if (!enumerator->init())
|
||||
return enumerator;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <ipa/ipa_interface.h>
|
||||
|
||||
#include "ipa_module.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
|
@ -56,7 +55,7 @@ public: \
|
|||
proxy##Factory() : IPAProxyFactory(#proxy) {} \
|
||||
std::unique_ptr<IPAProxy> create(IPAModule *ipam) \
|
||||
{ \
|
||||
return utils::make_unique<proxy>(ipam); \
|
||||
return std::make_unique<proxy>(ipam); \
|
||||
} \
|
||||
}; \
|
||||
static proxy##Factory global_##proxy##Factory;
|
||||
|
|
|
@ -32,13 +32,6 @@ namespace utils {
|
|||
|
||||
const char *basename(const char *path);
|
||||
|
||||
/* C++11 doesn't provide std::make_unique */
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args&&... args)
|
||||
{
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
char *secure_getenv(const char *name);
|
||||
|
||||
template<class InputIt1, class InputIt2>
|
||||
|
|
|
@ -264,7 +264,7 @@ std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,
|
|||
if (!ctx)
|
||||
return nullptr;
|
||||
|
||||
return utils::make_unique<IPAContextWrapper>(ctx);
|
||||
return std::make_unique<IPAContextWrapper>(ctx);
|
||||
}
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
|
|
@ -876,7 +876,7 @@ int PipelineHandlerIPU3::registerCameras()
|
|||
unsigned int numCameras = 0;
|
||||
for (unsigned int id = 0; id < 4 && numCameras < 2; ++id) {
|
||||
std::unique_ptr<IPU3CameraData> data =
|
||||
utils::make_unique<IPU3CameraData>(this);
|
||||
std::make_unique<IPU3CameraData>(this);
|
||||
std::set<Stream *> streams = {
|
||||
&data->outStream_,
|
||||
&data->vfStream_,
|
||||
|
|
|
@ -388,7 +388,7 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,
|
|||
switch (action.operation) {
|
||||
case RKISP1_IPA_ACTION_V4L2_SET: {
|
||||
const ControlList &controls = action.controls[0];
|
||||
timeline_.scheduleAction(utils::make_unique<RkISP1ActionSetSensor>(frame,
|
||||
timeline_.scheduleAction(std::make_unique<RkISP1ActionSetSensor>(frame,
|
||||
sensor_,
|
||||
controls));
|
||||
break;
|
||||
|
@ -846,7 +846,7 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera,
|
|||
op.controls = { request->controls() };
|
||||
data->ipa_->processEvent(op);
|
||||
|
||||
data->timeline_.scheduleAction(utils::make_unique<RkISP1ActionQueueBuffers>(data->frame_,
|
||||
data->timeline_.scheduleAction(std::make_unique<RkISP1ActionQueueBuffers>(data->frame_,
|
||||
data,
|
||||
this));
|
||||
|
||||
|
@ -892,7 +892,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
|
|||
int ret;
|
||||
|
||||
std::unique_ptr<RkISP1CameraData> data =
|
||||
utils::make_unique<RkISP1CameraData>(this);
|
||||
std::make_unique<RkISP1CameraData>(this);
|
||||
|
||||
ControlInfoMap::Map ctrls;
|
||||
ctrls.emplace(std::piecewise_construct,
|
||||
|
|
|
@ -296,7 +296,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
|
|||
if (!media)
|
||||
return false;
|
||||
|
||||
std::unique_ptr<UVCCameraData> data = utils::make_unique<UVCCameraData>(this);
|
||||
std::unique_ptr<UVCCameraData> data = std::make_unique<UVCCameraData>(this);
|
||||
|
||||
/* Locate and initialise the camera data with the default video node. */
|
||||
const std::vector<MediaEntity *> &entities = media->entities();
|
||||
|
|
|
@ -365,7 +365,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
|
|||
if (!media)
|
||||
return false;
|
||||
|
||||
std::unique_ptr<VimcCameraData> data = utils::make_unique<VimcCameraData>(this);
|
||||
std::unique_ptr<VimcCameraData> data = std::make_unique<VimcCameraData>(this);
|
||||
|
||||
data->ipa_ = IPAManager::instance()->createIPA(this, 0, 0);
|
||||
if (data->ipa_ == nullptr)
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "ipc_unixsocket.h"
|
||||
#include "log.h"
|
||||
#include "thread.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
@ -58,7 +57,7 @@ int main(int argc, char **argv)
|
|||
<< "Starting worker for IPA module " << argv[1]
|
||||
<< " with IPC fd = " << fd;
|
||||
|
||||
std::unique_ptr<IPAModule> ipam = utils::make_unique<IPAModule>(argv[1]);
|
||||
std::unique_ptr<IPAModule> ipam = std::make_unique<IPAModule>(argv[1]);
|
||||
if (!ipam->isValid() || !ipam->load()) {
|
||||
LOG(IPAProxyLinuxWorker, Error)
|
||||
<< "IPAModule " << argv[1] << " should be valid but isn't";
|
||||
|
|
|
@ -70,11 +70,6 @@ char *secure_getenv(const char *name)
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn libcamera::utils::make_unique(Args &&... args)
|
||||
* \brief Constructs an object of type T and wraps it in a std::unique_ptr.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn libcamera::utils::set_overlap(InputIt1 first1, InputIt1 last1,
|
||||
* InputIt2 first2, InputIt2 last2)
|
||||
|
|
|
@ -380,7 +380,7 @@ void V4L2Device::listControls()
|
|||
continue;
|
||||
}
|
||||
|
||||
controlIds_.emplace_back(utils::make_unique<V4L2ControlId>(ctrl));
|
||||
controlIds_.emplace_back(std::make_unique<V4L2ControlId>(ctrl));
|
||||
ctrls.emplace(controlIds_.back().get(), V4L2ControlRange(ctrl));
|
||||
}
|
||||
|
||||
|
|
|
@ -1054,7 +1054,7 @@ V4L2VideoDevice::createBuffer(const struct v4l2_buffer &buf)
|
|||
planes.push_back(std::move(plane));
|
||||
}
|
||||
|
||||
return utils::make_unique<FrameBuffer>(std::move(planes));
|
||||
return std::make_unique<FrameBuffer>(std::move(planes));
|
||||
}
|
||||
|
||||
FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace libcamera;
|
||||
|
||||
|
@ -81,7 +80,7 @@ void V4L2Camera::requestComplete(Request *request)
|
|||
bufferLock_.lock();
|
||||
FrameBuffer *buffer = request->buffers().begin()->second;
|
||||
std::unique_ptr<Buffer> metadata =
|
||||
utils::make_unique<Buffer>(request->cookie(), buffer->metadata());
|
||||
std::make_unique<Buffer>(request->cookie(), buffer->metadata());
|
||||
completedBuffers_.push_back(std::move(metadata));
|
||||
bufferLock_.unlock();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ LOG_DECLARE_CATEGORY(V4L2Compat);
|
|||
V4L2CameraProxy::V4L2CameraProxy(unsigned int index,
|
||||
std::shared_ptr<Camera> camera)
|
||||
: refcount_(0), index_(index), bufferCount_(0), currentBuf_(0),
|
||||
vcam_(utils::make_unique<V4L2Camera>(camera))
|
||||
vcam_(std::make_unique<V4L2Camera>(camera))
|
||||
{
|
||||
querycap(camera);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "device_enumerator.h"
|
||||
#include "ipa_context_wrapper.h"
|
||||
#include "media_device.h"
|
||||
#include "utils.h"
|
||||
#include "v4l2_subdevice.h"
|
||||
|
||||
#include "test.h"
|
||||
|
@ -254,7 +253,7 @@ protected:
|
|||
if (ret)
|
||||
return TestFail;
|
||||
|
||||
std::unique_ptr<IPAInterface> intf = utils::make_unique<TestIPAInterface>();
|
||||
std::unique_ptr<IPAInterface> intf = std::make_unique<TestIPAInterface>();
|
||||
wrapper_ = new IPAContextWrapper(new IPAInterfaceWrapper(std::move(intf)));
|
||||
wrapper_->queueFrameAction.connect(this, &IPAWrappersTest::queueFrameAction);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "message.h"
|
||||
#include "thread.h"
|
||||
#include "test.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace libcamera;
|
||||
|
@ -92,7 +91,7 @@ protected:
|
|||
|
||||
thread_.start();
|
||||
|
||||
receiver.postMessage(utils::make_unique<Message>(Message::None));
|
||||
receiver.postMessage(std::make_unique<Message>(Message::None));
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(100));
|
||||
|
||||
|
@ -114,7 +113,7 @@ protected:
|
|||
*/
|
||||
SlowMessageReceiver *slowReceiver = new SlowMessageReceiver();
|
||||
slowReceiver->moveToThread(&thread_);
|
||||
slowReceiver->postMessage(utils::make_unique<Message>(Message::None));
|
||||
slowReceiver->postMessage(std::make_unique<Message>(Message::None));
|
||||
|
||||
this_thread::sleep_for(chrono::milliseconds(10));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue