blob: 96891f091d5792561e2e32cacb730d675094b0d3 [file] [log] [blame]
Yin-Chia Yehfaef8f92016-10-31 12:53:56 -07001/*
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
28namespace android {
29namespace hardware {
30namespace camera {
31namespace device {
32namespace V3_2 {
33namespace implementation {
34
Yin-Chia Yehfaef8f92016-10-31 12:53:56 -070035// The camera3_stream_t sent to conventional HAL. Added mId fields to enable stream ID lookup
36// fromt a downcasted camera3_stream
37struct 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.
42bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst);
43void convertToHidl(const camera_metadata_t* src, CameraMetadata* dst);
44
45void convertFromHidl(const Stream &src, Camera3Stream* dst);
46void convertToHidl(const Camera3Stream* src, HalStream* dst);
47
Yin-Chia Yehfaef8f92016-10-31 12:53:56 -070048void convertFromHidl(
Yin-Chia Yeh9c6dbd52016-12-22 14:55:02 -080049 buffer_handle_t*, BufferStatus, camera3_stream_t*, int acquireFence, // inputs
50 camera3_stream_buffer_t* dst);
Yin-Chia Yehfaef8f92016-10-31 12:53:56 -070051
52void 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
57void 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_