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_ALSA_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_LINUX_ALSA_INPUT_H_ |
6 #define MEDIA_AUDIO_LINUX_ALSA_INPUT_H_ | 6 #define MEDIA_AUDIO_LINUX_ALSA_INPUT_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "media/audio/audio_input_stream_impl.h" |
16 #include "media/audio/audio_io.h" | 17 #include "media/audio/audio_io.h" |
17 #include "media/audio/audio_parameters.h" | 18 #include "media/audio/audio_parameters.h" |
18 | 19 |
19 class AlsaWrapper; | 20 class AlsaWrapper; |
20 class AudioManagerLinux; | 21 class AudioManagerLinux; |
21 | 22 |
22 // Provides an input stream for audio capture based on the ALSA PCM interface. | 23 // Provides an input stream for audio capture based on the ALSA PCM interface. |
23 // This object is not thread safe and all methods should be invoked in the | 24 // This object is not thread safe and all methods should be invoked in the |
24 // thread that created the object. | 25 // thread that created the object. |
25 class AlsaPcmInputStream : public AudioInputStream { | 26 class AlsaPcmInputStream : public AudioInputStreamImpl { |
26 public: | 27 public: |
27 // Pass this to the constructor if you want to attempt auto-selection | 28 // Pass this to the constructor if you want to attempt auto-selection |
28 // of the audio recording device. | 29 // of the audio recording device. |
29 static const char* kAutoSelectDevice; | 30 static const char* kAutoSelectDevice; |
30 | 31 |
31 // Create a PCM Output stream for the ALSA device identified by | 32 // Create a PCM Output stream for the ALSA device identified by |
32 // |device_name|. If unsure of what to use for |device_name|, use | 33 // |device_name|. If unsure of what to use for |device_name|, use |
33 // |kAutoSelectDevice|. | 34 // |kAutoSelectDevice|. |
34 AlsaPcmInputStream(AudioManagerLinux* audio_manager, | 35 AlsaPcmInputStream(AudioManagerLinux* audio_manager, |
35 const std::string& device_name, | 36 const std::string& device_name, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer. | 79 snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer. |
79 snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element. | 80 snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element. |
80 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; | 81 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; |
81 scoped_array<uint8> audio_buffer_; // Buffer used for reading audio data. | 82 scoped_array<uint8> audio_buffer_; // Buffer used for reading audio data. |
82 bool read_callback_behind_schedule_; | 83 bool read_callback_behind_schedule_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); | 85 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); |
85 }; | 86 }; |
86 | 87 |
87 #endif // MEDIA_AUDIO_LINUX_ALSA_INPUT_H_ | 88 #endif // MEDIA_AUDIO_LINUX_ALSA_INPUT_H_ |
OLD | NEW |