Files
external_libcamera/src/libcamera/include/camera_sensor.h
Laurent Pinchart 7645083c72 libcamera: camera_sensor: Add a new class to model a camera sensor
The CameraSensor class abstracts camera sensors and provides helper
functions to ease interactions with them. It is currently limited to
sensors that expose a single subdev, and offer the same frame sizes for
all media bus codes, but will be extended to support more complex
sensors as the needs arise.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-04-18 18:13:17 +03:00

57 lines
1.2 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* camera_sensor.h - A camera sensor
*/
#ifndef __LIBCAMERA_CAMERA_SENSOR_H__
#define __LIBCAMERA_CAMERA_SENSOR_H__
#include <string>
#include <vector>
#include <libcamera/geometry.h>
#include "log.h"
namespace libcamera {
class MediaEntity;
class V4L2Subdevice;
class V4L2SubdeviceFormat;
class CameraSensor : protected Loggable
{
public:
explicit CameraSensor(const MediaEntity *entity);
~CameraSensor();
CameraSensor(const CameraSensor &) = delete;
CameraSensor &operator=(const CameraSensor &) = delete;
int init();
const MediaEntity *entity() const { return entity_; }
const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
const std::vector<Size> &sizes() const { return sizes_; }
const Size &resolution() const;
V4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,
const Size &size) const;
int setFormat(V4L2SubdeviceFormat *format);
protected:
std::string logPrefix() const;
private:
const MediaEntity *entity_;
V4L2Subdevice *subdev_;
std::vector<unsigned int> mbusCodes_;
std::vector<Size> sizes_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_SENSOR_H__ */