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_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 namespace media { | 14 namespace media { |
15 | 15 |
16 class AlsaWrapper; | 16 class AlsaWrapper; |
17 | 17 |
18 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { | 18 class MEDIA_EXPORT AudioManagerLinux : public AudioManagerBase { |
19 public: | 19 public: |
20 AudioManagerLinux(); | 20 AudioManagerLinux(); |
21 | 21 |
22 static void ShowLinuxAudioInputSettings(); | 22 static void ShowLinuxAudioInputSettings(); |
23 | 23 |
24 // Implementation of AudioManager. | 24 // Implementation of AudioManager. |
25 virtual bool HasAudioOutputDevices() OVERRIDE; | 25 virtual bool HasAudioOutputDevices() OVERRIDE; |
26 virtual bool HasAudioInputDevices() OVERRIDE; | 26 virtual bool HasAudioInputDevices() OVERRIDE; |
27 virtual void ShowAudioInputSettings() OVERRIDE; | 27 virtual void ShowAudioInputSettings() OVERRIDE; |
28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) | 28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names) |
29 OVERRIDE; | 29 OVERRIDE; |
30 virtual void GetAudioOutputDeviceNames(media::AudioDeviceNames* device_names) | |
31 OVERRIDE; | |
30 virtual AudioParameters GetInputStreamParameters( | 32 virtual AudioParameters GetInputStreamParameters( |
31 const std::string& device_id) OVERRIDE; | 33 const std::string& device_id) OVERRIDE; |
32 | 34 |
33 // Implementation of AudioManagerBase. | 35 // Implementation of AudioManagerBase. |
34 virtual AudioOutputStream* MakeLinearOutputStream( | 36 virtual AudioOutputStream* MakeLinearOutputStream( |
35 const AudioParameters& params) OVERRIDE; | 37 const AudioParameters& params) OVERRIDE; |
36 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 38 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
37 const AudioParameters& params, | 39 const AudioParameters& params, |
38 const std::string& input_device_id) OVERRIDE; | 40 const std::string& input_device_id) OVERRIDE; |
39 virtual AudioInputStream* MakeLinearInputStream( | 41 virtual AudioInputStream* MakeLinearInputStream( |
40 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 42 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
41 virtual AudioInputStream* MakeLowLatencyInputStream( | 43 virtual AudioInputStream* MakeLowLatencyInputStream( |
42 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 44 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
43 | 45 |
44 protected: | 46 protected: |
45 virtual ~AudioManagerLinux(); | 47 virtual ~AudioManagerLinux(); |
46 | 48 |
47 virtual AudioParameters GetPreferredOutputStreamParameters( | 49 virtual AudioParameters GetPreferredOutputStreamParameters( |
48 const AudioParameters& input_params) OVERRIDE; | 50 const AudioParameters& input_params) OVERRIDE; |
49 | 51 |
50 private: | 52 private: |
51 enum StreamType { | 53 enum StreamType { |
52 kStreamPlayback = 0, | 54 kStreamPlayback = 0, |
53 kStreamCapture, | 55 kStreamCapture, |
54 }; | 56 }; |
55 | 57 |
56 // Gets a list of available ALSA input devices. | 58 // Gets a list of available ALSA devices. |
57 void GetAlsaAudioInputDevices(media::AudioDeviceNames* device_names); | 59 void GetAlsaAudioDevices(StreamType type, |
60 media::AudioDeviceNames* device_names); | |
58 | 61 |
59 // Gets the ALSA devices' names and ids. | 62 // Gets the ALSA devices' names and ids that support streams of the |
60 void GetAlsaDevicesInfo(void** hint, media::AudioDeviceNames* device_names); | 63 // given type. |
64 void GetAlsaDevicesInfo(StreamType type, | |
65 void** hint, | |
66 media::AudioDeviceNames* device_names); | |
61 | 67 |
62 // Checks if the specific ALSA device is available. | 68 // Checks if the specific ALSA device is available. |
63 bool IsAlsaDeviceAvailable(const char* device_name); | 69 bool IsAlsaDeviceAvailable(StreamType type, |
70 const char* device_name); | |
71 | |
72 const char* UnwantedDeviceTypeWhenEnumerating(StreamType wanted_type); | |
tommi (sloooow) - chröme
2013/09/04 14:32:51
Can this be just a static method in the cc file? (
Jói
2013/09/04 15:32:22
In order to let it use the StreamType enum, we hav
| |
64 | 73 |
65 // Returns true if a device is present for the given stream type. | 74 // Returns true if a device is present for the given stream type. |
66 bool HasAnyAlsaAudioDevice(StreamType stream); | 75 bool HasAnyAlsaAudioDevice(StreamType stream); |
67 | 76 |
68 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. | 77 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. |
69 AudioOutputStream* MakeOutputStream(const AudioParameters& params); | 78 AudioOutputStream* MakeOutputStream(const AudioParameters& params); |
70 | 79 |
71 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. | 80 // Called by MakeLinearInputStream and MakeLowLatencyInputStream. |
72 AudioInputStream* MakeInputStream(const AudioParameters& params, | 81 AudioInputStream* MakeInputStream(const AudioParameters& params, |
73 const std::string& device_id); | 82 const std::string& device_id); |
74 | 83 |
75 scoped_ptr<AlsaWrapper> wrapper_; | 84 scoped_ptr<AlsaWrapper> wrapper_; |
76 | 85 |
77 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); | 86 DISALLOW_COPY_AND_ASSIGN(AudioManagerLinux); |
78 }; | 87 }; |
79 | 88 |
80 } // namespace media | 89 } // namespace media |
81 | 90 |
82 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ | 91 #endif // MEDIA_AUDIO_LINUX_AUDIO_MANAGER_LINUX_H_ |
OLD | NEW |