[v1,6/6] Documentation: guides: pipeline-handler: Query pixel formats once
diff mbox series

Message ID 20241209174806.283905-6-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • [v1,1/6] Documentation: guides: pipeline-handler: Fix camera creation
Related show

Commit Message

Barnabás Pőcze Dec. 9, 2024, 5:48 p.m. UTC
There is no reason to create an entire new copy of the same thing,
so use the already existing `formats` object.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 Documentation/guides/pipeline-handler.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Dec. 10, 2024, 1:44 p.m. UTC | #1
Quoting Barnabás Pőcze (2024-12-09 17:48:06)
> There is no reason to create an entire new copy of the same thing,
> so use the already existing `formats` object.

Indeed, this one probably also needs an update to the vivid tree.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  Documentation/guides/pipeline-handler.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst
> index a798733db..069a69cdd 100644
> --- a/Documentation/guides/pipeline-handler.rst
> +++ b/Documentation/guides/pipeline-handler.rst
> @@ -932,9 +932,9 @@ Add the following function implementation to your file:
>  
>             StreamConfiguration &cfg = config_[0];
>  
> -           const std::vector<libcamera::PixelFormat> formats = cfg.formats().pixelformats();
> +           const std::vector<libcamera::PixelFormat> &formats = cfg.formats().pixelformats();
>             if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {
> -                  cfg.pixelFormat = cfg.formats().pixelformats()[0];
> +                  cfg.pixelFormat = formats[0];
>                    LOG(VIVID, Debug) << "Adjusting format to " << cfg.pixelFormat.toString();
>                    status = Adjusted;
>             }
> -- 
> 2.47.1
>

Patch
diff mbox series

diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst
index a798733db..069a69cdd 100644
--- a/Documentation/guides/pipeline-handler.rst
+++ b/Documentation/guides/pipeline-handler.rst
@@ -932,9 +932,9 @@  Add the following function implementation to your file:
 
            StreamConfiguration &cfg = config_[0];
 
-           const std::vector<libcamera::PixelFormat> formats = cfg.formats().pixelformats();
+           const std::vector<libcamera::PixelFormat> &formats = cfg.formats().pixelformats();
            if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {
-                  cfg.pixelFormat = cfg.formats().pixelformats()[0];
+                  cfg.pixelFormat = formats[0];
                   LOG(VIVID, Debug) << "Adjusting format to " << cfg.pixelFormat.toString();
                   status = Adjusted;
            }