| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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. | 5 // Creates an output stream based on the ALSA PCM interface. |
| 6 // | 6 // |
| 7 // On device write failure, the stream will move itself to an invalid state. | 7 // On device write failure, the stream will move itself to an invalid state. |
| 8 // No more data will be pulled from the data source, or written to the device. | 8 // No more data will be pulled from the data source, or written to the device. |
| 9 // All calls to public API functions will either no-op themselves, or return an | 9 // All calls to public API functions will either no-op themselves, or return an |
| 10 // error if possible. Specifically, If the stream is in an error state, Open() | 10 // error if possible. Specifically, If the stream is in an error state, Open() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // ScopedRunnableMethodFactory to create tasks. | 33 // ScopedRunnableMethodFactory to create tasks. |
| 34 | 34 |
| 35 #ifndef MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 35 #ifndef MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| 36 #define MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 36 #define MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| 37 | 37 |
| 38 #include <alsa/asoundlib.h> | 38 #include <alsa/asoundlib.h> |
| 39 | 39 |
| 40 #include <string> | 40 #include <string> |
| 41 | 41 |
| 42 #include "base/gtest_prod_util.h" | 42 #include "base/gtest_prod_util.h" |
| 43 #include "base/lock.h" | |
| 44 #include "base/ref_counted.h" | 43 #include "base/ref_counted.h" |
| 45 #include "base/scoped_ptr.h" | 44 #include "base/scoped_ptr.h" |
| 45 #include "base/synchronization/lock.h" |
| 46 #include "media/audio/audio_io.h" | 46 #include "media/audio/audio_io.h" |
| 47 #include "media/audio/audio_parameters.h" | 47 #include "media/audio/audio_parameters.h" |
| 48 | 48 |
| 49 namespace media { | 49 namespace media { |
| 50 class SeekableBuffer; | 50 class SeekableBuffer; |
| 51 }; // namespace media | 51 }; // namespace media |
| 52 | 52 |
| 53 class AlsaWrapper; | 53 class AlsaWrapper; |
| 54 class AudioManagerLinux; | 54 class AudioManagerLinux; |
| 55 class MessageLoop; | 55 class MessageLoop; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // using a deleted callback. | 186 // using a deleted callback. |
| 187 uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, | 187 uint32 OnMoreData(AudioOutputStream* stream, uint8* dest, |
| 188 uint32 max_size, AudioBuffersState buffers_state); | 188 uint32 max_size, AudioBuffersState buffers_state); |
| 189 void OnError(AudioOutputStream* stream, int code); | 189 void OnError(AudioOutputStream* stream, int code); |
| 190 | 190 |
| 191 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 191 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 192 // release ownership of the currently registered callback. | 192 // release ownership of the currently registered callback. |
| 193 void set_source_callback(AudioSourceCallback* callback); | 193 void set_source_callback(AudioSourceCallback* callback); |
| 194 | 194 |
| 195 private: | 195 private: |
| 196 Lock lock_; | 196 base::Lock lock_; |
| 197 | 197 |
| 198 InternalState state_; | 198 InternalState state_; |
| 199 float volume_; // Volume level from 0.0 to 1.0. | 199 float volume_; // Volume level from 0.0 to 1.0. |
| 200 | 200 |
| 201 AudioSourceCallback* source_callback_; | 201 AudioSourceCallback* source_callback_; |
| 202 | 202 |
| 203 MessageLoop* const state_transition_loop_; | 203 MessageLoop* const state_transition_loop_; |
| 204 | 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(SharedData); | 205 DISALLOW_COPY_AND_ASSIGN(SharedData); |
| 206 } shared_data_; | 206 } shared_data_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 MessageLoop* client_thread_loop_; | 246 MessageLoop* client_thread_loop_; |
| 247 | 247 |
| 248 // The message loop responsible for querying the data source, and writing to | 248 // The message loop responsible for querying the data source, and writing to |
| 249 // the output device. | 249 // the output device. |
| 250 MessageLoop* message_loop_; | 250 MessageLoop* message_loop_; |
| 251 | 251 |
| 252 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); | 252 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ | 255 #endif // MEDIA_AUDIO_LINUX_ALSA_OUTPUT_H_ |
| OLD | NEW |