| 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_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
| 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "media/base/audio_renderer_sink.h" | 10 #include "media/base/audio_renderer_sink.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 class AudioRendererMixer; | 14 class AudioRendererMixer; |
| 15 | 15 |
| 16 class MEDIA_EXPORT AudioRendererMixerInput | 16 class MEDIA_EXPORT AudioRendererMixerInput |
| 17 : NON_EXPORTED_BASE(public AudioRendererSink) { | 17 : NON_EXPORTED_BASE(public AudioRendererSink) { |
| 18 public: | 18 public: |
| 19 explicit AudioRendererMixerInput( | 19 explicit AudioRendererMixerInput( |
| 20 const scoped_refptr<AudioRendererMixer>& mixer); | 20 const scoped_refptr<AudioRendererMixer>& mixer); |
| 21 | 21 |
| 22 // Each input should manage its own data buffer. The mixer will call this | |
| 23 // method when it needs a buffer for rendering. | |
| 24 const std::vector<float*>& audio_data() { return audio_data_; } | |
| 25 AudioRendererSink::RenderCallback* callback() { return callback_; } | 22 AudioRendererSink::RenderCallback* callback() { return callback_; } |
| 26 bool playing() { return playing_; } | 23 bool playing() { return playing_; } |
| 27 | 24 |
| 28 // AudioRendererSink implementation. | 25 // AudioRendererSink implementation. |
| 29 virtual void Start() OVERRIDE; | 26 virtual void Start() OVERRIDE; |
| 30 virtual void Stop() OVERRIDE; | 27 virtual void Stop() OVERRIDE; |
| 31 virtual void Play() OVERRIDE; | 28 virtual void Play() OVERRIDE; |
| 32 virtual void Pause(bool flush) OVERRIDE; | 29 virtual void Pause(bool flush) OVERRIDE; |
| 33 virtual bool SetVolume(double volume) OVERRIDE; | 30 virtual bool SetVolume(double volume) OVERRIDE; |
| 34 virtual void GetVolume(double* volume) OVERRIDE; | 31 virtual void GetVolume(double* volume) OVERRIDE; |
| 35 virtual void Initialize(const AudioParameters& params, | 32 virtual void Initialize(const AudioParameters& params, |
| 36 AudioRendererSink::RenderCallback* renderer) OVERRIDE; | 33 AudioRendererSink::RenderCallback* renderer) OVERRIDE; |
| 37 | 34 |
| 38 protected: | 35 protected: |
| 39 virtual ~AudioRendererMixerInput(); | 36 virtual ~AudioRendererMixerInput(); |
| 40 | 37 |
| 41 private: | 38 private: |
| 42 bool playing_; | 39 bool playing_; |
| 43 bool initialized_; | 40 bool initialized_; |
| 44 double volume_; | 41 double volume_; |
| 45 | 42 |
| 46 // AudioRendererMixer is reference counted by all its AudioRendererMixerInputs | 43 // AudioRendererMixer is reference counted by all its AudioRendererMixerInputs |
| 47 // and is destroyed when all AudioRendererMixerInputs have called RemoveMixer. | 44 // and is destroyed when all AudioRendererMixerInputs have called RemoveMixer. |
| 48 scoped_refptr<AudioRendererMixer> mixer_; | 45 scoped_refptr<AudioRendererMixer> mixer_; |
| 49 | 46 |
| 50 // Source of audio data which is provided to the mixer. | 47 // Source of audio data which is provided to the mixer. |
| 51 AudioRendererSink::RenderCallback* callback_; | 48 AudioRendererSink::RenderCallback* callback_; |
| 52 | 49 |
| 53 // Vector for rendering audio data which will be used by the mixer. | |
| 54 std::vector<float*> audio_data_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); | 50 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); |
| 57 }; | 51 }; |
| 58 | 52 |
| 59 } // namespace media | 53 } // namespace media |
| 60 | 54 |
| 61 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ | 55 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ |
| OLD | NEW |