summaryrefslogtreecommitdiff
path: root/include/android/system/core
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-08 02:16:19 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-16 00:28:32 +0300
commit5c1cb5e5bcc279a38b3947e9050ef4cd9e4ae0fd (patch)
tree6315f57da01e27c749cf502a95667073f611f9d3 /include/android/system/core
parent6a96113107a9cf29b24f50b81f930508c0748fcd (diff)
py: gen-py-controls: Use Control class
Replace manual extraction of data from YAML with the Control helper class. This centralizes YAML parsing and avoids manual mistakes. In order to import the controls module, add the utils/codegen/ directory to the PYTHONPATH through the Python build environment. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'include/android/system/core')
0 files changed, 0 insertions, 0 deletions
a id='n51' href='#n51'>51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * v4l2_subdevice.h - V4L2 Subdevice
 */

#pragma once

#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <vector>

#include <linux/v4l2-subdev.h>

#include <libcamera/base/class.h>
#include <libcamera/base/log.h>

#include <libcamera/color_space.h>
#include <libcamera/geometry.h>

#include "libcamera/internal/formats.h"
#include "libcamera/internal/media_object.h"
#include "libcamera/internal/v4l2_device.h"

namespace libcamera {

class MediaDevice;

struct V4L2SubdeviceCapability final : v4l2_subdev_capability {
	bool isReadOnly() const
	{
		return capabilities & V4L2_SUBDEV_CAP_RO_SUBDEV;
	}
	bool hasStreams() const
	{
		return capabilities & V4L2_SUBDEV_CAP_MPLEXED;
	}
};

struct V4L2SubdeviceFormat {
	uint32_t mbus_code;
	Size size;
	std::optional<ColorSpace> colorSpace;

	const std::string toString() const;
	uint8_t bitsPerPixel() const;
};

std::ostream &operator<<(std::ostream &out, const V4L2SubdeviceFormat &f);

class V4L2Subdevice : public V4L2Device
{
public:
	using Formats = std::map<unsigned int, std::vector<SizeRange>>;

	enum Whence {
		TryFormat = V4L2_SUBDEV_FORMAT_TRY,
		ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,
	};

	class Routing : public std::vector<struct v4l2_subdev_route>
	{
	public:
		std::string toString() const;
	};

	explicit V4L2Subdevice(const MediaEntity *entity);
	~V4L2Subdevice();

	int open();

	const MediaEntity *entity() const { return entity_; }

	int getSelection(unsigned int pad, unsigned int target,
			 Rectangle *rect);
	int setSelection(unsigned int pad, unsigned int target,
			 Rectangle *rect);

	Formats formats(unsigned int pad);