/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2019, Google Inc. * * camera3_hal.cpp - Android Camera HALv3 module */ #include #include "camera_device.h" #include "camera_hal_manager.h" #include "log.h" using namespace libcamera; LOG_DEFINE_CATEGORY(HAL) static CameraHalManager cameraManager; /*------------------------------------------------------------------------------ * Android Camera HAL callbacks */ static int hal_get_number_of_cameras(void) { return cameraManager.numCameras(); } static int hal_get_camera_info(int id, struct camera_info *info) { return cameraManager.getCameraInfo(id, info); } static int hal_set_callbacks(const camera_module_callbacks_t *callbacks) { return 0; } static int hal_open_legacy(const struct hw_module_t *module, const char *id, uint32_t halVersion, struct hw_device_t **device) { return -ENOSYS; } static int hal_set_torch_mode(const char *camera_id, bool enabled) { return -ENOSYS; } /* * First entry point of the camera HAL module. * * Initialize the HAL but does not open any camera device yet (see hal_dev_open) */ static int hal_init() { LOG(HAL, Info) << "Initialising Android camera HAL"; cameraManager.init(); return 0; } /*------------------------------------------------------------------------------ * Android Camera Device */ static int hal_dev_open(const hw_module_t *module, const char *name, hw_device_t **device) { LOG(HAL, Debug) << "Open camera " << name; int id = atoi(name); CameraDevice *camera = cameraManager.open(id, module); if (!camera) { LOG(HAL, Error) << "Failed to open camera module '" << id << "'"; return -ENODEV; } *device = &camera->camera3Device()->common; return 0; } static struct hw_module_methods_t hal_module_methods = { .open = hal_dev_open, }; camera_module_t HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, .module_api_version = CAMERA_MODULE_API_VERSION_2_4, .hal_api_version = HARDWARE_HAL_API_VERSION, .id = CAMERA_HARDWARE_MODULE_ID, .name = "libcamera camera HALv3 module", .author = "libcamera", .methods = &hal_module_methods, .dso = nullptr, .reserved = {}, }, .get_number_of_cameras = hal_get_number_of_cameras, .get_camera_info = hal_get_camera_info, .set_callbacks = hal_set_callbacks, .get_vendor_tag_ops = nullptr, .open_legacy = hal_open_legacy, .set_torch_mode = hal_set_torch_mode, .init = hal_init, .reserved = {}, }; ee-run-upstreaming'>pfc/rkisp1-free-run-upstreaming Jacopo Mondi's clone of libcameragit repository hosting on libcamera.org
summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcameraprovider.cpp
blob: ee44dc734a74df4645d7eb32b84aaa3a3a1c561a (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238