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