libcamera: v4l2_videodevice: Support M2M devices

V4L2 M2M devices represent a V4L2Device with two queues: One output, and
one capture on a single device node.

Represent this by instantiating a V4L2VideoDevice for each queue type,
and preparing each device for its queue.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Kieran Bingham
2019-04-26 16:50:12 +02:00
parent 3a278eb460
commit 4f7625cca7
2 changed files with 219 additions and 1 deletions

View File

@@ -71,6 +71,11 @@ struct V4L2Capability final : v4l2_capability {
V4L2_CAP_VIDEO_OUTPUT |
V4L2_CAP_VIDEO_OUTPUT_MPLANE);
}
bool isM2M() const
{
return device_caps() & (V4L2_CAP_VIDEO_M2M |
V4L2_CAP_VIDEO_M2M_MPLANE);
}
bool isMeta() const
{
return device_caps() & (V4L2_CAP_META_CAPTURE |
@@ -124,6 +129,7 @@ public:
V4L2VideoDevice &operator=(const V4L2VideoDevice &) = delete;
int open();
int open(int handle, enum v4l2_buf_type type);
void close();
const char *driverName() const { return caps_.driver(); }
@@ -182,6 +188,25 @@ private:
EventNotifier *fdEvent_;
};
class V4L2M2MDevice
{
public:
V4L2M2MDevice(const std::string &deviceNode);
~V4L2M2MDevice();
int open();
void close();
V4L2VideoDevice *output() { return output_; }
V4L2VideoDevice *capture() { return capture_; }
private:
std::string deviceNode_;
V4L2VideoDevice *output_;
V4L2VideoDevice *capture_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_V4L2_VIDEODEVICE_H__ */