Files
external_libcamera/src/libcamera/include/camera_sensor.h
Laurent Pinchart 343978af0b libcamera: v4l2_device: Replace V4L2ControlList with ControlList
The V4L2Device class uses V4L2ControlList as a controls container for
the getControls() and setControls() operations. Having a distinct
container from ControlList will makes the IPA API more complex, as it
needs to explicitly transport both types of lists. This will become even
more painful when implementing serialisation and deserialisation.

To simplify the IPA API and ease the implementation of serialisation and
deserialisation, replace usage of V4L2ControlList with ControlList in
the V4L2Device (and thus CameraSensor) API. The V4L2ControlList class
becomes a thin wrapper around ControlList that slightly simplifies the
creation of control lists for V4L2 controls, and may be removed in the
future.

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

64 lines
1.4 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 ControlList;
class MediaEntity;
class V4L2ControlInfoMap;
class V4L2Subdevice;
struct 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);
const V4L2ControlInfoMap &controls() const;
int getControls(ControlList *ctrls);
int setControls(ControlList *ctrls);
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__ */