[libcamera-devel] [PATCH 2/3] Documentation: Update code examples to use the Request::reuse() method

Jacopo Mondi jacopo at jmondi.org
Thu Jun 16 12:50:38 CEST 2022


Hi Daniel

On Wed, Jun 15, 2022 at 06:26:00PM +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.

> ---
>  Documentation/guides/application-developer.rst | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst
> index 6ab8b7e5..00bafb10 100644
> --- a/Documentation/guides/application-developer.rst
> +++ b/Documentation/guides/application-developer.rst
> @@ -485,21 +485,7 @@ streams, and finally, queue the new capture request to the camera device:

I would also change the above text

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:

With

With the handling of this request completed, it is possible to re-use the
request and the associated buffers and re-queue it to the camera
device:

What do you think ?

Thanks
  j
>
>  .. 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
> --
> 2.34.1
>


More information about the libcamera-devel mailing list