| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |
| 7 | 7 |
| 8 #include <cstdint> | |
| 9 #include <memory> | 8 #include <memory> |
| 10 #include <string> | |
| 11 #include <vector> | 9 #include <vector> |
| 12 | 10 |
| 13 #include "base/macros.h" | |
| 14 | |
| 15 namespace base { | 11 namespace base { |
| 16 class ListValue; | 12 class ListValue; |
| 17 class ScopedNativeLibrary; | |
| 18 } // namespace base | 13 } // namespace base |
| 19 | 14 |
| 20 namespace chromecast { | 15 namespace chromecast { |
| 21 namespace media { | 16 namespace media { |
| 22 | 17 |
| 23 class AudioPostProcessor; | |
| 24 | |
| 25 // Creates and contains multiple AudioPostProcessors, as specified in ctor. | |
| 26 // Provides convenience methods to access and use the AudioPostProcessors. | |
| 27 class PostProcessingPipeline { | 18 class PostProcessingPipeline { |
| 28 public: | 19 public: |
| 29 PostProcessingPipeline(const base::ListValue* filter_description_list, | 20 virtual ~PostProcessingPipeline() = default; |
| 30 int channels); | 21 virtual int ProcessFrames(const std::vector<float*>& data, |
| 31 ~PostProcessingPipeline(); | 22 int num_frames, |
| 23 float current_volume, |
| 24 bool is_silence) = 0; |
| 25 virtual bool SetSampleRate(int sample_rate) = 0; |
| 26 virtual bool IsRinging() = 0; |
| 32 | 27 |
| 33 int ProcessFrames(const std::vector<float*>& data, | 28 static std::unique_ptr<PostProcessingPipeline> Create( |
| 34 int num_frames, | 29 const std::string& name, |
| 35 float current_volume, | 30 const base::ListValue* filter_description_list, |
| 36 bool is_silence); | 31 int num_channels); |
| 37 bool SetSampleRate(int sample_rate); | |
| 38 bool IsRinging(); | |
| 39 | |
| 40 private: | |
| 41 int GetRingingTimeInFrames(); | |
| 42 | |
| 43 int sample_rate_; | |
| 44 int ringing_time_in_frames_ = 0; | |
| 45 int silence_frames_processed_ = 0; | |
| 46 int total_delay_frames_ = 0; | |
| 47 | |
| 48 // Contains all libraries in use; | |
| 49 // Functions in shared objects cannot be used once library is closed. | |
| 50 std::vector<std::unique_ptr<base::ScopedNativeLibrary>> libraries_; | |
| 51 | |
| 52 // Must be after libraries_ | |
| 53 std::vector<std::unique_ptr<AudioPostProcessor>> processors_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(PostProcessingPipeline); | |
| 56 }; | 32 }; |
| 57 | 33 |
| 58 } // namespace media | 34 } // namespace media |
| 59 } // namespace chromecast | 35 } // namespace chromecast |
| 60 | 36 |
| 61 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ | 37 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |
| OLD | NEW |