blob: aa65cdf45ab2ee360b5f1b26c3b22688ee509e61 [file] [log] [blame]
Ari Hausman-Cohen73442152016-06-08 15:50:49 -07001/*
2 * Copyright 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#include "V4L2Camera.h"
18
19#include <camera/CameraMetadata.h>
20#include <hardware/camera3.h>
21
22#include "Common.h"
23
24namespace v4l2_camera_hal {
25
26V4L2Camera::V4L2Camera(int id, std::string path)
27 : default_camera_hal::Camera(id), mDevicePath(std::move(path)) {
28 HAL_LOG_ENTER();
29}
30
31V4L2Camera::~V4L2Camera() {
32 HAL_LOG_ENTER();
33}
34
35camera_metadata_t* V4L2Camera::initStaticInfo() {
36 HAL_LOG_ENTER();
37
38 android::CameraMetadata metadata(1);
39 // TODO(b/29214516): fill this in.
Ari Hausman-Cohen63f69822016-06-10 11:40:35 -070040 uint8_t scene_mode = ANDROID_CONTROL_SCENE_MODE_DISABLED;
41 metadata.update(ANDROID_CONTROL_AVAILABLE_SCENE_MODES, &scene_mode, 1);
42
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070043 return metadata.release();
44}
45
46void V4L2Camera::initDeviceInfo(camera_info_t* info) {
47 HAL_LOG_ENTER();
48
49 // For now, just constants.
50 info->facing = CAMERA_FACING_EXTERNAL;
51 info->orientation = 0;
52 info->resource_cost = 100;
53 info->conflicting_devices = nullptr;
54 info->conflicting_devices_length = 0;
55}
56
57int V4L2Camera::initDevice() {
58 HAL_LOG_ENTER();
59
60 // TODO(b/29221795): fill in templates, etc.
61 return 0;
62}
63
64bool V4L2Camera::isValidCaptureSettings(const camera_metadata_t* settings) {
65 HAL_LOG_ENTER();
66
67 // TODO(b): reject capture settings this camera isn't capable of.
68 return true;
69}
70
71} // namespace v4l2_camera_hal