blob: ec06571ffe4d81a8eef9fa602bf7b4825e441a59 [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 Chowdhary2f686522022-05-09 14:52:16 +000032#include <camera/CameraMetadata.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070033#include <fmq/MessageQueue.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070034#include <hardware/camera.h>
Jayant Chowdhary0c947272018-08-15 14:42:04 -070035#include <hidl/MQDescriptor.h>
Jayant Chowdharybe543d42018-08-15 13:16:14 -070036
37namespace android {
38namespace hardware {
39namespace cameraservice {
40namespace utils {
41namespace conversion {
42
43using hardware::camera2::impl::CaptureResultExtras;
44using hardware::camera2::impl::PhysicalCaptureResultInfo;
45
Jayant Chowdhary0c947272018-08-15 14:42:04 -070046using CaptureResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070047using HCameraMetadata = frameworks::cameraservice::service::V2_0::CameraMetadata;
48using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
49using HCameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId;
50using HCameraDeviceUser = frameworks::cameraservice::device::V2_0::ICameraDeviceUser;
51using HCaptureResultExtras = frameworks::cameraservice::device::V2_0::CaptureResultExtras;
52using HCaptureRequest = frameworks::cameraservice::device::V2_0::CaptureRequest;
53using HErrorCode = frameworks::cameraservice::device::V2_0::ErrorCode;
54using HGraphicBufferProducer = hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer;
55using HOutputConfiguration = frameworks::cameraservice::device::V2_0::OutputConfiguration;
56using HPhysicalCameraSettings = frameworks::cameraservice::device::V2_0::PhysicalCameraSettings;
57using HPhysicalCaptureResultInfo = frameworks::cameraservice::device::V2_0::PhysicalCaptureResultInfo;
Shuzhen Wang24810e72019-03-18 10:55:01 -070058using HSessionConfiguration = frameworks::cameraservice::device::V2_0::SessionConfiguration;
Jayant Chowdharybe543d42018-08-15 13:16:14 -070059using HSubmitInfo = frameworks::cameraservice::device::V2_0::SubmitInfo;
60using HStatus = frameworks::cameraservice::common::V2_0::Status;
61using HStreamConfigurationMode = frameworks::cameraservice::device::V2_0::StreamConfigurationMode;
62using HTemplateId = frameworks::cameraservice::device::V2_0::TemplateId;
63
64// Note: existing data in dst will be gone. Caller still owns the memory of src
65void convertToHidl(const camera_metadata_t *src, HCameraMetadata* dst);
66
67int32_t convertFromHidl(HStreamConfigurationMode streamConfigurationMode);
68
69int32_t convertFromHidl(HTemplateId templateId);
70
71bool convertFromHidl(const HCameraMetadata &src, CameraMetadata *dst);
72
73hardware::camera2::params::OutputConfiguration convertFromHidl(
74 const HOutputConfiguration &hOutputConfiguration);
75
Shuzhen Wang24810e72019-03-18 10:55:01 -070076hardware::camera2::params::SessionConfiguration convertFromHidl(
77 const HSessionConfiguration &hSessionConfiguration);
78
Jayant Chowdharybe543d42018-08-15 13:16:14 -070079HCameraDeviceStatus convertToHidlCameraDeviceStatus(int32_t status);
80
81void convertToHidl(const std::vector<hardware::CameraStatus> &src,
82 hidl_vec<HCameraStatusAndId>* dst);
83
Shuzhen Wang4fa28d22020-01-23 15:57:25 -080084void convertToHidl(const std::vector<hardware::CameraStatus> &src,
85 hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId>* dst);
86
Jayant Chowdharybe543d42018-08-15 13:16:14 -070087void convertToHidl(const hardware::camera2::utils::SubmitInfo &submitInfo,
88 HSubmitInfo *hSubmitInfo);
89
90HErrorCode convertToHidl(int32_t errorCode);
91
92HCaptureResultExtras convertToHidl(const CaptureResultExtras &captureResultExtras);
93
Jayant Chowdhary0c947272018-08-15 14:42:04 -070094hidl_vec<HPhysicalCaptureResultInfo> convertToHidl(
95 const std::vector<PhysicalCaptureResultInfo> &physicalCaptureResultInfos,
96 std::shared_ptr<CaptureResultMetadataQueue> &captureResultMetadataQueue);
97
Jayant Chowdharybe543d42018-08-15 13:16:14 -070098HStatus B2HStatus(const binder::Status &bStatus);
99
Jayant Chowdharybe543d42018-08-15 13:16:14 -0700100} // conversion
101} // utils
102} // cameraservice
103} // hardware
104} //android
105
106#endif //CAMERASERVER_CONVERT_TO_HIDL