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_DEPTH_RESULT_PROCESSOR_H_
18 #define HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_DUAL_IR_DEPTH_RESULT_PROCESSOR_H_
19 
20 #include "internal_stream_manager.h"
21 #include "result_processor.h"
22 
23 namespace android {
24 namespace google_camera_hal {
25 
26 class DualIrDepthResultProcessor : public ResultProcessor {
27  public:
28   static std::unique_ptr<DualIrDepthResultProcessor> Create(
29       InternalStreamManager* internal_stream_manager);
30 
31   virtual ~DualIrDepthResultProcessor() = default;
32 
33   // Override functions of ResultProcessor start.
34   void SetResultCallback(ProcessCaptureResultFunc process_capture_result,
35                          NotifyFunc notify) override;
36 
37   status_t AddPendingRequests(
38       const std::vector<ProcessBlockRequest>& process_block_requests,
39       const CaptureRequest& remaining_session_request) override;
40 
41   void ProcessResult(ProcessBlockResult block_result) override;
42 
43   void Notify(const ProcessBlockNotifyMessage& block_message) override;
44 
45   status_t FlushPendingRequests() override;
46   // Override functions of ResultProcessor end.
47 
48  protected:
49   DualIrDepthResultProcessor(InternalStreamManager* internal_stream_manager);
50 
51  private:
52   InternalStreamManager* internal_stream_manager_ = nullptr;
53 
54   std::mutex callback_lock_;
55 
56   // The following callbacks must be protected by callback_lock_.
57   ProcessCaptureResultFunc process_capture_result_;
58   NotifyFunc notify_;
59 };
60 
61 }  // namespace google_camera_hal
62 }  // namespace android
63 
64 #endif  // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_DUAL_IR_DEPTH_RESULT_PROCESSOR_H_