| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_LINUX_AUDIO_MANAGER_LINUX_H_ | 5 #ifndef MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| 6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ | 6 #define MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/ref_counted.h" |
| 11 #include "base/scoped_ptr.h" |
| 8 #include "base/thread.h" | 12 #include "base/thread.h" |
| 9 #include "media/audio/audio_output.h" | 13 #include "media/audio/audio_output.h" |
| 10 | 14 |
| 15 class AlsaPcmOutputStream; |
| 16 class AlsaWrapper; |
| 17 |
| 11 class AudioManagerLinux : public AudioManager { | 18 class AudioManagerLinux : public AudioManager { |
| 12 public: | 19 public: |
| 13 AudioManagerLinux(); | 20 AudioManagerLinux(); |
| 14 | 21 |
| 22 // Call before using a newly created AudioManagerLinux instance. |
| 23 void Init(); |
| 24 |
| 15 // Implementation of AudioManager. | 25 // Implementation of AudioManager. |
| 16 virtual bool HasAudioDevices(); | 26 virtual bool HasAudioDevices(); |
| 17 virtual AudioOutputStream* MakeAudioStream(Format format, int channels, | 27 virtual AudioOutputStream* MakeAudioStream(Format format, int channels, |
| 18 int sample_rate, | 28 int sample_rate, |
| 19 char bits_per_sample); | 29 char bits_per_sample); |
| 20 virtual void MuteAll(); | 30 virtual void MuteAll(); |
| 21 virtual void UnMuteAll(); | 31 virtual void UnMuteAll(); |
| 22 | 32 |
| 23 private: | 33 private: |
| 24 // Friend function for invoking the private destructor at exit. | 34 // Friend function for invoking the private destructor at exit. |
| 25 friend void DestroyAudioManagerLinux(void*); | 35 friend void DestroyAudioManagerLinux(void*); |
| 26 virtual ~AudioManagerLinux(); | 36 virtual ~AudioManagerLinux(); |
| 27 | 37 |
| 38 // Thread used to interact with AudioOutputStreams created by this |
| 39 // audio manger. |
| 40 base::Thread audio_thread_; |
| 41 scoped_ptr<AlsaWrapper> wrapper_; |
| 42 |
| 43 std::map<AlsaPcmOutputStream*, scoped_refptr<AlsaPcmOutputStream> > |
| 44 active_streams_; |
| 45 |
| 46 bool initialized_; |
| 47 |
| 28 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); | 48 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); |
| 29 }; | 49 }; |
| 30 | 50 |
| 31 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ | 51 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
| OLD | NEW |