summaryrefslogtreecommitdiff
path: root/Documentation/api-html
AgeCommit message (Collapse)Author
2020-04-15licenses: Add SPDX headers to RST documentationLaurent Pinchart
The documentation files are licensed under CC-BY-SA-4.0, but this has never been specified explicitly. Add corresponding SPDX headers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-23Documentation: Link to API section in DocsLaurent Pinchart
The API belongs to the docs section. Link to it from docs.rst, and remove the shortcut in the navigation bar as links to a placeholder only. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-01-11Documentation: Add placeholder for Doxygen-generated API documentationLaurent Pinchart
Until we have better Sphinx + Doxygen integration, replace the relative external link to the API documentation with a placeholder directory, which will be populated with the Doxygen-generated doc when exporting documentation to the website. This is needed as the Sphinx documentation is exported to the root of the website, linking to ../api-html is thus not possible. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 75 76 77 78 79 80 81 82 83 84 85 86
/* 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_;
};