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.4/ICameraDeviceSession.h>
20 #include <android/hardware/camera/device/3.7/ICameraDeviceSession.h>
21 
22 #include <utils/SessionConfigurationUtils.h>
23 
24 // Convenience methods for constructing binder::Status objects for error returns
25 
26 namespace android {
27 namespace camera3 {
28 
29 namespace SessionConfigurationUtils {
30 
31 // utility function to convert AIDL SessionConfiguration to HIDL
32 // streamConfiguration. Also checks for validity of SessionConfiguration and
33 // returns a non-ok binder::Status if the passed in session configuration
34 // isn't valid.
35 binder::Status
36 convertToHALStreamCombination(const SessionConfiguration& sessionConfiguration,
37         const std::string &cameraId, const CameraMetadata &deviceInfo,
38         metadataGetter getMetadata, const std::vector<std::string> &physicalCameraIds,
39         hardware::camera::device::V3_7::StreamConfiguration &streamConfiguration,
40         bool overrideForPerfClass, metadata_vendor_id_t vendorTagId,
41         bool *earlyExit);
42 
43 // Utility function to convert a V3_7::StreamConfiguration to
44 // V3_4::StreamConfiguration. Return false if the original V3_7 configuration cannot
45 // be used by older version HAL.
46 bool convertHALStreamCombinationFromV37ToV34(
47         hardware::camera::device::V3_4::StreamConfiguration &streamConfigV34,
48         const hardware::camera::device::V3_7::StreamConfiguration &streamConfigV37);
49 } // SessionConfigurationUtils
50 } // camera3
51 } // android
52 
53 #endif
54