summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_proxy.h
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-22 18:42:07 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-25 23:41:19 +0900
commitedacd07c5e9a5080628e7cc4d057674f7f742ead (patch)
treedc9b1f11d0d0758e4622364f6353b4cda7627ee8 /src/v4l2/v4l2_camera_proxy.h
parentd37ec82515fda4ae014d904e6d50cd0ed0ada850 (diff)
v4l2: V4L2CameraProxy: Take V4L2CameraFile as argument for intercepted calls
Prepare for using the V4L2CameraFile as a container for file-specific information in the V4L2 compatibility layer by making it a required argument for all V4L2CameraProxy calls that are directed from V4L2CompatManager, which are intercepted via LD_PRELOAD. Change V4L2CameraFile accordingly. Also change V4L2CompatManager accordingly. Instead of keeping a map of file descriptors to V4L2CameraProxy instances, we keep a map of V4L2CameraFile instances to V4L2CameraProxy instances. When the proxy methods are called, feed the file as a parameter. The dup function is also modified, in that it is removed from V4L2CameraProxy, and is handled completely in V4L2CompatManager, as a map from file descriptors to V4L2CameraFile instances. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.h')
-rw-r--r--src/v4l2/v4l2_camera_proxy.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h
index 27d3e507..b2197ef8 100644
--- a/src/v4l2/v4l2_camera_proxy.h
+++ b/src/v4l2/v4l2_camera_proxy.h
@@ -21,20 +21,20 @@
using namespace libcamera;
+class V4L2CameraFile;
+
class V4L2CameraProxy
{
public:
V4L2CameraProxy(unsigned int index, std::shared_ptr<Camera> camera);
- int open(bool nonBlocking);
- void dup();
- void close();
+ int open(V4L2CameraFile *file);
+ void close(V4L2CameraFile *file);
void *mmap(void *addr, size_t length, int prot, int flags, off64_t offset);
int munmap(void *addr, size_t length);
- int ioctl(unsigned long request, void *arg);
-
void bind(int fd);
+ int ioctl(V4L2CameraFile *file, unsigned long request, void *arg);
private:
bool validateBufferType(uint32_t type);
@@ -47,16 +47,16 @@ private:
int freeBuffers();
int vidioc_querycap(struct v4l2_capability *arg);
- int vidioc_enum_fmt(struct v4l2_fmtdesc *arg);
- int vidioc_g_fmt(struct v4l2_format *arg);
- int vidioc_s_fmt(struct v4l2_format *arg);
- int vidioc_try_fmt(struct v4l2_format *arg);
- int vidioc_reqbufs(struct v4l2_requestbuffers *arg);
- int vidioc_querybuf(struct v4l2_buffer *arg);
- int vidioc_qbuf(struct v4l2_buffer *arg);
- int vidioc_dqbuf(struct v4l2_buffer *arg);
- int vidioc_streamon(int *arg);
- int vidioc_streamoff(int *arg);
+ int vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc *arg);
+ int vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
+ int vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
+ int vidioc_try_fmt(V4L2CameraFile *file, struct v4l2_format *arg);
+ int vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuffers *arg);
+ int vidioc_querybuf(V4L2CameraFile *file, struct v4l2_buffer *arg);
+ int vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg);
+ int vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg);
+ int vidioc_streamon(V4L2CameraFile *file, int *arg);
+ int vidioc_streamoff(V4L2CameraFile *file, int *arg);
static unsigned int bplMultiplier(uint32_t format);
static unsigned int imageSize(uint32_t format, unsigned int width,
@@ -67,7 +67,6 @@ private:
unsigned int refcount_;
unsigned int index_;
- bool nonBlocking_;
struct v4l2_format curV4L2Format_;
StreamConfiguration streamConfig_;