From f44ce70d9b8859c319e5c814584684ff61e3b6fa Mon Sep 17 00:00:00 2001 From: Tommaso Merciai Date: Mon, 13 Jun 2022 10:27:25 +0200 Subject: Documentation: Fix createRequest unique_ptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit camera->createRequest() function return std::unique_ptr, then manipulate Request as std::unique_ptr. This solve the following error, during compilation: error: cannot convert ‘std::unique_ptr’ to ‘libcamera::Request*’ in initialization References: - https://github.com/kbingham/simple-cam/blob/bb97f3bbd96a9d347e1b7f6cb68d94efaf8db574/simple-cam.cpp#L369 Signed-off-by: Tommaso Merciai Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- Documentation/guides/application-developer.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst index 16bea9c4..8d12a208 100644 --- a/Documentation/guides/application-developer.rst +++ b/Documentation/guides/application-developer.rst @@ -308,7 +308,7 @@ the camera. Stream *stream = streamConfig.stream(); const std::vector> &buffers = allocator->buffers(stream); - std::vector requests; + std::vector> requests; Proceed to fill the request vector by creating ``Request`` instances from the camera device, and associate a buffer for each of them for the ``Stream``. @@ -316,7 +316,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. .. code:: cpp for (unsigned int i = 0; i < buffers.size(); ++i) { - Request *request = camera->createRequest(); + std::unique_ptr request = camera->createRequest(); if (!request) { std::cerr << "Can't create request" << std::endl; @@ -332,7 +332,7 @@ camera device, and associate a buffer for each of them for the ``Stream``. return ret; } - requests.push_back(request); + requests.push_back(std::move(request)); } .. TODO: Controls @@ -517,8 +517,8 @@ and queue all the previously created requests. .. code:: cpp camera->start(); - for (Request *request : requests) - camera->queueRequest(request); + for (std::unique_ptr &request : requests) + camera->queueRequest(request.get()); Start an event loop ~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.1