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_SINK_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 int number_of_frames, | 31 int number_of_frames, |
32 int audio_delay_milliseconds) = 0; | 32 int audio_delay_milliseconds) = 0; |
33 | 33 |
34 // Signals an error has occurred. | 34 // Signals an error has occurred. |
35 virtual void OnRenderError() = 0; | 35 virtual void OnRenderError() = 0; |
36 | 36 |
37 protected: | 37 protected: |
38 virtual ~RenderCallback() {} | 38 virtual ~RenderCallback() {} |
39 }; | 39 }; |
40 | 40 |
41 virtual ~AudioRendererSink() {} | |
42 | |
43 // Sets important information about the audio stream format. | 41 // Sets important information about the audio stream format. |
44 // It must be called before any of the other methods. | 42 // It must be called before any of the other methods. |
45 virtual void Initialize(const AudioParameters& params, | 43 virtual void Initialize(const AudioParameters& params, |
46 RenderCallback* callback) = 0; | 44 RenderCallback* callback) = 0; |
47 | 45 |
48 // Starts audio playback. | 46 // Starts audio playback. |
49 virtual void Start() = 0; | 47 virtual void Start() = 0; |
50 | 48 |
51 // Stops audio playback. | 49 // Stops audio playback. |
52 virtual void Stop() = 0; | 50 virtual void Stop() = 0; |
53 | 51 |
54 // Pauses playback. | 52 // Pauses playback. |
55 virtual void Pause(bool flush) = 0; | 53 virtual void Pause(bool flush) = 0; |
56 | 54 |
57 // Resumes playback after calling Pause(). | 55 // Resumes playback after calling Pause(). |
58 virtual void Play() = 0; | 56 virtual void Play() = 0; |
59 | 57 |
60 // Called to inform the sink of a change in playback rate. Override if | 58 // Called to inform the sink of a change in playback rate. Override if |
61 // subclass needs the playback rate. | 59 // subclass needs the playback rate. |
62 virtual void SetPlaybackRate(float rate) {} | 60 virtual void SetPlaybackRate(float rate) {} |
63 | 61 |
64 // Sets the playback volume, with range [0.0, 1.0] inclusive. | 62 // Sets the playback volume, with range [0.0, 1.0] inclusive. |
65 // Returns |true| on success. | 63 // Returns |true| on success. |
66 virtual bool SetVolume(double volume) = 0; | 64 virtual bool SetVolume(double volume) = 0; |
67 | 65 |
68 // Gets the playback volume, with range [0.0, 1.0] inclusive. | 66 // Gets the playback volume, with range [0.0, 1.0] inclusive. |
69 virtual void GetVolume(double* volume) = 0; | 67 virtual void GetVolume(double* volume) = 0; |
| 68 |
| 69 protected: |
| 70 friend class base::RefCountedThreadSafe<AudioRendererSink>; |
| 71 virtual ~AudioRendererSink() {} |
70 }; | 72 }; |
71 | 73 |
72 } // namespace media | 74 } // namespace media |
73 | 75 |
74 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 76 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |