xref: /aosp_15_r20/hardware/libhardware/modules/usbcamera/UsbCamera.h (revision e01b6f769022e40d0923dee176e8dc7cd1d52984)
1*e01b6f76SAndroid Build Coastguard Worker /*
2*e01b6f76SAndroid Build Coastguard Worker  * Copyright (C) 2015 The Android Open Source Project
3*e01b6f76SAndroid Build Coastguard Worker  *
4*e01b6f76SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*e01b6f76SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*e01b6f76SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*e01b6f76SAndroid Build Coastguard Worker  *
8*e01b6f76SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*e01b6f76SAndroid Build Coastguard Worker  *
10*e01b6f76SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*e01b6f76SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*e01b6f76SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*e01b6f76SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*e01b6f76SAndroid Build Coastguard Worker  * limitations under the License.
15*e01b6f76SAndroid Build Coastguard Worker  */
16*e01b6f76SAndroid Build Coastguard Worker 
17*e01b6f76SAndroid Build Coastguard Worker #ifndef EXAMPLE_CAMERA_H_
18*e01b6f76SAndroid Build Coastguard Worker #define EXAMPLE_CAMERA_H_
19*e01b6f76SAndroid Build Coastguard Worker 
20*e01b6f76SAndroid Build Coastguard Worker #include <system/camera_metadata.h>
21*e01b6f76SAndroid Build Coastguard Worker #include "Camera.h"
22*e01b6f76SAndroid Build Coastguard Worker 
23*e01b6f76SAndroid Build Coastguard Worker namespace usb_camera_hal {
24*e01b6f76SAndroid Build Coastguard Worker /**
25*e01b6f76SAndroid Build Coastguard Worker  * UsbCamera is an example for a specific camera device. The Camera instance contains
26*e01b6f76SAndroid Build Coastguard Worker  * a specific camera device (e.g. UsbCamera) holds all specific metadata and logic about
27*e01b6f76SAndroid Build Coastguard Worker  * that device.
28*e01b6f76SAndroid Build Coastguard Worker  */
29*e01b6f76SAndroid Build Coastguard Worker class UsbCamera : public Camera {
30*e01b6f76SAndroid Build Coastguard Worker     public:
31*e01b6f76SAndroid Build Coastguard Worker         explicit UsbCamera(int id);
32*e01b6f76SAndroid Build Coastguard Worker         ~UsbCamera();
33*e01b6f76SAndroid Build Coastguard Worker 
34*e01b6f76SAndroid Build Coastguard Worker     private:
35*e01b6f76SAndroid Build Coastguard Worker         // Initialize static camera characteristics for individual device
36*e01b6f76SAndroid Build Coastguard Worker         int initStaticInfo();
37*e01b6f76SAndroid Build Coastguard Worker         int openDevice();
38*e01b6f76SAndroid Build Coastguard Worker         // Initialize whole device (templates/etc) when opened
39*e01b6f76SAndroid Build Coastguard Worker         int initDevice();
40*e01b6f76SAndroid Build Coastguard Worker         int flushDevice();
41*e01b6f76SAndroid Build Coastguard Worker         int closeDevice();
42*e01b6f76SAndroid Build Coastguard Worker         int processCaptureBuffer(const camera3_stream_buffer_t *in, camera3_stream_buffer_t *out);
43*e01b6f76SAndroid Build Coastguard Worker         // Initialize each template metadata controls
44*e01b6f76SAndroid Build Coastguard Worker         int initPreviewTemplate(Metadata m);
45*e01b6f76SAndroid Build Coastguard Worker         int initStillTemplate(Metadata m);
46*e01b6f76SAndroid Build Coastguard Worker         int initRecordTemplate(Metadata m);
47*e01b6f76SAndroid Build Coastguard Worker         int initSnapshotTemplate(Metadata m);
48*e01b6f76SAndroid Build Coastguard Worker         int initZslTemplate(Metadata m);
49*e01b6f76SAndroid Build Coastguard Worker         int initManualTemplate(Metadata m);
50*e01b6f76SAndroid Build Coastguard Worker         // Verify settings are valid for a capture with this device
51*e01b6f76SAndroid Build Coastguard Worker         bool isValidCaptureSettings(const camera_metadata_t* settings);
52*e01b6f76SAndroid Build Coastguard Worker };
53*e01b6f76SAndroid Build Coastguard Worker } // namespace usb_camera_hal
54*e01b6f76SAndroid Build Coastguard Worker 
55*e01b6f76SAndroid Build Coastguard Worker #endif // CAMERA_H_
56