Delete unused downloads page asset.
[chromium-blink-merge.git] / media / audio / alsa / audio_manager_alsa.h
blob46a28b172fbbd21d689b1f91dd295e71dab5e077
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
6 #define MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_
8 #include <string>
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/threading/thread.h"
12 #include "media/audio/audio_manager_base.h"
14 namespace media {
16 class AlsaWrapper;
18 class MEDIA_EXPORT AudioManagerAlsa : public AudioManagerBase {
19 public:
20 AudioManagerAlsa(AudioLogFactory* audio_log_factory);
22 static void ShowLinuxAudioInputSettings();
24 // Implementation of AudioManager.
25 bool HasAudioOutputDevices() override;
26 bool HasAudioInputDevices() override;
27 void ShowAudioInputSettings() override;
28 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
29 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
30 AudioParameters GetInputStreamParameters(
31 const std::string& device_id) override;
33 // Implementation of AudioManagerBase.
34 AudioOutputStream* MakeLinearOutputStream(
35 const AudioParameters& params) override;
36 AudioOutputStream* MakeLowLatencyOutputStream(
37 const AudioParameters& params,
38 const std::string& device_id) override;
39 AudioInputStream* MakeLinearInputStream(
40 const AudioParameters& params,
41 const std::string& device_id) override;
42 AudioInputStream* MakeLowLatencyInputStream(
43 const AudioParameters& params,
44 const std::string& device_id) override;
46 protected:
47 ~AudioManagerAlsa() override;
49 AudioParameters GetPreferredOutputStreamParameters(
50 const std::string& output_device_id,
51 const AudioParameters& input_params) override;
53 private:
54 enum StreamType {
55 kStreamPlayback = 0,
56 kStreamCapture,
59 // Gets a list of available ALSA devices.
60 void GetAlsaAudioDevices(StreamType type,
61 media::AudioDeviceNames* device_names);
63 // Gets the ALSA devices' names and ids that support streams of the
64 // given type.
65 void GetAlsaDevicesInfo(StreamType type,
66 void** hint,
67 media::AudioDeviceNames* device_names);
69 // Checks if the specific ALSA device is available.
70 static bool IsAlsaDeviceAvailable(StreamType type,
71 const char* device_name);
73 static const char* UnwantedDeviceTypeWhenEnumerating(
74 StreamType wanted_type);
76 // Returns true if a device is present for the given stream type.
77 bool HasAnyAlsaAudioDevice(StreamType stream);
79 // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
80 AudioOutputStream* MakeOutputStream(const AudioParameters& params);
82 // Called by MakeLinearInputStream and MakeLowLatencyInputStream.
83 AudioInputStream* MakeInputStream(const AudioParameters& params,
84 const std::string& device_id);
86 scoped_ptr<AlsaWrapper> wrapper_;
88 DISALLOW_COPY_AND_ASSIGN(AudioManagerAlsa);
91 } // namespace media
93 #endif // MEDIA_AUDIO_ALSA_AUDIO_MANAGER_ALSA_H_