blob: 15297560c0e70e28b848182d610879161487dc9e [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.
40 return metadata.release();
41}
42
43void V4L2Camera::initDeviceInfo(camera_info_t* info) {
44 HAL_LOG_ENTER();
45
46 // For now, just constants.
47 info->facing = CAMERA_FACING_EXTERNAL;
48 info->orientation = 0;
49 info->resource_cost = 100;
50 info->conflicting_devices = nullptr;
51 info->conflicting_devices_length = 0;
52}
53
54int V4L2Camera::initDevice() {
55 HAL_LOG_ENTER();
56
57 // TODO(b/29221795): fill in templates, etc.
58 return 0;
59}
60
61bool V4L2Camera::isValidCaptureSettings(const camera_metadata_t* settings) {
62 HAL_LOG_ENTER();
63
64 // TODO(b): reject capture settings this camera isn't capable of.
65 return true;
66}
67
68} // namespace v4l2_camera_hal