1 // Copyright 2020 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #ifndef COMPUTEPIPE_RUNNER_INPUT_MANAGER_INCLUDE_VIDEOINPUTMANAGER_H_ 15 #define COMPUTEPIPE_RUNNER_INPUT_MANAGER_INCLUDE_VIDEOINPUTMANAGER_H_ 16 17 #include <android-base/logging.h> 18 19 #include <vector> 20 21 #include "InputManager.h" 22 #include "VideoDecoder.h" 23 #include "types/Status.h" 24 25 namespace android { 26 namespace automotive { 27 namespace computepipe { 28 namespace runner { 29 namespace input_manager { 30 31 class VideoInputManager : public InputManager { 32 public: 33 explicit VideoInputManager(const proto::InputConfig& inputConfig, 34 const proto::InputConfig& overrideConfig, 35 std::shared_ptr<InputEngineInterface> inputEngineInterface); 36 37 ~VideoInputManager(); 38 39 static std::unique_ptr<VideoInputManager> createVideoInputManager( 40 const proto::InputConfig& inputConfig, const proto::InputConfig& overrideConfig, 41 std::shared_ptr<InputEngineInterface> inputEngineInterface); 42 43 Status handleExecutionPhase(const RunnerEvent& e) override; 44 45 Status handleStopImmediatePhase(const RunnerEvent& e) override; 46 47 Status handleStopWithFlushPhase(const RunnerEvent& e) override; 48 49 Status handleResetPhase(const RunnerEvent& e) override; 50 51 private: 52 void populateDecoders(); 53 Status startDecoders(); 54 void resetDecoders(); 55 std::shared_ptr<InputEngineInterface> mEngine; 56 57 proto::InputConfig mInputConfig; 58 std::vector<std::unique_ptr<VideoDecoder>> mVideoDecoders; 59 }; 60 61 } // namespace input_manager 62 } // namespace runner 63 } // namespace computepipe 64 } // namespace automotive 65 } // namespace android 66 67 #endif // COMPUTEPIPE_RUNNER_INPUT_MANAGER_INCLUDE_VIDEOINPUTMANAGER_H_ 68