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

Message ID 20220615162601.48619-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 15, 2022, 4:26 p.m. UTC
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(-)

Comments

Jacopo Mondi June 16, 2022, 10:50 a.m. UTC | #1
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
>
Daniel Semkowicz June 17, 2022, 7:09 a.m. UTC | #2
Hi Jacopo,

On Thu, Jun 16, 2022 at 12:50 PM Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> 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 ?
>

Sounds good, I will include this change.

Best regards
Daniel

> 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
> >

Patch
diff mbox series

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:
 
 .. 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