Jayant Chowdhary | c67af1b | 2022-04-07 18:05:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 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 | #ifndef ANDROID_SERVERS_CAMERA_SESSION_CONFIGURATION_UTILS_HIDL_H |
| 17 | #define ANDROID_SERVERS_CAMERA_SESSION_CONFIGURATION_UTILS_HIDL_H |
| 18 | |
| 19 | #include <android/hardware/camera/device/3.8/types.h> |
| 20 | #include <android/hardware/camera/device/3.4/ICameraDeviceSession.h> |
| 21 | #include <android/hardware/camera/device/3.7/ICameraDeviceSession.h> |
| 22 | #include <android/hardware/camera/device/3.8/ICameraDeviceSession.h> |
| 23 | |
| 24 | #include <utils/SessionConfigurationUtils.h> |
| 25 | |
| 26 | // Convenience methods for constructing binder::Status objects for error returns |
| 27 | |
| 28 | namespace android { |
| 29 | namespace camera3 { |
| 30 | |
| 31 | namespace SessionConfigurationUtils { |
| 32 | |
| 33 | void mapStreamInfo(const camera3::OutputStreamInfo &streamInfo, |
| 34 | camera3::camera_stream_rotation_t rotation, String8 physicalId, int32_t groupId, |
| 35 | hardware::camera::device::V3_8::Stream *stream /*out*/); |
| 36 | |
| 37 | // utility function to convert AIDL SessionConfiguration to HIDL |
| 38 | // streamConfiguration. Also checks for validity of SessionConfiguration and |
| 39 | // returns a non-ok binder::Status if the passed in session configuration |
| 40 | // isn't valid. |
| 41 | binder::Status |
| 42 | convertToHALStreamCombination(const SessionConfiguration& sessionConfiguration, |
| 43 | const String8 &cameraId, const CameraMetadata &deviceInfo, |
| 44 | metadataGetter getMetadata, const std::vector<std::string> &physicalCameraIds, |
| 45 | hardware::camera::device::V3_8::StreamConfiguration &streamConfiguration, |
| 46 | bool overrideForPerfClass, bool *earlyExit); |
| 47 | |
| 48 | // Utility function to convert a V3_8::StreamConfiguration to |
| 49 | // V3_7::StreamConfiguration. Return false if the original V3_8 configuration cannot |
| 50 | // be used by older version HAL. |
| 51 | bool convertHALStreamCombinationFromV38ToV37( |
| 52 | hardware::camera::device::V3_7::StreamConfiguration &streamConfigV37, |
| 53 | const hardware::camera::device::V3_8::StreamConfiguration &streamConfigV38); |
| 54 | |
| 55 | // Utility function to convert a V3_7::StreamConfiguration to |
| 56 | // V3_4::StreamConfiguration. Return false if the original V3_7 configuration cannot |
| 57 | // be used by older version HAL. |
| 58 | bool convertHALStreamCombinationFromV37ToV34( |
| 59 | hardware::camera::device::V3_4::StreamConfiguration &streamConfigV34, |
| 60 | const hardware::camera::device::V3_7::StreamConfiguration &streamConfigV37); |
| 61 | } // SessionConfigurationUtils |
| 62 | } // camera3 |
| 63 | } // android |
| 64 | |
| 65 | #endif |