diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-07-26 11:48:53 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-07-31 15:43:55 +0200 |
commit | 5bcd5bb6ca6a0101d767192d53d1bfb62b82df49 (patch) | |
tree | e9afdb1d4a9cd59ada89971570f018beb21b6cf8 | |
parent | 4565f34764585254b24eb7eb03d717a9000c7a03 (diff) |
libcamera: v4l2: Add bind context
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
-rw-r--r-- | include/libcamera/internal/v4l2_videodevice.h | 2 | ||||
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index d077f958..2583001f 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -204,6 +204,8 @@ public: const V4L2Capability &caps() const { return caps_; } + int bindContext(unsigned int context); + int getFormat(V4L2DeviceFormat *format); int tryFormat(V4L2DeviceFormat *format); int setFormat(V4L2DeviceFormat *format); diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 03ce5df0..a1d9f0ce 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -796,6 +796,18 @@ std::string V4L2VideoDevice::logPrefix() const (V4L2_TYPE_IS_OUTPUT(bufferType_) ? ":out]" : ":cap]"); } +int V4L2VideoDevice::bindContext(unsigned int context) +{ + struct v4l2_context c = {}; + + c.context_fd = context; + int ret = ioctl(VIDIOC_BIND_CONTEXT, &c); + if (ret) + LOG(V4L2, Error) << "Unable to bind context: " << strerror(-ret); + + return ret; +} + /** * \brief Retrieve the image format set on the V4L2 video device * \param[out] format The image format applied on the video device |