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_IMPL_H_ |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_IMPL_H_ |
7 | 7 |
8 #include <cstdint> | |
9 #include <memory> | 8 #include <memory> |
10 #include <string> | 9 #include <string> |
11 #include <vector> | 10 #include <vector> |
12 | 11 |
13 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chromecast/media/cma/backend/alsa/post_processing_pipeline.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class ListValue; | 16 class ListValue; |
17 class ScopedNativeLibrary; | 17 class ScopedNativeLibrary; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace chromecast { | 20 namespace chromecast { |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 class AudioPostProcessor; | 23 class AudioPostProcessor; |
24 | 24 |
25 // Creates and contains multiple AudioPostProcessors, as specified in ctor. | 25 // Creates and contains multiple AudioPostProcessors, as specified in ctor. |
26 // Provides convenience methods to access and use the AudioPostProcessors. | 26 // Provides convenience methods to access and use the AudioPostProcessors. |
27 class PostProcessingPipeline { | 27 class PostProcessingPipelineImpl : public PostProcessingPipeline { |
28 public: | 28 public: |
29 PostProcessingPipeline(const base::ListValue* filter_description_list, | 29 PostProcessingPipelineImpl(const std::string& name, |
30 int channels); | 30 const base::ListValue* filter_description_list, |
31 ~PostProcessingPipeline(); | 31 int channels); |
| 32 ~PostProcessingPipelineImpl() override; |
32 | 33 |
33 int ProcessFrames(const std::vector<float*>& data, | 34 int ProcessFrames(const std::vector<float*>& data, |
34 int num_frames, | 35 int num_frames, |
35 float current_volume, | 36 float current_volume, |
36 bool is_silence); | 37 bool is_silence) override; |
37 bool SetSampleRate(int sample_rate); | 38 |
38 bool IsRinging(); | 39 bool SetSampleRate(int sample_rate) override; |
| 40 bool IsRinging() override; |
39 | 41 |
40 private: | 42 private: |
41 int GetRingingTimeInFrames(); | 43 int GetRingingTimeInFrames(); |
| 44 void UpdateCastVolume(float multiplier); |
42 | 45 |
| 46 std::string name_; |
43 int sample_rate_; | 47 int sample_rate_; |
44 int ringing_time_in_frames_ = 0; | 48 int ringing_time_in_frames_ = 0; |
45 int silence_frames_processed_ = 0; | 49 int silence_frames_processed_ = 0; |
46 int total_delay_frames_ = 0; | 50 int total_delay_frames_ = 0; |
| 51 float current_multiplier_; |
| 52 float cast_volume_; |
47 | 53 |
48 // Contains all libraries in use; | 54 // Contains all libraries in use; |
49 // Functions in shared objects cannot be used once library is closed. | 55 // Functions in shared objects cannot be used once library is closed. |
50 std::vector<std::unique_ptr<base::ScopedNativeLibrary>> libraries_; | 56 std::vector<std::unique_ptr<base::ScopedNativeLibrary>> libraries_; |
51 | 57 |
52 // Must be after libraries_ | 58 // Must be after libraries_ |
53 std::vector<std::unique_ptr<AudioPostProcessor>> processors_; | 59 std::vector<std::unique_ptr<AudioPostProcessor>> processors_; |
54 | 60 |
55 DISALLOW_COPY_AND_ASSIGN(PostProcessingPipeline); | 61 DISALLOW_COPY_AND_ASSIGN(PostProcessingPipelineImpl); |
56 }; | 62 }; |
57 | 63 |
58 } // namespace media | 64 } // namespace media |
59 } // namespace chromecast | 65 } // namespace chromecast |
60 | 66 |
61 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ | 67 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_IMPL_H_ |
OLD | NEW |