| 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 // Creates a unified stream based on the cras (ChromeOS audio server) interface. | 5 // Creates a unified stream based on the cras (ChromeOS audio server) interface. |
| 6 // | 6 // |
| 7 // CrasUnifiedStream object is *not* thread-safe and should only be used | 7 // CrasUnifiedStream object is *not* thread-safe and should only be used |
| 8 // from the audio thread. | 8 // from the audio thread. |
| 9 | 9 |
| 10 #ifndef MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 10 #ifndef MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int err, | 63 int err, |
| 64 void* arg); | 64 void* arg); |
| 65 | 65 |
| 66 // Chooses the correct audio callback based on stream direction. | 66 // Chooses the correct audio callback based on stream direction. |
| 67 uint32 DispatchCallback(size_t frames, | 67 uint32 DispatchCallback(size_t frames, |
| 68 uint8* input_samples, | 68 uint8* input_samples, |
| 69 uint8* output_samples, | 69 uint8* output_samples, |
| 70 const timespec* input_ts, | 70 const timespec* input_ts, |
| 71 const timespec* output_ts); | 71 const timespec* output_ts); |
| 72 | 72 |
| 73 // Receives input samples and write output samples for a unified I/O stream. | |
| 74 uint32 ReadWriteAudio(size_t frames, | |
| 75 uint8* input_samples, | |
| 76 uint8* output_samples, | |
| 77 const timespec* input_ts, | |
| 78 const timespec* output_ts); | |
| 79 | |
| 80 // Writes audio for a playback stream. | 73 // Writes audio for a playback stream. |
| 81 uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts); | 74 uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts); |
| 82 | 75 |
| 83 // Deals with an error that occured in the stream. Called from StreamError(). | 76 // Deals with an error that occured in the stream. Called from StreamError(). |
| 84 void NotifyStreamError(int err); | 77 void NotifyStreamError(int err); |
| 85 | 78 |
| 86 // The client used to communicate with the audio server. | 79 // The client used to communicate with the audio server. |
| 87 cras_client* client_; | 80 cras_client* client_; |
| 88 | 81 |
| 89 // ID of the playing stream. | 82 // ID of the playing stream. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 // Volume level from 0.0 to 1.0. | 94 // Volume level from 0.0 to 1.0. |
| 102 float volume_; | 95 float volume_; |
| 103 | 96 |
| 104 // Audio manager that created us. Used to report that we've been closed. | 97 // Audio manager that created us. Used to report that we've been closed. |
| 105 AudioManagerCras* manager_; | 98 AudioManagerCras* manager_; |
| 106 | 99 |
| 107 // Callback to get audio samples. | 100 // Callback to get audio samples. |
| 108 AudioSourceCallback* source_callback_; | 101 AudioSourceCallback* source_callback_; |
| 109 | 102 |
| 110 // Container for exchanging data with AudioSourceCallback::OnMoreData(). | 103 // Container for exchanging data with AudioSourceCallback::OnMoreData(). |
| 111 scoped_ptr<AudioBus> input_bus_; | |
| 112 scoped_ptr<AudioBus> output_bus_; | 104 scoped_ptr<AudioBus> output_bus_; |
| 113 | 105 |
| 114 // Direciton of the stream. | 106 // Direciton of the stream. |
| 115 CRAS_STREAM_DIRECTION stream_direction_; | 107 CRAS_STREAM_DIRECTION stream_direction_; |
| 116 | 108 |
| 117 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); | 109 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); |
| 118 }; | 110 }; |
| 119 | 111 |
| 120 } // namespace media | 112 } // namespace media |
| 121 | 113 |
| 122 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 114 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
| OLD | NEW |