1 /* 2 * Copyright (C) 2019 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_GOOGLE_CAMERA_HAL_HWL_INTERFACE_CAMERA_PROVIDER_HWL_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_HWL_INTERFACE_CAMERA_PROVIDER_HWL_H_ 19 20 #include <utils/Errors.h> 21 22 #include "camera_buffer_allocator_hwl.h" 23 #include "camera_device_hwl.h" 24 #include "hal_types.h" 25 26 namespace android { 27 namespace google_camera_hal { 28 // Camera provider HWL, which enumerates the available individual camera devices 29 // in the system, and provides updates about changes to device status. 30 class CameraProviderHwl { 31 public: 32 virtual ~CameraProviderHwl() = default; 33 34 // Set camera provider callback functions to camera HWL. 35 virtual status_t SetCallback(const HwlCameraProviderCallback& callback) = 0; 36 37 // Trigger a deferred callback (such as physical camera avail/unavail) right 38 // after setCallback() is called. 39 virtual status_t TriggerDeferredCallbacks() = 0; 40 41 // Get all vendor tags supported by devices. The tags are grouped into 42 // sections. 43 virtual status_t GetVendorTags( 44 std::vector<VendorTagSection>* vendor_tag_sections) = 0; 45 46 // Return the camera IDs that are visible to camera framework. 47 virtual status_t GetVisibleCameraIds( 48 std::vector<std::uint32_t>* camera_ids) = 0; 49 50 // Check if the combinations of camera ids and corresponding stream 51 // configurations are supported. 52 virtual status_t IsConcurrentStreamCombinationSupported( 53 const std::vector<CameraIdAndStreamConfiguration>&, bool*) = 0; 54 55 // Return the combinations of camera ids that can stream concurrently with 56 // guaranteed stream combinations 57 virtual status_t GetConcurrentStreamingCameraIds( 58 std::vector<std::unordered_set<uint32_t>>* combinations) = 0; 59 60 // Return if setting torch mode API is supported. Not all camera devices 61 // support torch mode so enabling torch mode for a devices is okay to 62 // fail if the camera device doesn't support torch mode. 63 virtual bool IsSetTorchModeSupported() = 0; 64 65 // Create a camera device HWL for camera_id. 66 virtual status_t CreateCameraDeviceHwl( 67 uint32_t camera_id, 68 std::unique_ptr<CameraDeviceHwl>* camera_device_hwl) = 0; 69 70 // Create a camera buffer allocator, if HWL didn't support vendor buffer 71 // allocator, need return INVALID_OPERATION. 72 virtual status_t CreateBufferAllocatorHwl( 73 std::unique_ptr<CameraBufferAllocatorHwl>* camera_buffer_allocator_hwl) = 0; 74 }; 75 typedef CameraProviderHwl* (*CreateCameraProviderHwl_t)(); 76 } // namespace google_camera_hal 77 } // namespace android 78 79 #endif // HARDWARE_GOOGLE_CAMERA_HAL_HWL_INTERFACE_CAMERA_PROVIDER_HWL_H_ 80