Yin-Chia Yeh | faef8f9 | 2016-10-31 12:53:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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_V3_2_DEFAULT_INCLUDE_CONVERT_H_ |
| 18 | |
| 19 | #define HARDWARE_INTERFACES_CAMERA_DEVICE_V3_2_DEFAULT_INCLUDE_CONVERT_H_ |
| 20 | |
| 21 | #include <set> |
| 22 | |
| 23 | |
| 24 | #include <android/hardware/graphics/common/1.0/types.h> |
| 25 | #include <android/hardware/camera/device/3.2/types.h> |
| 26 | #include "hardware/camera3.h" |
| 27 | |
| 28 | namespace android { |
| 29 | namespace hardware { |
| 30 | namespace camera { |
| 31 | namespace device { |
| 32 | namespace V3_2 { |
| 33 | namespace implementation { |
| 34 | |
Yin-Chia Yeh | faef8f9 | 2016-10-31 12:53:56 -0700 | [diff] [blame] | 35 | // The camera3_stream_t sent to conventional HAL. Added mId fields to enable stream ID lookup |
| 36 | // fromt a downcasted camera3_stream |
| 37 | struct Camera3Stream : public camera3_stream { |
| 38 | int mId; |
| 39 | }; |
| 40 | |
| 41 | // *dst will point to the data owned by src, but src still owns the data after this call returns. |
| 42 | bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst); |
| 43 | void convertToHidl(const camera_metadata_t* src, CameraMetadata* dst); |
| 44 | |
| 45 | void convertFromHidl(const Stream &src, Camera3Stream* dst); |
| 46 | void convertToHidl(const Camera3Stream* src, HalStream* dst); |
| 47 | |
Yin-Chia Yeh | faef8f9 | 2016-10-31 12:53:56 -0700 | [diff] [blame] | 48 | void convertFromHidl( |
Yin-Chia Yeh | 9c6dbd5 | 2016-12-22 14:55:02 -0800 | [diff] [blame^] | 49 | buffer_handle_t*, BufferStatus, camera3_stream_t*, int acquireFence, // inputs |
| 50 | camera3_stream_buffer_t* dst); |
Yin-Chia Yeh | faef8f9 | 2016-10-31 12:53:56 -0700 | [diff] [blame] | 51 | |
| 52 | void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst); |
| 53 | |
| 54 | // The camera3_stream_t* in src must be the same as what wrapper HAL passed to conventional |
| 55 | // HAL, or the ID lookup will return garbage. Caller should validate the ID in ErrorMsg is |
| 56 | // indeed one of active stream IDs |
| 57 | void convertToHidl(const camera3_notify_msg* src, NotifyMsg* dst); |
| 58 | |
| 59 | } // namespace implementation |
| 60 | } // namespace V3_2 |
| 61 | } // namespace device |
| 62 | } // namespace camera |
| 63 | } // namespace hardware |
| 64 | } // namespace android |
| 65 | |
| 66 | #endif // HARDWARE_INTERFACES_CAMERA_DEVICE_V3_2_DEFAULT_INCLUDE_CONVERT_H_ |