diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-04-27 05:29:29 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-04-28 01:54:34 +0300 |
commit | cc15ab43161b805bade5220e2769908d4ceefeff (patch) | |
tree | a9ec6feaac0377c14a7541b7ec58fd6fddd5d13d /src | |
parent | 6e1cd1394e5d73dfd4c4334cbf8beee79072de21 (diff) |
libcamera: utils: Add a function to retrieve the libcamera source tree
Similarly to libcameraBuildPath(), there's a need to locate resources
within the source tree when running libcamera without installing it.
Support this use case with a new utils::libcameraSourcePath() function.
The implementation uses a symlink from the build root to the source root
in order to avoid hardcoding the path to the source root in the
libcamera.so binary.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/include/utils.h | 1 | ||||
-rw-r--r-- | src/libcamera/utils.cpp | 49 |
2 files changed, 47 insertions, 3 deletions
diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h index 242eeded..3334ff16 100644 --- a/src/libcamera/include/utils.h +++ b/src/libcamera/include/utils.h @@ -188,6 +188,7 @@ private: details::StringSplitter split(const std::string &str, const std::string &delim); std::string libcameraBuildPath()/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* formats.h - libcamera image formats
*/
#pragma once
#include <array>
#include <map>
#include <vector>
#include <libcamera/geometry.h>
#include <libcamera/pixel_format.h>
#include "libcamera/internal/v4l2_pixelformat.h"
namespace libcamera {
class PixelFormatInfo
{
public:
enum ColourEncoding {
ColourEncodingRGB,
ColourEncodingYUV,
ColourEncodingRAW,
};
struct Plane {
unsigned int bytesPerGroup;
unsigned int verticalSubSampling;
};
bool isValid() const { return format.isValid(); }
static const PixelFormatInfo &info(const PixelFormat &format);
static const PixelFormatInfo &info(const V4L2PixelFormat &format);
static const PixelFormatInfo &info(const std::string &name);
unsigned int stride(unsigned int width, unsigned int plane,
unsigned int align = 1) const;
unsigned int planeSize(const Size &size, unsigned int plane,
unsigned int align = 1) const;
unsigned int planeSize(unsigned int height, unsigned int plane,
unsigned int stride) const;
unsigned int frameSize(const Size &size, unsigned int align = 1) const;
unsigned int frameSize(const Size &size,
const std::array<unsigned int, 3> &stride |