OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ |
6 #define MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ | 6 #define MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ |
7 | 7 |
8 #include "media/audio/virtual_audio_sink.h" | |
8 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
9 | 10 |
10 // Audio sources may optionally implement AudioSourceDiverter to temporarily | 11 // Audio sources may optionally implement AudioSourceDiverter to temporarily |
11 // divert audio data to an alternate AudioOutputStream. This allows the audio | 12 // divert audio data to an alternate AudioOutputStream. This allows the audio |
12 // data to be plumbed to an alternate consumer; for example, a loopback | 13 // data to be plumbed to an alternate consumer; for example, a loopback |
13 // mechanism for audio mirroring. | 14 // mechanism for audio mirroring. |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
17 class AudioOutputStream; | 18 class AudioOutputStream; |
18 class AudioParameters; | 19 class AudioParameters; |
19 | 20 |
20 class MEDIA_EXPORT AudioSourceDiverter { | 21 class MEDIA_EXPORT AudioSourceDiverter { |
21 public: | 22 public: |
22 // Returns the audio parameters of the divertable audio data. | 23 // Returns the audio parameters of the divertable audio data. |
23 virtual const AudioParameters& GetAudioParameters() = 0; | 24 virtual const AudioParameters& GetAudioParameters() = 0; |
24 | 25 |
25 // Start providing audio data to the given |to_stream|, which is in an | 26 // Start providing audio data to the given |to_stream|, which is in an |
26 // unopened state. |to_stream| remains under the control of the | 27 // unopened state. |to_stream| remains under the control of the |
27 // AudioSourceDiverter. | 28 // AudioSourceDiverter. |
28 virtual void StartDiverting(AudioOutputStream* to_stream) = 0; | 29 virtual void StartDiverting(AudioOutputStream* to_stream) = 0; |
29 | 30 |
30 // Stops diverting audio data to the stream. The AudioSourceDiverter is | 31 // Stops diverting audio data to the stream. The AudioSourceDiverter is |
31 // responsible for making sure the stream is closed, perhaps asynchronously. | 32 // responsible for making sure the stream is closed, perhaps asynchronously. |
32 virtual void StopDiverting() = 0; | 33 virtual void StopDiverting() = 0; |
33 | 34 |
34 protected: | 35 // Start duplicating the current audio stream, and push the copied data into |
36 // |sink|. | |
37 virtual void StartDuplicating(AudioPushSink* sink) = 0; | |
38 | |
39 // Stop duplicating for the specified |sink|. | |
miu
2016/05/02 20:06:13
Please add to this comment that "The AudioSourceDi
qiangchen
2016/05/03 16:58:23
Done.
| |
40 virtual void StopDuplicating(AudioPushSink* sink) = 0; | |
41 | |
42 protected: | |
35 virtual ~AudioSourceDiverter() {} | 43 virtual ~AudioSourceDiverter() {} |
36 }; | 44 }; |
37 | 45 |
38 } // namespace media | 46 } // namespace media |
39 | 47 |
40 #endif // MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ | 48 #endif // MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ |
OLD | NEW |