Avichal Rakesh | e1857f8 | 2022-06-08 17:47:23 -0700 | [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 | |
| 17 | #ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ |
| 18 | #define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ |
| 19 | |
| 20 | #include <aidl/android/hardware/camera/common/Status.h> |
| 21 | #include <aidl/android/hardware/camera/device/BufferStatus.h> |
| 22 | #include <aidl/android/hardware/camera/device/CameraMetadata.h> |
| 23 | #include <aidl/android/hardware/camera/device/HalStream.h> |
| 24 | #include <aidl/android/hardware/camera/device/NotifyMsg.h> |
| 25 | #include <aidl/android/hardware/camera/device/Stream.h> |
| 26 | #include <hardware/camera3.h> |
| 27 | #include <system/camera_metadata.h> |
| 28 | |
| 29 | namespace android { |
| 30 | namespace hardware { |
| 31 | namespace camera { |
| 32 | namespace device { |
| 33 | namespace implementation { |
| 34 | |
| 35 | using ::aidl::android::hardware::camera::common::Status; |
| 36 | using ::aidl::android::hardware::camera::device::BufferStatus; |
| 37 | using ::aidl::android::hardware::camera::device::CameraMetadata; |
| 38 | using ::aidl::android::hardware::camera::device::HalStream; |
| 39 | using ::aidl::android::hardware::camera::device::NotifyMsg; |
| 40 | using ::aidl::android::hardware::camera::device::Stream; |
| 41 | |
| 42 | void convertToAidl(const camera_metadata_t* src, CameraMetadata* dest); |
| 43 | |
| 44 | bool convertFromAidl(const CameraMetadata& src, const camera_metadata_t** dst); |
| 45 | |
| 46 | inline ndk::ScopedAStatus fromStatus(Status status) { |
| 47 | return status == Status::OK |
| 48 | ? ndk::ScopedAStatus::ok() |
| 49 | : ndk::ScopedAStatus::fromServiceSpecificError(static_cast<int32_t>(status)); |
| 50 | } |
| 51 | |
| 52 | } // namespace implementation |
| 53 | } // namespace device |
| 54 | } // namespace camera |
| 55 | } // namespace hardware |
| 56 | } // namespace android |
| 57 | |
| 58 | #endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ |