summaryrefslogtreecommitdiff
path: root/.reuse/dep5
AgeCommit message (Expand)Author
2023-09-27Documentation: Introduce Camera Sensor ModelJacopo Mondi
2023-05-04pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi codeNaushir Patuck
2022-09-30Documentation: theme: Specify license of search.pngLaurent Pinchart
2022-07-27raspberrypi: Update Copyright statement in all Raspberry Pi source filesNaushir Patuck
2021-09-24libcamera: Standardize URLs to git repositoriesLaurent Pinchart
2020-11-11libcamera: Update dep5 to specify license for mojoPaul Elder
2020-06-09qcam: Specify Feather icons license in DEP5Laurent Pinchart
2020-06-09libcamera: Use DEP5 to specify license of files that don't support SPDXLaurent Pinchart
' href='#n3'>3 4 5 6 7 8 9 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 54 55 56 57 58 59
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * v4l2_device.h - Common base for V4L2 video devices and subdevices
 */
#ifndef __LIBCAMERA_V4L2_DEVICE_H__
#define __LIBCAMERA_V4L2_DEVICE_H__

#include <map>
#include <memory>
#include <vector>

#include <linux/videodev2.h>

#include "log.h"
#include "v4l2_controls.h"

namespace libcamera {

class V4L2Device : protected Loggable
{
public:
	void close();
	bool isOpen() const { return fd_ != -1; }

	const ControlInfoMap &controls() const { return controls_; }

	int getControls(ControlList *ctrls);
	int setControls(ControlList *ctrls);

	const std::string &deviceNode() const { return deviceNode_; }

protected:
	V4L2Device(const std::string &deviceNode);
	~V4L2Device();

	int open(unsigned int flags);
	int setFd(int fd);

	int ioctl(unsigned long request, void *argp);

	int fd() { return fd_; }

private:
	void listControls();
	void updateControls(ControlList *ctrls,
			    const struct v4l2_ext_control *v4l2Ctrls,
			    unsigned int count);

	std::vector<std::unique_ptr<V4L2ControlId>> controlIds_;
	ControlInfoMap controls_;
	std::string deviceNode_;
	int fd_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_V4L2_DEVICE_H__ */