1 /* 2 * Copyright (C) 2018 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 CAMERA_NDK_VENDOR_UTILS_H 18 #define CAMERA_NDK_VENDOR_UTILS_H 19 20 #include <CameraMetadata.h> 21 #include <aidl/android/frameworks/cameraservice/common/Status.h> 22 #include <aidl/android/frameworks/cameraservice/device/CameraMetadata.h> 23 #include <aidl/android/frameworks/cameraservice/device/CaptureRequest.h> 24 #include <aidl/android/frameworks/cameraservice/device/ICameraDeviceUser.h> 25 #include <aidl/android/frameworks/cameraservice/device/OutputConfiguration.h> 26 #include <aidl/android/frameworks/cameraservice/device/PhysicalCameraSettings.h> 27 #include <aidl/android/frameworks/cameraservice/device/TemplateId.h> 28 #include <aidl/android/frameworks/cameraservice/service/ICameraService.h> 29 #include <camera/NdkCameraDevice.h> 30 #include <hardware/camera3.h> 31 #include <utils/RefBase.h> 32 33 namespace android { 34 namespace acam { 35 namespace utils { 36 37 using ::aidl::android::frameworks::cameraservice::common::Status; 38 using ::aidl::android::frameworks::cameraservice::device::OutputConfiguration; 39 using ::aidl::android::frameworks::cameraservice::device::PhysicalCameraSettings; 40 using ::aidl::android::frameworks::cameraservice::device::TemplateId; 41 using ::android::hardware::camera::common::V1_0::helper::CameraMetadata; 42 using AidlCameraMetadata = ::aidl::android::frameworks::cameraservice::device::CameraMetadata; 43 using AidlCaptureRequest = ::aidl::android::frameworks::cameraservice::device::CaptureRequest; 44 45 // Utility class so that CaptureRequest can be stored by sp<> 46 struct CaptureRequest: public RefBase { 47 AidlCaptureRequest mCaptureRequest; 48 std::vector<ANativeWindow *> mSurfaceList; 49 // Physical camera settings metadata is stored here, as the capture request 50 // might not contain it. That's since, fmq might have consumed it. 51 std::vector<PhysicalCameraSettings> mPhysicalCameraSettings; 52 }; 53 54 AidlCaptureRequest convertToAidl(const CaptureRequest *captureRequest); 55 56 OutputConfiguration::Rotation convertToAidl(int rotation); 57 58 bool cloneFromAidl(const AidlCameraMetadata & srcMetadata, camera_metadata_t** dst); 59 60 // Note: existing data in dst will be gone. 61 void convertToAidl(const camera_metadata_t *src, AidlCameraMetadata * dst); 62 63 TemplateId convertToAidl(ACameraDevice_request_template templateId); 64 65 camera_status_t convertFromAidl(Status status); 66 67 } // namespace utils 68 } // namespace acam 69 } // namespace android 70 71 #endif // CAMERA_NDK_VENDOR_UTILS_H 72