blob: 5a508fc4d81938a6cf7a00df67d1fda5c4687b0b [file] [log] [blame]
Avichal Rakeshe1857f82022-06-08 17:47:23 -07001/*
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
29namespace android {
30namespace hardware {
31namespace camera {
32namespace device {
33namespace implementation {
34
35using ::aidl::android::hardware::camera::common::Status;
36using ::aidl::android::hardware::camera::device::BufferStatus;
37using ::aidl::android::hardware::camera::device::CameraMetadata;
38using ::aidl::android::hardware::camera::device::HalStream;
39using ::aidl::android::hardware::camera::device::NotifyMsg;
40using ::aidl::android::hardware::camera::device::Stream;
41
42void convertToAidl(const camera_metadata_t* src, CameraMetadata* dest);
43
44bool convertFromAidl(const CameraMetadata& src, const camera_metadata_t** dst);
45
46inline 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_