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_RESULT_PROCESSOR_H_ 18 #define HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_RESULT_PROCESSOR_H_ 19 20 #include <utils/Errors.h> 21 22 #include "hal_types.h" 23 #include "process_block.h" 24 25 namespace android { 26 namespace google_camera_hal { 27 28 // ResultProcessor defines the interface of a result processor. A result 29 // processor receives results from a ProcessBlock. It can return the finished 30 // results to the specified callback functions. If a class inherits both 31 // ResultProcessor and RequestProcessor interfaces, it can convert the results 32 // to requests to send to the next ProcessBlock. 33 class ResultProcessor { 34 public: 35 virtual ~ResultProcessor() = default; 36 37 // Set the callbacks to send the finished results. Must be called before 38 // calling ProcessResult. 39 virtual void SetResultCallback(ProcessCaptureResultFunc process_capture_result, 40 NotifyFunc notify) = 0; 41 42 // Add pending requests to the result processor. 43 // 44 // process_block_requests are the requests that will be completed by the 45 // preceding process block. 46 // 47 // remaining_session_request is the remaining request that was sent to the 48 // capture session. It contains all remaining output buffers that have not 49 // been completed by the process chain yet. For the last result process in a 50 // process chain, remaining_session_request should contain only the output 51 // buffers that are present in process_block_requests. 52 // remaining_session_request doesn't contain any internal buffers. 53 virtual status_t AddPendingRequests( 54 const std::vector<ProcessBlockRequest>& process_block_requests, 55 const CaptureRequest& remaining_session_request) = 0; 56 57 // Called by a ProcessBlock to send the capture results. 58 virtual void ProcessResult(ProcessBlockResult block_result) = 0; 59 60 // Called by a ProcessBlock to notify a message. 61 virtual void Notify(const ProcessBlockNotifyMessage& block_message) = 0; 62 63 // Flush all pending workload. 64 virtual status_t FlushPendingRequests() = 0; 65 }; 66 67 } // namespace google_camera_hal 68 } // namespace android 69 70 #endif // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_RESULT_PROCESSOR_H_