16#include <linux/v4l2-subdev.h>
35 return capabilities & V4L2_SUBDEV_CAP_RO_SUBDEV;
39 return capabilities & V4L2_SUBDEV_CAP_MPLEXED;
57 using Formats = std::map<unsigned int, std::vector<SizeRange>>;
64 class Routing :
public std::vector<struct v4l2_subdev_route>
92 const std::string &
model();
95 static std::unique_ptr<V4L2Subdevice>
104 std::optional<ColorSpace>
105 toColorSpace(
const v4l2_mbus_framefmt &format)
const;
107 std::vector<unsigned int> enumPadCodes(
unsigned int pad);
108 std::vector<SizeRange> enumPadSizes(
unsigned int pad,
Utilities to help constructing class interfaces.
#define LIBCAMERA_DISABLE_COPY(klass)
Disable copy construction and assignment of the klass.
Describe a rectangle's position and dimensions.
Definition: geometry.h:243
Describe a two-dimensional size.
Definition: geometry.h:53
Base class for V4L2VideoDevice and V4L2Subdevice.
Definition: v4l2_device.h:32
V4L2 subdevice routing table.
Definition: v4l2_subdevice.h:65
std::string toString() const
Assemble and return a string describing the routing table.
Definition: v4l2_subdevice.cpp:308
A V4L2 subdevice as exposed by the Linux kernel.
Definition: v4l2_subdevice.h:55
static std::unique_ptr< V4L2Subdevice > fromEntityName(const MediaDevice *media, const std::string &entity)
Create a new video subdevice instance from entity in media device media.
Definition: v4l2_subdevice.cpp:735
int open()
Open a V4L2 subdevice.
Definition: v4l2_subdevice.cpp:342
int setSelection(unsigned int pad, unsigned int target, Rectangle *rect)
Set selection rectangle rect for target.
Definition: v4l2_subdevice.cpp:417
std::string logPrefix() const override
Retrieve a string to be prefixed to the log message.
Definition: v4l2_subdevice.cpp:745
int setRouting(Routing *routing, Whence whence=ActiveFormat)
Set a routing table on the V4L2 subdevice.
Definition: v4l2_subdevice.cpp:647
int getSelection(unsigned int pad, unsigned int target, Rectangle *rect)
Get selection rectangle rect for target.
Definition: v4l2_subdevice.cpp:381
const V4L2SubdeviceCapability & caps() const
Retrieve the subdevice V4L2 capabilities.
Definition: v4l2_subdevice.h:93
Formats formats(unsigned int pad)
Enumerate all media bus codes and frame sizes on a pad.
Definition: v4l2_subdevice.cpp:456
std::map< unsigned int, std::vector< SizeRange > > Formats
A map of supported media bus formats to frame sizes.
Definition: v4l2_subdevice.h:57
Whence
Specify the type of format for getFormat() and setFormat() operations.
Definition: v4l2_subdevice.h:59
@ ActiveFormat
The format operation applies to ACTIVE formats.
Definition: v4l2_subdevice.h:61
@ TryFormat
The format operation applies to TRY formats.
Definition: v4l2_subdevice.h:60
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format, Whence whence=ActiveFormat)
Set an image format on one of the V4L2 subdevice pads.
Definition: v4l2_subdevice.cpp:555
const std::string & model()
Retrieve the model name of the device.
Definition: v4l2_subdevice.cpp:683
V4L2Subdevice(const MediaEntity *entity)
Create a V4L2 subdevice from a MediaEntity using its device node path.
Definition: v4l2_subdevice.cpp:328
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.cpp:520
int getRouting(Routing *routing, Whence whence=ActiveFormat)
Retrieve the subdevice's internal routing table.
Definition: v4l2_subdevice.cpp:597
const MediaEntity * entity() const
Retrieve the media entity associated with the subdevice.
Definition: v4l2_subdevice.h:75
Class and enums to represent color spaces.
Data structures related to geometric objects.
Top-level libcamera namespace.
Definition: backtrace.h:17
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition: geometry.cpp:91
struct v4l2_subdev_capability object wrapper and helpers
Definition: v4l2_subdevice.h:32
bool isReadOnly() const
Retrieve if a subdevice is registered as read-only.
Definition: v4l2_subdevice.h:33
bool hasStreams() const
Retrieve if a subdevice supports the V4L2 streams API.
Definition: v4l2_subdevice.h:37
Common base for V4L2 devices and subdevices.