1 /* 2 * Copyright (C) 2023 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 #pragma once 18 19 #include <memory> 20 21 #include <aidl/android/hardware/camera/provider/BnCameraProvider.h> 22 #include <aidl/android/hardware/camera/provider/ICameraProviderCallback.h> 23 24 #include "HwCamera.h" 25 #include "Span.h" 26 27 namespace android { 28 namespace hardware { 29 namespace camera { 30 namespace provider { 31 namespace implementation { 32 33 using aidl::android::hardware::camera::common::VendorTagSection; 34 using aidl::android::hardware::camera::device::ICameraDevice; 35 using aidl::android::hardware::camera::provider::BnCameraProvider; 36 using aidl::android::hardware::camera::provider::CameraIdAndStreamCombination; 37 using aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination; 38 using aidl::android::hardware::camera::provider::ICameraProviderCallback; 39 using ndk::ScopedAStatus; 40 41 struct CameraProvider : public BnCameraProvider { 42 CameraProvider(int deviceIdBase, Span<const hw::HwCameraFactory> availableCameras); 43 ~CameraProvider() override; 44 45 ScopedAStatus setCallback( 46 const std::shared_ptr<ICameraProviderCallback>& callback) override; 47 ScopedAStatus getVendorTags(std::vector<VendorTagSection>* vts) override; 48 ScopedAStatus getCameraIdList(std::vector<std::string>* camera_ids) override; 49 ScopedAStatus getCameraDeviceInterface( 50 const std::string& in_cameraDeviceName, 51 std::shared_ptr<ICameraDevice>* device) override; 52 ScopedAStatus notifyDeviceStateChange(int64_t in_deviceState) override; 53 ScopedAStatus getConcurrentCameraIds( 54 std::vector<ConcurrentCameraIdCombination>* concurrent_camera_ids) override; 55 ScopedAStatus isConcurrentStreamCombinationSupported( 56 const std::vector<CameraIdAndStreamCombination>& in_configs, 57 bool* support) override; 58 59 private: 60 const int mDeviceIdBase; 61 const Span<const hw::HwCameraFactory> mAvailableCameras; 62 std::shared_ptr<ICameraProviderCallback> mCallback; 63 }; 64 65 } // namespace implementation 66 } // namespace provider 67 } // namespace camera 68 } // namespace hardware 69 } // namespace android 70