diff options
Diffstat (limited to 'src/libcamera/include/camera_sensor.h')
-rw-r--r-- | src/libcamera/include/camera_sensor.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h new file mode 100644 index 00000000..7f2f906b --- /dev/null +++ b/src/libcamera/include/camera_sensor.h @@ -0,0 +1,56 @@ +/* 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__ */ |