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_BASIC_RESULT_PROCESSOR_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_BASIC_RESULT_PROCESSOR_H_ 19 20 #include <vector> 21 22 #include "result_processor.h" 23 24 namespace android { 25 namespace google_camera_hal { 26 27 // BasicResultProcessor implements a basic ResultProcessor that simply forwards 28 // the results to its callback functions without any modification. 29 class BasicResultProcessor : public ResultProcessor { 30 public: 31 static std::unique_ptr<BasicResultProcessor> Create(); 32 33 virtual ~BasicResultProcessor(); 34 35 // Override functions of ResultProcessor start. 36 void SetResultCallback( 37 ProcessCaptureResultFunc process_capture_result, NotifyFunc notify, 38 ProcessBatchCaptureResultFunc process_batch_capture_result) override; 39 40 status_t AddPendingRequests( 41 const std::vector<ProcessBlockRequest>& process_block_requests, 42 const CaptureRequest& remaining_session_request) override; 43 44 void ProcessResult(ProcessBlockResult block_result) override; 45 46 void ProcessBatchResult(std::vector<ProcessBlockResult> block_results) override; 47 48 void Notify(const ProcessBlockNotifyMessage& block_message) override; 49 50 status_t FlushPendingRequests() override; 51 // Override functions of ResultProcessor end. 52 53 protected: 54 BasicResultProcessor() = default; 55 56 private: 57 std::mutex callback_lock_; 58 59 // The following callbacks must be protected by callback_lock_. 60 ProcessCaptureResultFunc process_capture_result_; 61 ProcessBatchCaptureResultFunc process_batch_capture_result_; 62 NotifyFunc notify_; 63 }; 64 65 } // namespace google_camera_hal 66 } // namespace android 67 68 #endif // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_BASIC_RESULT_PROCESSOR_H_ 69