Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_AUDIO_VIRTUAL_AUDIO_OUTPUT_STREAM_H_ | |
| 6 #define MEDIA_AUDIO_VIRTUAL_AUDIO_OUTPUT_STREAM_H_ | |
| 7 | |
| 8 #include "media/audio/audio_io.h" | |
| 9 #include "media/audio/audio_parameters.h" | |
| 10 #include "media/base/audio_converter.h" | |
| 11 | |
| 12 namespace media { | |
| 13 | |
| 14 class AudioManagerBase; | |
| 15 class VirtualAudioInputStream; | |
| 16 | |
| 17 // VirtualAudioOutputStream attaches to a VirtualAudioInputStream when Start() | |
| 18 // is called and is used as an audio source. VirtualAudioOutputStream also | |
| 19 // implements an interface so it can be used as an input to AudioConverter so | |
| 20 // that we can get audio frames that match the AudioParameters that | |
| 21 // VirtualAudioInputStream expects. | |
| 22 class MEDIA_EXPORT VirtualAudioOutputStream | |
|
DaleCurtis
2012/11/28 23:43:18
This class should still have a unit test.
| |
| 23 : public AudioOutputStream, | |
| 24 public AudioConverter::InputCallback { | |
| 25 public: | |
| 26 static VirtualAudioOutputStream* MakeStream(AudioManagerBase* manager, | |
| 27 const AudioParameters& params, | |
| 28 VirtualAudioInputStream* target); | |
| 29 | |
| 30 // AudioOutputStream: | |
| 31 virtual bool Open() OVERRIDE; | |
| 32 virtual void Start(AudioSourceCallback* callback) OVERRIDE; | |
| 33 virtual void Stop() OVERRIDE; | |
| 34 virtual void SetVolume(double volume) OVERRIDE; | |
| 35 virtual void GetVolume(double* volume) OVERRIDE; | |
| 36 virtual void Close() OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 VirtualAudioOutputStream(AudioManagerBase* manager, | |
| 40 const AudioParameters& params, | |
| 41 VirtualAudioInputStream* target); | |
| 42 virtual ~VirtualAudioOutputStream(); | |
|
DaleCurtis
2012/11/28 23:43:18
Hmm this works? Isn't AudioManager deleting this o
justinlin
2012/11/29 10:22:01
Yea, seems strange but it does work. AudioOutputSt
| |
| 43 | |
| 44 // AudioConverter::InputCallback: | |
| 45 virtual double ProvideInput(AudioBus* audio_bus, | |
| 46 base::TimeDelta buffer_delay) OVERRIDE; | |
|
DaleCurtis
2012/11/28 23:43:18
Indent is wrong, all aligned or 4 space indent. Fo
justinlin
2012/11/29 10:08:33
Done.
| |
| 47 | |
| 48 AudioManagerBase* audio_manager_; | |
| 49 AudioSourceCallback* callback_; | |
| 50 AudioParameters params_; | |
| 51 | |
| 52 // Pointer to the VirtualAudioInputStream to attach to when Start() is called. | |
| 53 // This pointer should always be valid because VirtualAudioInputStream should | |
| 54 // outlive this class. | |
| 55 VirtualAudioInputStream* target_input_stream_; | |
| 56 float volume_; | |
| 57 bool attached_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(VirtualAudioOutputStream); | |
| 60 }; | |
| 61 | |
| 62 } // namespace media | |
| 63 | |
| 64 #endif // MEDIA_AUDIO_VIRTUAL_AUDIO_OUTPUT_STREAM_H_ | |
| OLD | NEW |