[libcamera-devel] [PATCH v6 12/15] libcamera: apps: lcc: Make rolesMap global

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Jan 30 14:50:14 CET 2023


Quoting Naushir Patuck via libcamera-devel (2023-01-27 15:43:19)
> Move rolesMap out of the nameParameters() function to allow use with
> other functions in the file. Additionally enclose all global variables
> in an unnamed namespace.
> 
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>

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

> ---
>  src/apps/lc-compliance/capture_test.cpp | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp
> index 1dcfcf92fc8c..37138dfb3d2e 100644
> --- a/src/apps/lc-compliance/capture_test.cpp
> +++ b/src/apps/lc-compliance/capture_test.cpp
> @@ -15,6 +15,15 @@
>  
>  using namespace libcamera;
>  
> +namespace {
> +
> +std::map<StreamRole, std::string> rolesMap = {
> +       { StreamRole::Raw, "Raw" },
> +       { StreamRole::StillCapture, "StillCapture" },
> +       { StreamRole::VideoRecording, "VideoRecording" },
> +       { StreamRole::Viewfinder, "Viewfinder" }
> +};
> +
>  const std::vector<int> NUMREQUESTS = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };
>  const std::vector<StreamRole> ROLES = {
>         StreamRole::Raw,
> @@ -23,6 +32,8 @@ const std::vector<StreamRole> ROLES = {
>         StreamRole::Viewfinder
>  };
>  
> +} /* namespace */
> +
>  class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>>
>  {
>  public:
> @@ -59,13 +70,6 @@ void SingleStream::TearDown()
>  
>  std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)
>  {
> -       std::map<StreamRole, std::string> rolesMap = {
> -               { StreamRole::Raw, "Raw" },
> -               { StreamRole::StillCapture, "StillCapture" },
> -               { StreamRole::VideoRecording, "VideoRecording" },
> -               { StreamRole::Viewfinder, "Viewfinder" }
> -       };
> -
>         std::string roleName = rolesMap[std::get<0>(info.param)];
>         std::string numRequestsName = std::to_string(std::get<1>(info.param));
>  
> -- 
> 2.25.1
>


More information about the libcamera-devel mailing list