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