[libcamera-devel,v2,2/3] Documentation: Update code examples to use the Request::reuse() method
diff mbox series

Message ID 20220617143549.35442-3-dse@thaumatec.com
State Accepted
Headers show
Series
  • Documentation: Update code examples in Application Writer's Guide
Related show

Commit Message

Daniel Semkowicz June 17, 2022, 2:35 p.m. UTC
After introduction of reuse(), there is no need of manual request
reconfiguration. Furthermore, current example code does not work
anymore.

Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>
---
 .../guides/application-developer.rst          | 20 +++----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

Comments

Laurent Pinchart June 17, 2022, 2:51 p.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Fri, Jun 17, 2022 at 04:35:48PM +0200, Daniel Semkowicz via libcamera-devel wrote:
> After introduction of reuse(), there is no need of manual request
> reconfiguration. Furthermore, current example code does not work
> anymore.
> 
> Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .../guides/application-developer.rst          | 20 +++----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst
> index 6ab8b7e5..a5f363cf 100644
> --- a/Documentation/guides/application-developer.rst
> +++ b/Documentation/guides/application-developer.rst
> @@ -480,26 +480,12 @@ libcamera repository.
>  .. _FileSink class: https://git.libcamera.org/libcamera/libcamera.git/tree/src/cam/file_sink.cpp
>  
>  With the handling of this request completed, it is possible to re-use the
> -buffers by adding them to a new ``Request`` instance with their matching
> -streams, and finally, queue the new capture request to the camera device:
> +request and the associated buffers and re-queue it to the camera
> +device:
>  
>  .. code:: cpp
>  
> -   request = camera->createRequest();
> -   if (!request)
> -   {
> -       std::cerr << "Can't create request" << std::endl;
> -       return;
> -   }
> -
> -   for (auto it = buffers.begin(); it != buffers.end(); ++it)
> -   {
> -       Stream *stream = it->first;
> -       FrameBuffer *buffer = it->second;
> -
> -       request->addBuffer(stream, buffer);
> -   }
> -
> +   request->reuse(Request::ReuseBuffers);
>     camera->queueRequest(request);
>  
>  Request queueing

Patch
diff mbox series

diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst
index 6ab8b7e5..a5f363cf 100644
--- a/Documentation/guides/application-developer.rst
+++ b/Documentation/guides/application-developer.rst
@@ -480,26 +480,12 @@  libcamera repository.
 .. _FileSink class: https://git.libcamera.org/libcamera/libcamera.git/tree/src/cam/file_sink.cpp
 
 With the handling of this request completed, it is possible to re-use the
-buffers by adding them to a new ``Request`` instance with their matching
-streams, and finally, queue the new capture request to the camera device:
+request and the associated buffers and re-queue it to the camera
+device:
 
 .. code:: cpp
 
-   request = camera->createRequest();
-   if (!request)
-   {
-       std::cerr << "Can't create request" << std::endl;
-       return;
-   }
-
-   for (auto it = buffers.begin(); it != buffers.end(); ++it)
-   {
-       Stream *stream = it->first;
-       FrameBuffer *buffer = it->second;
-
-       request->addBuffer(stream, buffer);
-   }
-
+   request->reuse(Request::ReuseBuffers);
    camera->queueRequest(request);
 
 Request queueing