blob: 82ffc48c2109bf3a37a62ee1fd0d33d1a909251e [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>
Shuzhen Wang4fa28d22020-01-23 15:57:25 -080026#include <android/frameworks/cameraservice/service/2.1/types.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070027#include <android/frameworks/cameraservice/device/2.0/types.h>
28#include <android/hardware/camera/common/1.0/types.h>
29#include <android/hardware/camera2/ICameraDeviceUser.h>
30#include <android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer.h>
31#include <android/hardware/ICameraService.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070032#include <fmq/MessageQueue.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070033#include <hardware/camera.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070034#include <hidl/MQDescriptor.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070035
36namespace android {
37namespace hardware {
38namespace cameraservice {
39namespace utils {
40namespace conversion {
41
42using hardware::camera2::impl::CaptureResultExtras;
43using hardware::camera2::impl::PhysicalCaptureResultInfo;
44
Jayant Chowdhary0c947272018-08-15 14:42:04 -070045using CaptureResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070046using HCameraMetadata = frameworks::cameraservice::service::V2_0::CameraMetadata;
47using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
48using HCameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId;
49using HCameraDeviceUser = frameworks::cameraservice::device::V2_0::ICameraDeviceUser;
50using HCaptureResultExtras = frameworks::cameraservice::device::V2_0::CaptureResultExtras;
51using HCaptureRequest = frameworks::cameraservice::device::V2_0::CaptureRequest;
52using HErrorCode = frameworks::cameraservice::device::V2_0::ErrorCode;
53using HGraphicBufferProducer = hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
54using HOutputConfiguration = frameworks::cameraservice::device::V2_0::OutputConfiguration;
55using HPhysicalCameraSettings = frameworks::cameraservice::device::V2_0::PhysicalCameraSettings;
56using HPhysicalCaptureResultInfo = frameworks::cameraservice::device::V2_0::PhysicalCaptureResultInfo;
Shuzhen Wang24810e72019-03-18 10:55:01 -070057using HSessionConfiguration = frameworks::cameraservice::device::V2_0::SessionConfiguration;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070058using HSubmitInfo = frameworks::cameraservice::device::V2_0::SubmitInfo;
59using HStatus = frameworks::cameraservice::common::V2_0::Status;
60using HStreamConfigurationMode = frameworks::cameraservice::device::V2_0::StreamConfigurationMode;
61using HTemplateId = frameworks::cameraservice::device::V2_0::TemplateId;
62
63// Note: existing data in dst will be gone. Caller still owns the memory of src
64void convertToHidl(const camera_metadata_t *src, HCameraMetadata* dst);
65
66int32_t convertFromHidl(HStreamConfigurationMode streamConfigurationMode);
67
68int32_t convertFromHidl(HTemplateId templateId);
69
70bool convertFromHidl(const HCameraMetadata &src, CameraMetadata *dst);
71
72hardware::camera2::params::OutputConfiguration convertFromHidl(
73 const HOutputConfiguration &hOutputConfiguration);
74
Shuzhen Wang24810e72019-03-18 10:55:01 -070075hardware::camera2::params::SessionConfiguration convertFromHidl(
76 const HSessionConfiguration &hSessionConfiguration);
77
Jayant Chowdharybe543d42018-08-15 13:16:14 -070078HCameraDeviceStatus convertToHidlCameraDeviceStatus(int32_t status);
79
80void convertToHidl(const std::vector<hardware::CameraStatus> &src,
81 hidl_vec<HCameraStatusAndId>* dst);
82
Shuzhen Wang4fa28d22020-01-23 15:57:25 -080083void convertToHidl(const std::vector<hardware::CameraStatus> &src,
84 hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId>* dst);
85
Jayant Chowdharybe543d42018-08-15 13:16:14 -070086void convertToHidl(const hardware::camera2::utils::SubmitInfo &submitInfo,
87 HSubmitInfo *hSubmitInfo);
88
89HErrorCode convertToHidl(int32_t errorCode);
90
91HCaptureResultExtras convertToHidl(const CaptureResultExtras &captureResultExtras);
92
Jayant Chowdhary0c947272018-08-15 14:42:04 -070093hidl_vec<HPhysicalCaptureResultInfo> convertToHidl(
94 const std::vector<PhysicalCaptureResultInfo> &physicalCaptureResultInfos,
95 std::shared_ptr<CaptureResultMetadataQueue> &captureResultMetadataQueue);
96
Jayant Chowdharybe543d42018-08-15 13:16:14 -070097HStatus B2HStatus(const binder::Status &bStatus);
98
99} // conversion
100} // utils
101} // cameraservice
102} // hardware
103} //android
104
105#endif //CAMERASERVER_CONVERT_TO_HIDL