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_GOOGLE_CAMERA_HAL_DUAL_IR_REQUEST_PROCESSOR_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_DUAL_IR_REQUEST_PROCESSOR_H_ 19 20 #include "process_block.h" 21 #include "request_processor.h" 22 23 namespace android { 24 namespace google_camera_hal { 25 26 // DualIrRequestProcessor implements a RequestProcessor handling realtime 27 // requests for a logical camera consisting of two IR camera sensors. 28 class DualIrRequestProcessor : public RequestProcessor { 29 public: 30 // device_session_hwl is owned by the caller and must be valid during the 31 // lifetime of this DualIrRequestProcessor. 32 // lead_camera_id is the lead IR camera ID. Logical streams will be 33 // assigned to the lead IR camera. 34 static std::unique_ptr<DualIrRequestProcessor> Create( 35 CameraDeviceSessionHwl* device_session_hwl, uint32_t lead_camera_id); 36 37 virtual ~DualIrRequestProcessor() = default; 38 39 // Override functions of RequestProcessor start. 40 status_t ConfigureStreams( 41 InternalStreamManager* internal_stream_manager, 42 const StreamConfiguration& stream_config, 43 StreamConfiguration* process_block_stream_config) override; 44 45 status_t SetProcessBlock(std::unique_ptr<ProcessBlock> process_block) override; 46 47 status_t ProcessRequest(const CaptureRequest& request) override; 48 49 status_t Flush() override; 50 // Override functions of RequestProcessor end. 51 52 protected: 53 DualIrRequestProcessor(uint32_t lead_camera_id); 54 55 private: 56 // ID of the lead IR camera. All logical streams will be assigned to the 57 // lead camera. 58 const uint32_t kLeadCameraId; 59 60 std::mutex process_block_lock_; 61 62 // Protected by process_block_lock_. 63 std::unique_ptr<ProcessBlock> process_block_; 64 65 // Map from a stream ID to the physical camera ID the stream belongs to. 66 // Protected by process_block_lock_. 67 std::map<int32_t, uint32_t> stream_physical_camera_ids_; 68 }; 69 70 } // namespace google_camera_hal 71 } // namespace android 72 73 #endif // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_DUAL_IR_REQUEST_PROCESSOR_H_ 74