diff options
-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 |