1 /*
2  * Copyright (C) 2020 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_H
17 #define ANDROID_SERVERS_CAMERA_SESSION_CONFIGURATION_UTILS_H
18 
19 #include <android/hardware/camera2/BnCameraDeviceUser.h>
20 #include <android/hardware/camera2/ICameraDeviceCallbacks.h>
21 #include <camera/camera2/OutputConfiguration.h>
22 #include <camera/camera2/SessionConfiguration.h>
23 #include <camera/camera2/SubmitInfo.h>
24 #include <android/hardware/camera/device/3.4/ICameraDeviceSession.h>
25 
26 #include <stdint.h>
27 
28 namespace android {
29 
30 typedef std::function<CameraMetadata (const String8 &)> metadataGetter;
31 
32 class SessionConfigurationUtils {
33 public:
34     // utility function to convert AIDL SessionConfiguration to HIDL
35     // streamConfiguration. Also checks for validity of SessionConfiguration and
36     // returns a non-ok binder::Status if the passed in session configuration
37     // isn't valid.
38     static binder::Status
39     convertToHALStreamCombination(const SessionConfiguration& sessionConfiguration,
40             const String8 &cameraId, const CameraMetadata &deviceInfo,
41             metadataGetter getMetadata, const std::vector<std::string> &physicalCameraIds,
42             hardware::camera::device::V3_4::StreamConfiguration &streamConfiguration,
43             bool *earlyExit);
44 };
45 
46 } // android
47 #endif
48