Source files in libcamera start by a comment block header, which
includes the file name and a one-line description of the file contents.
While the latter is useful to get a quick overview of the file contents
at a glance, the former is mostly a source of inconvenience. The name in
the comments can easily get out of sync with the file name when files
are renamed, and copy & paste during development have often lead to
incorrect names being used to start with.
Readers of the source code are expected to know which file they're
looking it. Drop the file name from the header comment block.
The change was generated with the following script:
----------------------------------------
dirs="include/libcamera src test utils"
declare -rA patterns=(
['c']=' \* '
['cpp']=' \* '
['h']=' \* '
['py']='# '
['sh']='# '
)
for ext in ${!patterns[@]} ; do
files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done)
pattern=${patterns[${ext}]}
for file in $files ; do
name=$(basename ${file})
sed -i "s/^\(${pattern}\)${name} - /\1/" "$file"
done
done
----------------------------------------
This misses several files that are out of sync with the comment block
header. Those will be addressed separately and manually.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
87 lines
2.5 KiB
C++
87 lines
2.5 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2021, Google Inc.
|
|
*
|
|
* Camera static properties manager
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <set>
|
|
#include <vector>
|
|
|
|
#include <libcamera/base/class.h>
|
|
|
|
#include <libcamera/camera.h>
|
|
#include <libcamera/formats.h>
|
|
#include <libcamera/geometry.h>
|
|
|
|
#include "camera_metadata.h"
|
|
|
|
class CameraCapabilities
|
|
{
|
|
public:
|
|
CameraCapabilities() = default;
|
|
|
|
int initialize(std::shared_ptr<libcamera::Camera> camera,
|
|
int orientation, int facing);
|
|
|
|
CameraMetadata *staticMetadata() const { return staticMetadata_.get(); }
|
|
libcamera::PixelFormat toPixelFormat(int format) const;
|
|
unsigned int maxJpegBufferSize() const { return maxJpegBufferSize_; }
|
|
|
|
std::unique_ptr<CameraMetadata> requestTemplateManual() const;
|
|
std::unique_ptr<CameraMetadata> requestTemplatePreview() const;
|
|
std::unique_ptr<CameraMetadata> requestTemplateStill() const;
|
|
std::unique_ptr<CameraMetadata> requestTemplateVideo() const;
|
|
|
|
private:
|
|
LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraCapabilities)
|
|
|
|
struct Camera3StreamConfiguration {
|
|
libcamera::Size resolution;
|
|
int androidFormat;
|
|
int64_t minFrameDurationNsec;
|
|
int64_t maxFrameDurationNsec;
|
|
};
|
|
|
|
bool validateManualSensorCapability();
|
|
bool validateManualPostProcessingCapability();
|
|
bool validateBurstCaptureCapability();
|
|
|
|
std::set<camera_metadata_enum_android_request_available_capabilities>
|
|
computeCapabilities();
|
|
|
|
void computeHwLevel(
|
|
const std::set<camera_metadata_enum_android_request_available_capabilities> &caps);
|
|
|
|
std::vector<libcamera::Size>
|
|
initializeYUVResolutions(const libcamera::PixelFormat &pixelFormat,
|
|
const std::vector<libcamera::Size> &resolutions);
|
|
std::vector<libcamera::Size>
|
|
initializeRawResolutions(const libcamera::PixelFormat &pixelFormat);
|
|
int initializeStreamConfigurations();
|
|
|
|
int initializeStaticMetadata();
|
|
|
|
std::shared_ptr<libcamera::Camera> camera_;
|
|
|
|
int facing_;
|
|
int orientation_;
|
|
bool rawStreamAvailable_;
|
|
int64_t maxFrameDuration_;
|
|
camera_metadata_enum_android_info_supported_hardware_level hwLevel_;
|
|
std::set<camera_metadata_enum_android_request_available_capabilities> capabilities_;
|
|
|
|
std::vector<Camera3StreamConfiguration> streamConfigurations_;
|
|
std::map<int, libcamera::PixelFormat> formatsMap_;
|
|
std::unique_ptr<CameraMetadata> staticMetadata_;
|
|
unsigned int maxJpegBufferSize_;
|
|
|
|
std::set<int32_t> availableCharacteristicsKeys_;
|
|
std::set<int32_t> availableRequestKeys_;
|
|
std::set<int32_t> availableResultKeys_;
|
|
};
|