Files
buildroot/package/libcamera-apps/0002-core-Switch-libcamera-string-controls.patch
Bernd Kuhls 00cce8c052 package/libcamera-apps: fix build
Buildroot commit 95c385e2d6 in -next
branch bumped libcamera to version 0.6.0 which breaks the build:

../core/options.cpp:405:44: error: conversion from
 'std::basic_string_view<char>' to non-scalar type
 'const std::string' {aka 'const std::__cxx11::basic_string<char>'}
 requested
  405 |                 const std::string cam_id =
 *cameras[camera]->properties().get(libcamera::properties::Model);

Added upstream patch, included since version 1.10.0, to fix the problem.

Please note that since version 1.9.1 this package is incompatible with
the current version of ffmpeg used in buildroot so bumping it is not an
option atm:
cbe9921eed

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Julien: fix Buildroot commit id of libcamera bump]
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-12-05 22:57:51 +01:00

47 lines
1.7 KiB
Diff

From f3011b5fae183a463630b4168626dfefe9b4c74e Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Thu, 16 Oct 2025 14:45:33 +0100
Subject: [PATCH] core: Switch libcamera string controls to use
std::string_view
This is a change to the libcamera API, switch to std::string_view from
std::string.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Upstream: https://github.com/raspberrypi/rpicam-apps/commit/f3011b5fae183a463630b4168626dfefe9b4c74e
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
core/options.cpp | 2 +-
core/rpicam_app.cpp | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/core/options.cpp b/core/options.cpp
index cf704c2a..d3296548 100644
--- a/core/options.cpp
+++ b/core/options.cpp
@@ -418,7 +418,7 @@ bool OptsInternal::Parse(boost::program_options::variables_map &vm, RPiCamApp *a
std::vector<std::shared_ptr<libcamera::Camera>> cameras = app->GetCameras();
if (camera < cameras.size())
{
- const std::string cam_id = *cameras[camera]->properties().get(libcamera::properties::Model);
+ const std::string_view cam_id = *cameras[camera]->properties().get(libcamera::properties::Model);
if (cam_id.find("imx708") != std::string::npos)
{
diff --git a/core/rpicam_app.cpp b/core/rpicam_app.cpp
index 9e5a2d0c..0f0b5ffa 100644
--- a/core/rpicam_app.cpp
+++ b/core/rpicam_app.cpp
@@ -128,8 +128,7 @@ std::string const &RPiCamApp::CameraId() const
std::string RPiCamApp::CameraModel() const
{
- auto model = camera_->properties().get(properties::Model);
- return model ? *model : camera_->id();
+ return std::string(camera_->properties().get(properties::Model).value_or(camera_->id()));
}
void RPiCamApp::OpenCamera()