OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CRAS_CRAS_INPUT_H_ | 5 #ifndef MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ | 6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
7 | 7 |
8 #include <cras_client.h> | 8 #include <cras_client.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 private: | 44 private: |
45 // Handles requests to get samples from the provided buffer. This will be | 45 // Handles requests to get samples from the provided buffer. This will be |
46 // called by the audio server when it has samples ready. | 46 // called by the audio server when it has samples ready. |
47 static int SamplesReady(cras_client* client, | 47 static int SamplesReady(cras_client* client, |
48 cras_stream_id_t stream_id, | 48 cras_stream_id_t stream_id, |
49 uint8* samples, | 49 uint8* samples, |
50 size_t frames, | 50 size_t frames, |
51 const timespec* sample_ts, | 51 const timespec* sample_ts, |
52 void* arg); | 52 void* arg); |
53 | 53 |
| 54 // This will be called by the audio server once after it recieves a wakeup |
| 55 // and has data. |
| 56 static int HotwordSampleReady(cras_client* client, |
| 57 cras_audio_format* fmt, |
| 58 uint8* hotword_phrase, |
| 59 size_t frames, |
| 60 const timespec* sample_ts, |
| 61 void* arg); |
| 62 |
54 // Handles notification that there was an error with the playback stream. | 63 // Handles notification that there was an error with the playback stream. |
55 static int StreamError(cras_client* client, | 64 static int StreamError(cras_client* client, |
56 cras_stream_id_t stream_id, | 65 cras_stream_id_t stream_id, |
57 int err, | 66 int err, |
58 void* arg); | 67 void* arg); |
59 | 68 |
60 // Reads one or more buffers of audio from the device, passes on to the | 69 // Reads one or more buffers of audio from the device, passes on to the |
61 // registered callback. Called from SamplesReady(). | 70 // registered callback. Called from SamplesReady(). |
62 void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); | 71 void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); |
63 | 72 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const CRAS_STREAM_DIRECTION stream_direction_; | 108 const CRAS_STREAM_DIRECTION stream_direction_; |
100 | 109 |
101 scoped_ptr<AudioBus> audio_bus_; | 110 scoped_ptr<AudioBus> audio_bus_; |
102 | 111 |
103 DISALLOW_COPY_AND_ASSIGN(CrasInputStream); | 112 DISALLOW_COPY_AND_ASSIGN(CrasInputStream); |
104 }; | 113 }; |
105 | 114 |
106 } // namespace media | 115 } // namespace media |
107 | 116 |
108 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ | 117 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ |
OLD | NEW |