| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/task.h" |
| 10 #include "media/audio/audio_parameters.h" | 11 #include "media/audio/audio_parameters.h" |
| 11 | 12 |
| 12 class AudioInputStream; | 13 class AudioInputStream; |
| 13 class AudioOutputStream; | 14 class AudioOutputStream; |
| 14 class MessageLoop; | 15 class MessageLoop; |
| 15 | 16 |
| 16 // TODO(sergeyu): In this interface and some other places AudioParameters struct | 17 // TODO(sergeyu): In this interface and some other places AudioParameters struct |
| 17 // is passed by value. It is better to change it to const reference. | 18 // is passed by value. It is better to change it to const reference. |
| 18 | 19 |
| 19 // Manages all audio resources. In particular it owns the AudioOutputStream | 20 // Manages all audio resources. In particular it owns the AudioOutputStream |
| 20 // objects. Provides some convenience functions that avoid the need to provide | 21 // objects. Provides some convenience functions that avoid the need to provide |
| 21 // iterators over the existing streams. | 22 // iterators over the existing streams. |
| 22 class AudioManager { | 23 class AudioManager { |
| 23 public: | 24 public: |
| 24 // Returns true if the OS reports existence of audio devices. This does not | 25 // Returns true if the OS reports existence of audio devices. This does not |
| 25 // guarantee that the existing devices support all formats and sample rates. | 26 // guarantee that the existing devices support all formats and sample rates. |
| 26 virtual bool HasAudioOutputDevices() = 0; | 27 virtual bool HasAudioOutputDevices() = 0; |
| 27 | 28 |
| 28 // Returns true if the OS reports existence of audio recording devices. This | 29 // Returns true if the OS reports existence of audio recording devices. This |
| 29 // does not guarantee that the existing devices support all formats and | 30 // does not guarantee that the existing devices support all formats and |
| 30 // sample rates. | 31 // sample rates. |
| 31 virtual bool HasAudioInputDevices() = 0; | 32 virtual bool HasAudioInputDevices() = 0; |
| 32 | 33 |
| 33 // Returns a human readable string for the model/make of the active audio | 34 // Returns a human readable string for the model/make of the active audio |
| 34 // input device for this computer. | 35 // input device for this computer. |
| 35 virtual string16 GetAudioInputDeviceModel() = 0; | 36 virtual string16 GetAudioInputDeviceModel() = 0; |
| 36 | 37 |
| 38 // Returns true if the platform specific audio input settings UI is known |
| 39 // and can be shown. |
| 40 virtual bool CanShowAudioInputSettings() = 0; |
| 41 |
| 42 // Opens the platform default audio input settings UI. |
| 43 // Note: This could invoke an external application/preferences pane, so |
| 44 // ideally must not be called from the UI thread or other time sensitive |
| 45 // threads to avoid blocking the rest of the application. |
| 46 virtual void ShowAudioInputSettings() = 0; |
| 47 |
| 37 // Factory for all the supported stream formats. |params| defines parameters | 48 // Factory for all the supported stream formats. |params| defines parameters |
| 38 // of the audio stream to be created. | 49 // of the audio stream to be created. |
| 39 // | 50 // |
| 40 // |params.sample_per_packet| is the requested buffer allocation which the | 51 // |params.sample_per_packet| is the requested buffer allocation which the |
| 41 // audio source thinks it can usually fill without blocking. Internally two | 52 // audio source thinks it can usually fill without blocking. Internally two |
| 42 // or three buffers are created, one will be locked for playback and one will | 53 // or three buffers are created, one will be locked for playback and one will |
| 43 // be ready to be filled in the call to AudioSourceCallback::OnMoreData(). | 54 // be ready to be filled in the call to AudioSourceCallback::OnMoreData(). |
| 44 // | 55 // |
| 45 // Returns NULL if the combination of the parameters is not supported, or if | 56 // Returns NULL if the combination of the parameters is not supported, or if |
| 46 // we have reached some other platform specific limit. | 57 // we have reached some other platform specific limit. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Called by Destroy() to cleanup the instance before destruction. | 107 // Called by Destroy() to cleanup the instance before destruction. |
| 97 virtual void Cleanup() = 0; | 108 virtual void Cleanup() = 0; |
| 98 | 109 |
| 99 private: | 110 private: |
| 100 static void Destroy(void*); | 111 static void Destroy(void*); |
| 101 | 112 |
| 102 // Called by GetAudioManager() to create platform-specific audio manager. | 113 // Called by GetAudioManager() to create platform-specific audio manager. |
| 103 static AudioManager* CreateAudioManager(); | 114 static AudioManager* CreateAudioManager(); |
| 104 }; | 115 }; |
| 105 | 116 |
| 117 DISABLE_RUNNABLE_METHOD_REFCOUNT(AudioManager); |
| 118 |
| 106 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 119 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
| OLD | NEW |