OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Creates an output stream based on the ALSA PCM interface. The current | 5 // Creates an output stream based on the ALSA PCM interface. The current |
6 // implementation creates one thread per ALSA playback handle that is | 6 // implementation creates one thread per ALSA playback handle that is |
7 // responsible for synchronously pulling data from the audio data source. | 7 // responsible for synchronously pulling data from the audio data source. |
8 // | 8 // |
9 // This output stream buffers in two places: | 9 // This output stream buffers in two places: |
10 // (1) In the ALSA device | 10 // (1) In the ALSA device |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 char bits_per_sample); | 58 char bits_per_sample); |
59 virtual ~AlsaPCMOutputStream(); | 59 virtual ~AlsaPCMOutputStream(); |
60 | 60 |
61 // Implementation of AudioOutputStream. | 61 // Implementation of AudioOutputStream. |
62 virtual bool Open(size_t packet_size); | 62 virtual bool Open(size_t packet_size); |
63 virtual void Close(); | 63 virtual void Close(); |
64 virtual void Start(AudioSourceCallback* callback); | 64 virtual void Start(AudioSourceCallback* callback); |
65 virtual void Stop(); | 65 virtual void Stop(); |
66 virtual void SetVolume(double left_level, double right_level); | 66 virtual void SetVolume(double left_level, double right_level); |
67 virtual void GetVolume(double* left_level, double* right_level); | 67 virtual void GetVolume(double* left_level, double* right_level); |
68 virtual size_t GetNumBuffers(); | |
69 | 68 |
70 private: | 69 private: |
71 // Closes the playback handle, reporting errors if any occur. Returns true | 70 // Closes the playback handle, reporting errors if any occur. Returns true |
72 // if the device was successfully closed. | 71 // if the device was successfully closed. |
73 bool CloseDevice_Locked(); | 72 bool CloseDevice_Locked(); |
74 | 73 |
75 // Stops playback, ignoring state checks. | 74 // Stops playback, ignoring state checks. |
76 void StopInternal_Locked(); | 75 void StopInternal_Locked(); |
77 | 76 |
78 // Moves the stream into the error state, setting the correct internal flags. | 77 // Moves the stream into the error state, setting the correct internal flags. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // FillAlsaDeviceBuffer() methods. | 156 // FillAlsaDeviceBuffer() methods. |
158 bool device_write_suspended_; | 157 bool device_write_suspended_; |
159 | 158 |
160 // Flag indicating that the resources are already cleaned. | 159 // Flag indicating that the resources are already cleaned. |
161 bool resources_released_; | 160 bool resources_released_; |
162 | 161 |
163 DISALLOW_COPY_AND_ASSIGN(AlsaPCMOutputStream); | 162 DISALLOW_COPY_AND_ASSIGN(AlsaPCMOutputStream); |
164 }; | 163 }; |
165 | 164 |
166 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 165 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
OLD | NEW |