summaryrefslogtreecommitdiff
path: root/utils/ipc/generators/mojom_libcamera_generator.py
AgeCommit message (Expand)Author
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
2021-06-01utils: ipc: mojo: Error if ControlInfoMap/List doesn't prefix libcameraPaul Elder
2021-04-27utils: ipc: Use the proper namespace for mojom structsPaul Elder
2021-03-09utils: ipc: Make first output parameter direct return if int32Paul Elder
2021-03-09utils: ipc: Support custom parameters to init()Paul Elder
2021-02-16utils: ipc: add templates for code generation for IPC mechanismPaul Elder
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * camera_controls.cpp - Camera controls
 */

#include "libcamera/internal/camera_controls.h"

#include <libcamera/camera.h>
#include <libcamera/controls.h>

/**
 * \file camera_controls.h
 * \brief Controls for Camera instances
 */

namespace libcamera {

/**
 * \class CameraControlValidator
 * \brief A control validator for Camera instances
 *
 * This ControlValidator specialisation validates that controls exist in the
 * Camera associated with the validator.
 */

/**
 * \brief Construst a CameraControlValidator for the \a camera
 * \param[in] camera The camera
 */
CameraControlValidator::CameraControlValidator(Camera *camera)
	: camera_(camera)
{
}

const std::string &CameraControlValidator::name() const
{
	return camera_->id();
}

/**
 * \brief Validate a control
 * \param[in] id The control ID
 * \return True if the control is valid, false otherwise
 */
bool CameraControlValidator::validate(unsigned int id) const
{
	const ControlInfoMap &controls = camera_->controls();
	return controls.find(id) != controls.end();
}

} /* namespace libcamera */