| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_AUDIO_AUDIO_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "media/audio/audio_device_name.h" | 13 #include "media/audio/audio_device_name.h" |
| 14 #include "media/audio/audio_parameters.h" | 14 #include "media/audio/audio_parameters.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class MessageLoop; | 17 class MessageLoop; |
| 18 class MessageLoopProxy; | 18 class MessageLoopProxy; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { |
| 22 class MediaInternals; |
| 23 } |
| 24 |
| 21 namespace media { | 25 namespace media { |
| 22 | 26 |
| 23 class AudioInputStream; | 27 class AudioInputStream; |
| 24 class AudioOutputStream; | 28 class AudioOutputStream; |
| 25 | 29 |
| 26 // Manages all audio resources. In particular it owns the AudioOutputStream | 30 // Manages all audio resources. In particular it owns the AudioOutputStream |
| 27 // objects. Provides some convenience functions that avoid the need to provide | 31 // objects. Provides some convenience functions that avoid the need to provide |
| 28 // iterators over the existing streams. | 32 // iterators over the existing streams. |
| 29 class MEDIA_EXPORT AudioManager { | 33 class MEDIA_EXPORT AudioManager { |
| 30 public: | 34 public: |
| 31 virtual ~AudioManager(); | 35 virtual ~AudioManager(); |
| 32 | 36 |
| 33 // Use to construct the audio manager. | 37 // Use to construct the audio manager. |
| 34 // NOTE: There should only be one instance. | 38 // NOTE: There should only be one instance. |
| 35 static AudioManager* Create(); | 39 static AudioManager* Create(); |
| 36 | 40 |
| 37 // Returns the pointer to the last created instance, or NULL if not yet | 41 // Returns the pointer to the last created instance, or NULL if not yet |
| 38 // created. This is a utility method for the code outside of media directory, | 42 // created. This is a utility method for the code outside of media directory, |
| 39 // like src/chrome. | 43 // like src/chrome. |
| 40 static AudioManager* Get(); | 44 static AudioManager* Get(); |
| 41 | 45 |
| 46 void SetMediaInternals(content::MediaInternals* media_internals); |
| 47 content::MediaInternals* GetMediaInternals(); |
| 48 |
| 42 // Returns true if the OS reports existence of audio devices. This does not | 49 // Returns true if the OS reports existence of audio devices. This does not |
| 43 // guarantee that the existing devices support all formats and sample rates. | 50 // guarantee that the existing devices support all formats and sample rates. |
| 44 virtual bool HasAudioOutputDevices() = 0; | 51 virtual bool HasAudioOutputDevices() = 0; |
| 45 | 52 |
| 46 // Returns true if the OS reports existence of audio recording devices. This | 53 // Returns true if the OS reports existence of audio recording devices. This |
| 47 // does not guarantee that the existing devices support all formats and | 54 // does not guarantee that the existing devices support all formats and |
| 48 // sample rates. | 55 // sample rates. |
| 49 virtual bool HasAudioInputDevices() = 0; | 56 virtual bool HasAudioInputDevices() = 0; |
| 50 | 57 |
| 51 // Returns a human readable string for the model/make of the active audio | 58 // Returns a human readable string for the model/make of the active audio |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // will be empty (which the caller can then interpret to be the default output | 179 // will be empty (which the caller can then interpret to be the default output |
| 173 // device). Implementations that don't yet support this feature, must return | 180 // device). Implementations that don't yet support this feature, must return |
| 174 // an empty string. | 181 // an empty string. |
| 175 virtual std::string GetAssociatedOutputDeviceID( | 182 virtual std::string GetAssociatedOutputDeviceID( |
| 176 const std::string& input_device_id) = 0; | 183 const std::string& input_device_id) = 0; |
| 177 | 184 |
| 178 protected: | 185 protected: |
| 179 AudioManager(); | 186 AudioManager(); |
| 180 | 187 |
| 181 private: | 188 private: |
| 189 content::MediaInternals* media_internals_; |
| 182 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 190 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
| 183 }; | 191 }; |
| 184 | 192 |
| 185 } // namespace media | 193 } // namespace media |
| 186 | 194 |
| 187 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 195 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| OLD | NEW |