blob: 92a79abb9e21f8edf8e89f1ae7f2dd7c7c251423 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* v4l2_camera_proxy.h - Proxy to V4L2 compatibility camera
*/
#ifndef __V4L2_CAMERA_PROXY_H__
#define __V4L2_CAMERA_PROXY_H__
#include <linux/videodev2.h>
#include <map>
#include <memory>
#include <set>
#include <sys/mman.h>
#include <sys/types.h>
#include <vector>
#include <libcamera/camera.h>
#include "v4l2_camera.h"
using namespace libcamera;
class V4L2CameraFile;
class V4L2CameraProxy
{
public:
V4L2CameraProxy(unsigned int index, std::shared_ptr<Camera> camera);
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(V4L2CameraFile *file, unsigned long request, void *arg);
private:
bool validateBufferType(uint32_t type);
bool validateMemoryType(uint32_t memory);
void setFmtFromConfig(const StreamConfiguration &streamConfig);
void querycap(std::shared_ptr<Camera> camera);
int tryFormat(struct v4l2_format *arg);
enum v4l2_priority maxPriority();
|