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 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 // The ctor takes all the usual parameters, plus |manager| which is the | 30 // The ctor takes all the usual parameters, plus |manager| which is the |
31 // audio manager who is creating this object. | 31 // audio manager who is creating this object. |
32 CrasUnifiedStream(const AudioParameters& params, AudioManagerCras* manager); | 32 CrasUnifiedStream(const AudioParameters& params, AudioManagerCras* manager); |
33 | 33 |
34 // The dtor is typically called by the AudioManager only and it is usually | 34 // The dtor is typically called by the AudioManager only and it is usually |
35 // triggered by calling AudioUnifiedStream::Close(). | 35 // triggered by calling AudioUnifiedStream::Close(). |
36 virtual ~CrasUnifiedStream(); | 36 virtual ~CrasUnifiedStream(); |
37 | 37 |
38 // Implementation of AudioOutputStream. | 38 // Implementation of AudioOutputStream. |
39 virtual bool Open() OVERRIDE; | 39 virtual bool Open() override; |
40 virtual void Close() OVERRIDE; | 40 virtual void Close() override; |
41 virtual void Start(AudioSourceCallback* callback) OVERRIDE; | 41 virtual void Start(AudioSourceCallback* callback) override; |
42 virtual void Stop() OVERRIDE; | 42 virtual void Stop() override; |
43 virtual void SetVolume(double volume) OVERRIDE; | 43 virtual void SetVolume(double volume) override; |
44 virtual void GetVolume(double* volume) OVERRIDE; | 44 virtual void GetVolume(double* volume) override; |
45 | 45 |
46 private: | 46 private: |
47 // Convert Latency in time to bytes. | 47 // Convert Latency in time to bytes. |
48 uint32 GetBytesLatency(const struct timespec& latency); | 48 uint32 GetBytesLatency(const struct timespec& latency); |
49 | 49 |
50 // Handles captured audio and fills the ouput with audio to be played. | 50 // Handles captured audio and fills the ouput with audio to be played. |
51 static int UnifiedCallback(cras_client* client, | 51 static int UnifiedCallback(cras_client* client, |
52 cras_stream_id_t stream_id, | 52 cras_stream_id_t stream_id, |
53 uint8* input_samples, | 53 uint8* input_samples, |
54 uint8* output_samples, | 54 uint8* output_samples, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Direciton of the stream. | 106 // Direciton of the stream. |
107 CRAS_STREAM_DIRECTION stream_direction_; | 107 CRAS_STREAM_DIRECTION stream_direction_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); | 109 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace media | 112 } // namespace media |
113 | 113 |
114 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 114 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
OLD | NEW |