| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ |
| 6 #define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ | 6 #define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "components/copresence/public/copresence_constants.h" | 11 #include "components/copresence/public/copresence_constants.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace copresence { |
| 14 class AudioBusRefCounted; | |
| 15 } | |
| 16 | 14 |
| 17 namespace copresence { | 15 class WhispernetClient; |
| 18 | 16 |
| 19 class AudioManager { | 17 class AudioManager { |
| 20 public: | 18 public: |
| 21 typedef base::Callback<void(const std::string&, | |
| 22 AudioType, | |
| 23 const scoped_refptr<media::AudioBusRefCounted>&)> | |
| 24 SamplesCallback; | |
| 25 typedef base::Callback<void(const std::string&, | |
| 26 AudioType, | |
| 27 const SamplesCallback&)> EncodeTokenCallback; | |
| 28 typedef base::Callback<void(AudioType, const std::string&)> | |
| 29 DecodeSamplesCallback; | |
| 30 | |
| 31 virtual ~AudioManager() {} | 19 virtual ~AudioManager() {} |
| 32 | 20 |
| 33 // Initializes the object. Do not use this object before calling this method. | 21 // Initializes the object. Do not use this object before calling this method. |
| 34 virtual void Initialize(const DecodeSamplesCallback& decode_cb, | 22 virtual void Initialize(WhispernetClient* whispernet_client, |
| 35 const EncodeTokenCallback& encode_cb) = 0; | 23 const TokensCallback& tokens_cb) = 0; |
| 36 | 24 |
| 37 virtual void StartPlaying(AudioType type) = 0; | 25 virtual void StartPlaying(AudioType type) = 0; |
| 38 virtual void StopPlaying(AudioType type) = 0; | 26 virtual void StopPlaying(AudioType type) = 0; |
| 39 | 27 |
| 40 virtual void StartRecording(AudioType type) = 0; | 28 virtual void StartRecording(AudioType type) = 0; |
| 41 virtual void StopRecording(AudioType type) = 0; | 29 virtual void StopRecording(AudioType type) = 0; |
| 42 | 30 |
| 43 virtual void SetToken(AudioType type, | 31 virtual void SetToken(AudioType type, |
| 44 const std::string& url_unsafe_token) = 0; | 32 const std::string& url_unsafe_token) = 0; |
| 45 | 33 |
| 46 virtual const std::string GetToken(AudioType type) = 0; | 34 virtual const std::string GetToken(AudioType type) = 0; |
| 47 | 35 |
| 48 virtual bool IsRecording(AudioType type) = 0; | 36 virtual bool IsRecording(AudioType type) = 0; |
| 49 virtual bool IsPlaying(AudioType type) = 0; | 37 virtual bool IsPlaying(AudioType type) = 0; |
| 38 |
| 39 virtual bool IsPlayingTokenHeard(AudioType type) = 0; |
| 50 }; | 40 }; |
| 51 | 41 |
| 52 } // namespace copresence | 42 } // namespace copresence |
| 53 | 43 |
| 54 #endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ | 44 #endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_MANAGER_H_ |
| OLD | NEW |