16 #include <linux/v4l2-subdev.h> 55 return capabilities & V4L2_SUBDEV_CAP_RO_SUBDEV;
59 return capabilities & V4L2_SUBDEV_CAP_STREAMS;
68 const std::string toString()
const;
76 using Formats = std::map<unsigned int, std::vector<SizeRange>>;
79 TryFormat = V4L2_SUBDEV_FORMAT_TRY,
80 ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,
89 Stream(
unsigned int p,
unsigned int s)
105 : sink(snk), source(src), flags(f)
123 int getSelection(
const Stream &stream,
unsigned int target,
127 return getSelection({ pad, 0 }, target, rect);
129 int setSelection(
const Stream &stream,
unsigned int target,
133 return setSelection({ pad, 0 }, target, rect);
139 return formats({ pad, 0 });
143 Whence whence = ActiveFormat);
145 Whence whence = ActiveFormat)
147 return getFormat({ pad, 0 }, format, whence);
150 Whence whence = ActiveFormat);
152 Whence whence = ActiveFormat)
154 return setFormat({ pad, 0 }, format, whence);
157 int getRouting(
Routing *routing,
Whence whence = ActiveFormat);
158 int setRouting(
Routing *routing,
Whence whence = ActiveFormat);
160 const std::string &model();
163 static std::unique_ptr<V4L2Subdevice>
164 fromEntityName(
const MediaDevice *media,
const std::string &entity);
167 std::string logPrefix()
const override;
172 std::optional<ColorSpace>
173 toColorSpace(
const v4l2_mbus_framefmt &format)
const;
175 std::vector<unsigned int> enumPadCodes(
const Stream &stream);
176 std::vector<SizeRange> enumPadSizes(
const Stream &stream,
192 return !(lhs == rhs);
Utilities to help constructing class interfaces.
Base class for V4L2VideoDevice and V4L2Subdevice.
Definition: v4l2_device.h:31
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format, Whence whence=ActiveFormat)
Retrieve the image format set on one of the V4L2 subdevice pads.
Definition: v4l2_subdevice.h:144
unsigned int stream
The stream number.
Definition: v4l2_subdevice.h:95
Stream source
The source stream of the route.
Definition: v4l2_subdevice.h:110
Class and enums to represent color spaces.
Route()
Construct a Route with default streams.
Definition: v4l2_subdevice.h:99
Top-level libcamera namespace.
Definition: backtrace.h:17
Stream sink
The sink stream of the route.
Definition: v4l2_subdevice.h:109
const MediaEntity * entity() const
Retrieve the media entity associated with the subdevice.
Definition: v4l2_subdevice.h:121
int setSelection(unsigned int pad, unsigned int target, Rectangle *rect)
Set selection rectangle rect for target.
Definition: v4l2_subdevice.h:131
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format, Whence whence=ActiveFormat)
Set an image format on one of the V4L2 subdevice pads.
Definition: v4l2_subdevice.h:151
bool operator==(const V4L2Subdevice::Stream &lhs, const V4L2Subdevice::Stream &rhs)
Compare streams for equality.
Definition: v4l2_subdevice.cpp:904
Describe a two-dimensional size.
Definition: geometry.h:52
std::map< unsigned int, std::vector< SizeRange > > Formats
A map of supported media bus formats to frame sizes.
Definition: v4l2_subdevice.h:76
std::vector< Route > Routing
V4L2 subdevice routing table.
Definition: v4l2_subdevice.h:114
int getSelection(unsigned int pad, unsigned int target, Rectangle *rect)
Get selection rectangle rect for target.
Definition: v4l2_subdevice.h:125
#define LIBCAMERA_DISABLE_COPY(klass)
Disable copy construction and assignment of the klass.
Describe a rectangle's position and dimensions.
Definition: geometry.h:242
Common base for V4L2 devices and subdevices.
V4L2 subdevice stream.
Definition: v4l2_subdevice.h:83
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition: geometry.cpp:91
const V4L2SubdeviceCapability & caps() const
Retrieve the subdevice V4L2 capabilities.
Definition: v4l2_subdevice.h:161
bool hasStreams() const
Retrieve if a subdevice supports the V4L2 streams API.
Definition: v4l2_subdevice.h:57
Formats formats(unsigned int pad)
Enumerate all media bus codes and frame sizes on a pad.
Definition: v4l2_subdevice.h:137
bool isReadOnly() const
Retrieve if a subdevice is registered as read-only.
Definition: v4l2_subdevice.h:53
V4L2 subdevice routing table entry.
Definition: v4l2_subdevice.h:98
Stream(unsigned int p, unsigned int s)
Construct a Stream with a given pad and stream number.
Definition: v4l2_subdevice.h:89
Route(const Stream &snk, const Stream &src, uint32_t f)
Construct a Route from sink to source.
Definition: v4l2_subdevice.h:104
uint32_t flags
The route flags (V4L2_SUBDEV_ROUTE_FL_*)
Definition: v4l2_subdevice.h:111
unsigned int pad
The 0-indexed pad number.
Definition: v4l2_subdevice.h:94
Data structures related to geometric objects.
Whence
Specify the type of format for getFormat() and setFormat() operations.
Definition: v4l2_subdevice.h:78
Stream()
Construct a Stream with pad and stream set to 0.
Definition: v4l2_subdevice.h:84
A V4L2 subdevice as exposed by the Linux kernel.
Definition: v4l2_subdevice.h:73
struct v4l2_subdev_capability object wrapper and helpers
Definition: v4l2_subdevice.h:52