| Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame^] | 1 | /* | 
|  | 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> | 
|  | 31 | #include <hardware/camera.h> | 
|  | 32 |  | 
|  | 33 | namespace android { | 
|  | 34 | namespace hardware { | 
|  | 35 | namespace cameraservice { | 
|  | 36 | namespace utils { | 
|  | 37 | namespace conversion { | 
|  | 38 |  | 
|  | 39 | using hardware::camera2::impl::CaptureResultExtras; | 
|  | 40 | using hardware::camera2::impl::PhysicalCaptureResultInfo; | 
|  | 41 |  | 
|  | 42 | using HCameraMetadata = frameworks::cameraservice::service::V2_0::CameraMetadata; | 
|  | 43 | using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus; | 
|  | 44 | using HCameraStatusAndId = frameworks::cameraservice::service::V2_0::CameraStatusAndId; | 
|  | 45 | using HCameraDeviceUser = frameworks::cameraservice::device::V2_0::ICameraDeviceUser; | 
|  | 46 | using HCaptureResultExtras = frameworks::cameraservice::device::V2_0::CaptureResultExtras; | 
|  | 47 | using HCaptureRequest = frameworks::cameraservice::device::V2_0::CaptureRequest; | 
|  | 48 | using HErrorCode = frameworks::cameraservice::device::V2_0::ErrorCode; | 
|  | 49 | using HGraphicBufferProducer = hardware::graphics::bufferqueue::V1_0::IGraphicBufferProducer; | 
|  | 50 | using HOutputConfiguration = frameworks::cameraservice::device::V2_0::OutputConfiguration; | 
|  | 51 | using HPhysicalCameraSettings = frameworks::cameraservice::device::V2_0::PhysicalCameraSettings; | 
|  | 52 | using HPhysicalCaptureResultInfo = frameworks::cameraservice::device::V2_0::PhysicalCaptureResultInfo; | 
|  | 53 | using HSubmitInfo = frameworks::cameraservice::device::V2_0::SubmitInfo; | 
|  | 54 | using HStatus = frameworks::cameraservice::common::V2_0::Status; | 
|  | 55 | using HStreamConfigurationMode = frameworks::cameraservice::device::V2_0::StreamConfigurationMode; | 
|  | 56 | using HTemplateId = frameworks::cameraservice::device::V2_0::TemplateId; | 
|  | 57 |  | 
|  | 58 | // Note: existing data in dst will be gone. Caller still owns the memory of src | 
|  | 59 | void convertToHidl(const camera_metadata_t *src, HCameraMetadata* dst); | 
|  | 60 |  | 
|  | 61 | int32_t convertFromHidl(HStreamConfigurationMode streamConfigurationMode); | 
|  | 62 |  | 
|  | 63 | int32_t convertFromHidl(HTemplateId templateId); | 
|  | 64 |  | 
|  | 65 | bool convertFromHidl(const HCameraMetadata &src, CameraMetadata *dst); | 
|  | 66 |  | 
|  | 67 | hardware::camera2::params::OutputConfiguration convertFromHidl( | 
|  | 68 | const HOutputConfiguration &hOutputConfiguration); | 
|  | 69 |  | 
|  | 70 | HCameraDeviceStatus convertToHidlCameraDeviceStatus(int32_t status); | 
|  | 71 |  | 
|  | 72 | void convertToHidl(const std::vector<hardware::CameraStatus> &src, | 
|  | 73 | hidl_vec<HCameraStatusAndId>* dst); | 
|  | 74 |  | 
|  | 75 | void convertToHidl(const hardware::camera2::utils::SubmitInfo &submitInfo, | 
|  | 76 | HSubmitInfo *hSubmitInfo); | 
|  | 77 |  | 
|  | 78 | HErrorCode convertToHidl(int32_t errorCode); | 
|  | 79 |  | 
|  | 80 | HCaptureResultExtras convertToHidl(const CaptureResultExtras &captureResultExtras); | 
|  | 81 |  | 
|  | 82 | HStatus B2HStatus(const binder::Status &bStatus); | 
|  | 83 |  | 
|  | 84 | } // conversion | 
|  | 85 | } // utils | 
|  | 86 | } // cameraservice | 
|  | 87 | } // hardware | 
|  | 88 | } //android | 
|  | 89 |  | 
|  | 90 | #endif //CAMERASERVER_CONVERT_TO_HIDL |