OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "media/audio/audio_manager_base.h" | 12 #include "media/audio/audio_manager_base.h" |
13 | 13 |
14 class AlsaWrapper; | 14 class AlsaWrapper; |
15 | 15 |
16 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { | 16 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { |
17 public: | 17 public: |
18 AudioManagerLinux(); | 18 AudioManagerLinux(); |
19 | 19 |
20 // Call before using a newly created AudioManagerLinux instance. | 20 // Call before using a newly created AudioManagerLinux instance. |
21 virtual void Init() OVERRIDE; | 21 virtual void Init() OVERRIDE; |
22 | 22 |
23 // Implementation of AudioManager. | 23 // Implementation of AudioManager. |
24 virtual bool HasAudioOutputDevices() OVERRIDE; | 24 virtual bool HasAudioOutputDevices() OVERRIDE; |
25 virtual bool HasAudioInputDevices() OVERRIDE; | 25 virtual bool HasAudioInputDevices() OVERRIDE; |
26 virtual AudioOutputStream* MakeAudioOutputStream( | |
27 const AudioParameters& params) OVERRIDE; | |
28 virtual AudioInputStream* MakeAudioInputStream( | |
29 const AudioParameters& params, const std::string& device_id) OVERRIDE; | |
30 virtual bool CanShowAudioInputSettings() OVERRIDE; | 26 virtual bool CanShowAudioInputSettings() OVERRIDE; |
31 virtual void ShowAudioInputSettings() OVERRIDE; | 27 virtual void ShowAudioInputSettings() OVERRIDE; |
32 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) | 28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) |
33 OVERRIDE; | 29 OVERRIDE; |
34 | |
35 virtual void MuteAll() OVERRIDE; | 30 virtual void MuteAll() OVERRIDE; |
36 virtual void UnMuteAll() OVERRIDE; | 31 virtual void UnMuteAll() OVERRIDE; |
37 | 32 |
38 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 33 // Implementation of AudioManagerBase. |
| 34 virtual AudioOutputStream* MakeLinearOutputStream( |
| 35 const AudioParameters& params) OVERRIDE; |
| 36 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 37 const AudioParameters& params) OVERRIDE; |
| 38 virtual AudioInputStream* MakeLinearInputStream( |
| 39 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 40 virtual AudioInputStream* MakeLowLatencyInputStream( |
| 41 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
39 | 42 |
40 protected: | 43 protected: |
41 virtual ~AudioManagerLinux(); | 44 virtual ~AudioManagerLinux(); |
42 | 45 |
43 private: | 46 private: |
44 enum StreamType { | 47 enum StreamType { |
45 kStreamPlayback = 0, | 48 kStreamPlayback = 0, |
46 kStreamCapture, | 49 kStreamCapture, |
47 }; | 50 }; |
48 | 51 |
49 // Gets a list of available ALSA input devices. | 52 // Gets a list of available ALSA input devices. |
50 void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names); | 53 void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names); |
51 | 54 |
52 // Gets the ALSA devices' names and ids. | 55 // Gets the ALSA devices' names and ids. |
53 void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names); | 56 void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names); |
54 | 57 |
55 // Checks if the specific ALSA device is available. | 58 // Checks if the specific ALSA device is available. |
56 bool IsAlsaDeviceAvailable(const char* device_name); | 59 bool IsAlsaDeviceAvailable(const char* device_name); |
57 | 60 |
58 // Returns true if a device is present for the given stream type. | 61 // Returns true if a device is present for the given stream type. |
59 bool HasAnyAlsaAudioDevice(StreamType stream); | 62 bool HasAnyAlsaAudioDevice(StreamType stream); |
60 | 63 |
| 64 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. |
| 65 AudioOutputStream* MakeOutputStream(const AudioParameters& params); |
| 66 |
| 67 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. |
| 68 AudioInputStream* MakeInputStream(const AudioParameters& params, |
| 69 const std::string& device_id); |
| 70 |
61 scoped_ptr<AlsaWrapper> wrapper_; | 71 scoped_ptr<AlsaWrapper> wrapper_; |
62 | 72 |
63 size_t active_output_stream_count_; | |
64 | |
65 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); | 73 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); |
66 }; | 74 }; |
67 | 75 |
68 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ | 76 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
OLD | NEW |