Chromium Code Reviews| Index: chromecast/media/cma/backend/alsa/post_processing_pipeline.h |
| diff --git a/chromecast/media/cma/backend/alsa/post_processing_pipeline.h b/chromecast/media/cma/backend/alsa/post_processing_pipeline.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8ec02bff9ef19125b964c456bf29e19a55821242 |
| --- /dev/null |
| +++ b/chromecast/media/cma/backend/alsa/post_processing_pipeline.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |
| +#define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |
| + |
| +#include <cstdint> |
| +#include <memory> |
| +#include <string> |
| +#include <unordered_map> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/scoped_native_library.h" |
| + |
| +namespace base { |
| +class ListValue; |
| +} // namespace base |
| + |
| +namespace chromecast { |
| +namespace media { |
| + |
| +class AudioPostProcessor; |
| + |
| +// Creates and contains multiple AudioPostProcessors, as specified in ctor. |
| +// Provides convenience methods to access and use the AudioPostProcessors. |
| +class PostProcessingPipeline { |
| + public: |
| + PostProcessingPipeline(const base::ListValue* filter_description_list, |
| + int channels); |
| + ~PostProcessingPipeline(); |
| + |
| + // TODO(bshaya): Switch to float* |
| + int ProcessFrames(uint8_t* data, |
| + int num_frames, |
| + float current_volume, |
| + bool is_silence); |
| + bool SetSampleRate(int sample_rate); |
| + bool IsRinging(); |
| + |
| + private: |
| + int GetRingingTimeInFrames(); |
| + |
| + int sample_rate_; |
| + int ringing_time_in_frames_ = 0; |
| + int silence_frames_processed_ = 0; |
| + int total_delay_frames_ = 0; |
| + std::vector<std::unique_ptr<AudioPostProcessor>> processors_; |
| + |
| + // Contains all libraries in use; |
| + // Functions in shared objects cannot be used once library is closed. |
| + std::unordered_map<std::string, std::unique_ptr<base::ScopedNativeLibrary>> |
|
wzhong
2017/03/24 19:22:29
map is not necessary as I've commented in the inte
bshaya
2017/03/24 21:32:25
Done.
|
| + libraries_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PostProcessingPipeline); |
| +}; |
| + |
| +} // namespace media |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSING_PIPELINE_H_ |