| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_OUTPUT_STREAM_PROXY_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "media/audio/audio_io.h" | 10 #include "media/audio/audio_io.h" |
| 11 #include "media/audio/audio_parameters.h" | 11 #include "media/audio/audio_parameters.h" |
| 12 | 12 |
| 13 class AudioOutputDispatcher; | 13 class AudioOutputDispatcher; |
| 14 | 14 |
| 15 // AudioOutputProxy is an audio otput stream that uses resources more | 15 // AudioOutputProxy is an audio otput stream that uses resources more |
| 16 // efficiently than a regular audio output stream: it opens audio | 16 // efficiently than a regular audio output stream: it opens audio |
| 17 // device only when sound is playing, i.e. between Start() and Stop() | 17 // device only when sound is playing, i.e. between Start() and Stop() |
| 18 // (there is still one physical stream per each audio output proxy in | 18 // (there is still one physical stream per each audio output proxy in |
| 19 // playing state). | 19 // playing state). |
| 20 // | 20 // |
| 21 // AudioOutputProxy uses AudioOutputDispatcher to open and close | 21 // AudioOutputProxy uses AudioOutputDispatcher to open and close |
| 22 // physical output streams. | 22 // physical output streams. |
| 23 class MEDIA_EXPORT AudioOutputProxy : public AudioOutputStream { | 23 class MEDIA_EXPORT AudioOutputProxy : public AudioOutputStream { |
| 24 public: | 24 public: |
| 25 // Caller keeps ownership of |dispatcher|. | 25 // Caller keeps ownership of |dispatcher|. |
| 26 AudioOutputProxy(AudioOutputDispatcher* dispatcher); | 26 AudioOutputProxy(AudioOutputDispatcher* dispatcher); |
| 27 | 27 |
| 28 // AudioOutputStream interface. | 28 // AudioOutputStream interface. |
| 29 virtual bool Open(); | 29 virtual bool Open() OVERRIDE; |
| 30 virtual void Start(AudioSourceCallback* callback); | 30 virtual void Start(AudioSourceCallback* callback) OVERRIDE; |
| 31 virtual void Stop(); | 31 virtual void Stop() OVERRIDE; |
| 32 virtual void SetVolume(double volume); | 32 virtual void SetVolume(double volume) OVERRIDE; |
| 33 virtual void GetVolume(double* volume); | 33 virtual void GetVolume(double* volume) OVERRIDE; |
| 34 virtual void Close(); | 34 virtual void Close() OVERRIDE; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // Needs to access destructor. | 37 // Needs to access destructor. |
| 38 friend class DeleteTask<AudioOutputProxy>; | 38 friend class DeleteTask<AudioOutputProxy>; |
| 39 | 39 |
| 40 enum State { | 40 enum State { |
| 41 kCreated, | 41 kCreated, |
| 42 kOpened, | 42 kOpened, |
| 43 kPlaying, | 43 kPlaying, |
| 44 kClosed, | 44 kClosed, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 AudioOutputStream* physical_stream_; | 55 AudioOutputStream* physical_stream_; |
| 56 | 56 |
| 57 // Need to save volume here, so that we can restore it in case the stream | 57 // Need to save volume here, so that we can restore it in case the stream |
| 58 // is stopped, and then started again. | 58 // is stopped, and then started again. |
| 59 double volume_; | 59 double volume_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy); | 61 DISALLOW_COPY_AND_ASSIGN(AudioOutputProxy); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H_ | 64 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_PROXY_H_ |
| OLD | NEW |