blob: 4ac9cc4014d93adf622479ee2c3e6529f4f69ec8 [file] [log] [blame]
Ari Hausman-Cohen73442152016-06-08 15:50:49 -07001/*
2 * Copyright (C) 2016 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// Loosely based on hardware/libhardware/modules/camera/ExampleCamera.h
18
19#ifndef V4L2_CAMERA_H
20#define V4L2_CAMERA_H
21
22#include <string>
23
24#include <system/camera_metadata.h>
25#include "Camera.h"
26#include "Common.h"
27
28namespace v4l2_camera_hal {
29// V4L2Camera is a specific V4L2-supported camera device. The Camera object
30// contains all logic common between all cameras (e.g. front and back cameras),
31// while a specific camera device (e.g. V4L2Camera) holds all specific
32// metadata and logic about that device.
33class V4L2Camera : public default_camera_hal::Camera {
34public:
35 V4L2Camera(int id, const std::string path);
36 ~V4L2Camera();
37
38private:
39 // default_camera_hal::Camera virtual methods.
40 // Initialize static camera characteristics for individual device.
41 camera_metadata_t *initStaticInfo();
42 // Initialize device info: facing, orientation, resource cost,
43 // and conflicting devices (/conflicting devices length).
44 void initDeviceInfo(camera_info_t* info);
45 // Initialize whole device (templates/etc) when opened.
46 int initDevice();
47 // Verify settings are valid for a capture with this device.
48 bool isValidCaptureSettings(const camera_metadata_t* settings);
49
50 // The camera device path. For example, /dev/video0.
51 const std::string mDevicePath;
52
53 DISALLOW_COPY_AND_ASSIGN(V4L2Camera);
54};
55
56} // namespace v4l2_camera_hal
57
58#endif // V4L2_CAMERA_H