summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/v4l2_subdevice.h58
1 files changed, 52 insertions, 6 deletions
diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
index 1115cfa5..6cd36730 100644
--- a/include/libcamera/internal/v4l2_subdevice.h
+++ b/include/libcamera/internal/v4l2_subdevice.h
@@ -80,6 +80,21 @@ public:
ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE,
};
+ struct Stream {
+ Stream()
+ : pad(0), stream(0)
+ {
+ }
+
+ Stream(unsigned int p, unsigned int s)
+ : pad(p), stream(s)
+ {
+ }
+
+ unsigned int pad;
+ unsigned int stream;
+ };
+
class Routing : public std::vector<struct v4l2_subdev_route>
{
public:
@@ -93,17 +108,39 @@ public:
const MediaEntity *entity() const { return entity_; }
- int getSelection(unsigned int pad, unsigned int target,
+ int getSelection(const Stream &stream, unsigned int target,
Rectangle *rect);
- int setSelection(unsigned int pad, unsigned int target,
+ int getSelection(unsigned int pad, unsigned int target, Rectangle *rect)
+ {
+ return getSelection({ pad, 0 }, target, rect);
+ }
+ int setSelection(const Stream &stream, unsigned int target,
Rectangle *rect);
+ int setSelection(unsigned int pad, unsigned int target, Rectangle *rect)
+ {
+ return setSelection({ pad, 0 }, target, rect);
+ }
- Formats formats(unsigned int pad);
+ Formats formats(const Stream &stream);
+ Formats formats(unsigned int pad)
+ {
+ return formats({ pad, 0 });
+ }
+ int getFormat(const Stream &stream, V4L2SubdeviceFormat *format,
+ Whence whence = ActiveFormat);
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format,
+ Whence whence = ActiveFormat)
+ {
+ return getFormat({ pad, 0 }, format, whence);
+ }
+ int setFormat(const Stream &stream, V4L2SubdeviceFormat *format,
Whence whence = ActiveFormat);
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format,
- Whence whence = ActiveFormat);
+ Whence whence = ActiveFormat)
+ {
+ return setFormat({ pad, 0 }, format, whence);
+ }
int getRouting(Routing *routing, Whence whence = ActiveFormat);
int setRouting(Routing *routing, Whence whence = ActiveFormat);
@@ -123,8 +160,8 @@ private:
std::optional<ColorSpace>
toColorSpace(const v4l2_mbus_framefmt &format) const;
- std::vector<unsigned int> enumPadCodes(unsigned int pad);
- std::vector<SizeRange> enumPadSizes(unsigned int pad,
+ std::vector<unsigned int> enumPadCodes(const Stream &stream);
+ std::vector<SizeRange> enumPadSizes(const Stream &stream,
unsigned int code);
const MediaEntity *entity_;
@@ -133,4 +170,13 @@ private:
struct V4L2SubdeviceCapability caps_;
};
+bool operator==(const V4L2Subdevice::Stream &lhs, const V4L2Subdevice::Stream &rhs);
+static inline bool operator!=(const V4L2Subdevice::Stream &lhs,
+ const V4L2Subdevice::Stream &rhs)
+{
+ return !(lhs == rhs);
+}
+
+std::ostream &operator<<(std::ostream &out, const V4L2Subdevice::Stream &stream);
+
} /* namespace libcamera */