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 |
73 // Writes audio for a playback stream. | 80 // Writes audio for a playback stream. |
74 uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts); | 81 uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts); |
75 | 82 |
76 // Deals with an error that occured in the stream. Called from StreamError(). | 83 // Deals with an error that occured in the stream. Called from StreamError(). |
77 void NotifyStreamError(int err); | 84 void NotifyStreamError(int err); |
78 | 85 |
79 // The client used to communicate with the audio server. | 86 // The client used to communicate with the audio server. |
80 cras_client* client_; | 87 cras_client* client_; |
81 | 88 |
82 // ID of the playing stream. | 89 // ID of the playing stream. |
(...skipping 11 matching lines...) Expand all Loading... |
94 // Volume level from 0.0 to 1.0. | 101 // Volume level from 0.0 to 1.0. |
95 float volume_; | 102 float volume_; |
96 | 103 |
97 // Audio manager that created us. Used to report that we've been closed. | 104 // Audio manager that created us. Used to report that we've been closed. |
98 AudioManagerCras* manager_; | 105 AudioManagerCras* manager_; |
99 | 106 |
100 // Callback to get audio samples. | 107 // Callback to get audio samples. |
101 AudioSourceCallback* source_callback_; | 108 AudioSourceCallback* source_callback_; |
102 | 109 |
103 // Container for exchanging data with AudioSourceCallback::OnMoreData(). | 110 // Container for exchanging data with AudioSourceCallback::OnMoreData(). |
| 111 scoped_ptr<AudioBus> input_bus_; |
104 scoped_ptr<AudioBus> output_bus_; | 112 scoped_ptr<AudioBus> output_bus_; |
105 | 113 |
106 // Direciton of the stream. | 114 // Direciton of the stream. |
107 CRAS_STREAM_DIRECTION stream_direction_; | 115 CRAS_STREAM_DIRECTION stream_direction_; |
108 | 116 |
109 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); | 117 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); |
110 }; | 118 }; |
111 | 119 |
112 } // namespace media | 120 } // namespace media |
113 | 121 |
114 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 122 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
OLD | NEW |