blob: 79683f6b00f98885bb1696bf5ea8de1cdc196888 [file] [log] [blame]
Jayant Chowdharybe543d42018-08-15 13:16:14 -07001/*
2 * Copyright (C) 2018 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 CAMERASERVER_CONVERT_HIDL
18#define CAMERASERVER_CONVERT_HIDL
19
20#include <vector>
21
22#include <android/frameworks/cameraservice/service/2.0/ICameraService.h>
23#include <android/frameworks/cameraservice/device/2.0/ICameraDeviceUser.h>
24#include <android/frameworks/cameraservice/common/2.0/types.h>
25#include <android/frameworks/cameraservice/service/2.0/types.h>
26#include <android/frameworks/cameraservice/device/2.0/types.h>
27#include <android/hardware/camera/common/1.0/types.h>
28#include <android/hardware/camera2/ICameraDeviceUser.h>
29#include <android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer.h>
30#include <android/hardware/ICameraService.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070031#include <fmq/MessageQueue.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070032#include <hardware/camera.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070033#include <hidl/MQDescriptor.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070034
35namespace android {
36namespace hardware {
37namespace cameraservice {
38namespace utils {
39namespace conversion {
40
41using hardware::camera2::impl::CaptureResultExtras;
42using hardware::camera2::impl::PhysicalCaptureResultInfo;
43
Jayant Chowdhary0c947272018-08-15 14:42:04 -070044using CaptureResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070045using HCameraMetadata = frameworks::cameraservice::service::V2_0::CameraMetadata;
46using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
47using HCameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId;
48using HCameraDeviceUser = frameworks::cameraservice::device::V2_0::ICameraDeviceUser;
49using HCaptureResultExtras = frameworks::cameraservice::device::V2_0::CaptureResultExtras;
50using HCaptureRequest = frameworks::cameraservice::device::V2_0::CaptureRequest;
51using HErrorCode = frameworks::cameraservice::device::V2_0::ErrorCode;
52using HGraphicBufferProducer = hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
53using HOutputConfiguration = frameworks::cameraservice::device::V2_0::OutputConfiguration;
54using HPhysicalCameraSettings = frameworks::cameraservice::device::V2_0::PhysicalCameraSettings;
55using HPhysicalCaptureResultInfo = frameworks::cameraservice::device::V2_0::PhysicalCaptureResultInfo;
Shuzhen Wang24810e72019-03-18 10:55:01 -070056using HSessionConfiguration = frameworks::cameraservice::device::V2_0::SessionConfiguration;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070057using HSubmitInfo = frameworks::cameraservice::device::V2_0::SubmitInfo;
58using HStatus = frameworks::cameraservice::common::V2_0::Status;
59using HStreamConfigurationMode = frameworks::cameraservice::device::V2_0::StreamConfigurationMode;
60using HTemplateId = frameworks::cameraservice::device::V2_0::TemplateId;
61
62// Note: existing data in dst will be gone. Caller still owns the memory of src
63void convertToHidl(const camera_metadata_t *src, HCameraMetadata* dst);
64
65int32_t convertFromHidl(HStreamConfigurationMode streamConfigurationMode);
66
67int32_t convertFromHidl(HTemplateId templateId);
68
69bool convertFromHidl(const HCameraMetadata &src, CameraMetadata *dst);
70
71hardware::camera2::params::OutputConfiguration convertFromHidl(
72 const HOutputConfiguration &hOutputConfiguration);
73
Shuzhen Wang24810e72019-03-18 10:55:01 -070074hardware::camera2::params::SessionConfiguration convertFromHidl(
75 const HSessionConfiguration &hSessionConfiguration);
76
Jayant Chowdharybe543d42018-08-15 13:16:14 -070077HCameraDeviceStatus convertToHidlCameraDeviceStatus(int32_t status);
78
79void convertToHidl(const std::vector<hardware::CameraStatus> &src,
80 hidl_vec<HCameraStatusAndId>* dst);
81
82void convertToHidl(const hardware::camera2::utils::SubmitInfo &submitInfo,
83 HSubmitInfo *hSubmitInfo);
84
85HErrorCode convertToHidl(int32_t errorCode);
86
87HCaptureResultExtras convertToHidl(const CaptureResultExtras &captureResultExtras);
88
Jayant Chowdhary0c947272018-08-15 14:42:04 -070089hidl_vec<HPhysicalCaptureResultInfo> convertToHidl(
90 const std::vector<PhysicalCaptureResultInfo> &physicalCaptureResultInfos,
91 std::shared_ptr<CaptureResultMetadataQueue> &captureResultMetadataQueue);
92
Jayant Chowdharybe543d42018-08-15 13:16:14 -070093HStatus B2HStatus(const binder::Status &bStatus);
94
95} // conversion
96} // utils
97} // cameraservice
98} // hardware
99} //android
100
101#endif //CAMERASERVER_CONVERT_TO_HIDL