summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_compat_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/v4l2/v4l2_compat_manager.h')
-rw-r--r--src/v4l2/v4l2_compat_manager.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/v4l2/v4l2_compat_manager.h b/src/v4l2/v4l2_compat_manager.h
index 872c7c3b..f7c6f122 100644
--- a/src/v4l2/v4l2_compat_manager.h
+++ b/src/v4l2/v4l2_compat_manager.h
@@ -1,12 +1,11 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
- * v4l2_compat_manager.h - V4L2 compatibility manager
+ * V4L2 compatibility manager
*/
-#ifndef __V4L2_COMPAT_MANAGER_H__
-#define __V4L2_COMPAT_MANAGER_H__
+#pragma once
#include <fcntl.h>
#include <map>
@@ -18,8 +17,6 @@
#include "v4l2_camera_proxy.h"
-using namespace libcamera;
-
class V4L2CompatManager
{
public:
@@ -30,7 +27,7 @@ public:
using close_func_t = int (*)(int fd);
using ioctl_func_t = int (*)(int fd, unsigned long request, ...);
using mmap_func_t = void *(*)(void *addr, size_t length, int prot,
- int flags, int fd, off_t offset);
+ int flags, int fd, off64_t offset);
using munmap_func_t = int (*)(void *addr, size_t length);
openat_func_t openat;
@@ -43,7 +40,6 @@ public:
static V4L2CompatManager *instance();
- V4L2CameraProxy *getProxy(int fd);
const FileOperations &fops() const { return fops_; }
int openat(int dirfd, const char *path, int oflag, mode_t mode);
@@ -51,7 +47,7 @@ public:
int dup(int oldfd);
int close(int fd);
void *mmap(void *addr, size_t length, int prot, int flags,
- int fd, off_t offset);
+ int fd, off64_t offset);
int munmap(void *addr, size_t length);
int ioctl(int fd, unsigned long request, void *arg);
@@ -61,14 +57,13 @@ private:
int start();
int getCameraIndex(int fd);
+ std::shared_ptr<V4L2CameraFile> cameraFile(int fd);
FileOperations fops_;
- CameraManager *cm_;
+ libcamera::CameraManager *cm_;
std::vector<std::unique_ptr<V4L2CameraProxy>> proxies_;
- std::map<int, V4L2CameraProxy *> devices_;
- std::map<void *, V4L2CameraProxy *> mmaps_;
+ std::map<int, std::shared_ptr<V4L2CameraFile>> files_;
+ std::map<void *, std::shared_ptr<V4L2CameraFile>> mmaps_;
};
-
-#endif /* __V4L2_COMPAT_MANAGER_H__ */