Avi Drissman | 0987565 | 2022-09-15 20:03:19 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SERVICES_AUDIO_LOG_ADAPTER_H_ |
| 6 | #define SERVICES_AUDIO_LOG_ADAPTER_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "media/audio/audio_logging.h" |
Miyoung Shin | 25bb8c09 | 2019-08-03 00:56:57 | [diff] [blame] | 11 | #include "media/mojo/mojom/audio_logging.mojom.h" |
Ken Rockot | 2aefba5 | 2019-04-25 17:16:28 | [diff] [blame] | 12 | #include "mojo/public/cpp/bindings/remote.h" |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 13 | |
| 14 | namespace media { |
| 15 | class AudioParameters; |
| 16 | } |
| 17 | |
| 18 | namespace audio { |
| 19 | |
Miyoung Shin | 4e4b503 | 2019-10-24 13:54:06 | [diff] [blame] | 20 | // This class wraps a Remote<media::mojom::AudioLog> into a media::AudioLog. |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 21 | class LogAdapter : public media::AudioLog { |
| 22 | public: |
Ken Rockot | 2aefba5 | 2019-04-25 17:16:28 | [diff] [blame] | 23 | explicit LogAdapter(mojo::PendingRemote<media::mojom::AudioLog> audio_log); |
Peter Boström | da683bf | 2021-09-22 17:22:08 | [diff] [blame] | 24 | |
| 25 | LogAdapter(const LogAdapter&) = delete; |
| 26 | LogAdapter& operator=(const LogAdapter&) = delete; |
| 27 | |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 28 | ~LogAdapter() override; |
| 29 | |
| 30 | // media::AudioLog implementation. |
| 31 | void OnCreated(const media::AudioParameters& params, |
| 32 | const std::string& device_id) override; |
| 33 | void OnStarted() override; |
| 34 | void OnStopped() override; |
| 35 | void OnClosed() override; |
| 36 | void OnError() override; |
| 37 | void OnSetVolume(double volume) override; |
Max Morin | 86d4f13 | 2018-08-30 21:51:13 | [diff] [blame] | 38 | void OnProcessingStateChanged(const std::string& message) override; |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 39 | void OnLogMessage(const std::string& message) override; |
| 40 | |
| 41 | private: |
Ken Rockot | 2aefba5 | 2019-04-25 17:16:28 | [diff] [blame] | 42 | mojo::Remote<media::mojom::AudioLog> audio_log_; |
Guido Urdaneta | 73a21d4be | 2018-07-17 06:31:09 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace audio |
| 46 | |
| 47 | #endif // SERVICES_AUDIO_LOG_ADAPTER_H_ |