OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_ALSA_ALSA_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
6 #define MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ | 6 #define MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 21 matching lines...) Expand all Loading... |
32 static const char kAutoSelectDevice[]; | 32 static const char kAutoSelectDevice[]; |
33 | 33 |
34 // Create a PCM Output stream for the ALSA device identified by | 34 // Create a PCM Output stream for the ALSA device identified by |
35 // |device_name|. If unsure of what to use for |device_name|, use | 35 // |device_name|. If unsure of what to use for |device_name|, use |
36 // |kAutoSelectDevice|. | 36 // |kAutoSelectDevice|. |
37 AlsaPcmInputStream(AudioManagerBase* audio_manager, | 37 AlsaPcmInputStream(AudioManagerBase* audio_manager, |
38 const std::string& device_name, | 38 const std::string& device_name, |
39 const AudioParameters& params, | 39 const AudioParameters& params, |
40 AlsaWrapper* wrapper); | 40 AlsaWrapper* wrapper); |
41 | 41 |
42 virtual ~AlsaPcmInputStream(); | 42 ~AlsaPcmInputStream() override; |
43 | 43 |
44 // Implementation of AudioInputStream. | 44 // Implementation of AudioInputStream. |
45 virtual bool Open() override; | 45 bool Open() override; |
46 virtual void Start(AudioInputCallback* callback) override; | 46 void Start(AudioInputCallback* callback) override; |
47 virtual void Stop() override; | 47 void Stop() override; |
48 virtual void Close() override; | 48 void Close() override; |
49 virtual double GetMaxVolume() override; | 49 double GetMaxVolume() override; |
50 virtual void SetVolume(double volume) override; | 50 void SetVolume(double volume) override; |
51 virtual double GetVolume() override; | 51 double GetVolume() override; |
52 virtual bool IsMuted() override; | 52 bool IsMuted() override; |
53 | 53 |
54 private: | 54 private: |
55 // Logs the error and invokes any registered callbacks. | 55 // Logs the error and invokes any registered callbacks. |
56 void HandleError(const char* method, int error); | 56 void HandleError(const char* method, int error); |
57 | 57 |
58 // Reads one or more buffers of audio from the device, passes on to the | 58 // Reads one or more buffers of audio from the device, passes on to the |
59 // registered callback and schedules the next read. | 59 // registered callback and schedules the next read. |
60 void ReadAudio(); | 60 void ReadAudio(); |
61 | 61 |
62 // Recovers from any device errors if possible. | 62 // Recovers from any device errors if possible. |
(...skipping 24 matching lines...) Expand all Loading... |
87 | 87 |
88 // NOTE: Weak pointers must be invalidated before all other member variables. | 88 // NOTE: Weak pointers must be invalidated before all other member variables. |
89 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; | 89 base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); | 91 DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace media | 94 } // namespace media |
95 | 95 |
96 #endif // MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ | 96 #endif // MEDIA_AUDIO_ALSA_ALSA_INPUT_H_ |
OLD | NEW |