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_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/buffering_state.h" | 10 #include "media/base/buffering_state.h" |
11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
12 #include "media/base/pipeline_status.h" | 12 #include "media/base/pipeline_status.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 class DemuxerStream; | 16 class DemuxerStream; |
17 class TimeSource; | 17 class TimeSource; |
18 | 18 |
19 class MEDIA_EXPORT AudioRenderer { | 19 class MEDIA_EXPORT AudioRenderer { |
20 public: | 20 public: |
21 // First parameter is the current time that has been rendered. | 21 // First parameter is the current time that has been rendered. |
22 // Second parameter is the maximum time value that the clock cannot exceed. | 22 // Second parameter is the maximum time value that the clock cannot exceed. |
23 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; | 23 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB; |
24 | 24 |
25 AudioRenderer(); | 25 AudioRenderer(); |
| 26 |
| 27 // Stop all operations and fire all pending callbacks. |
26 virtual ~AudioRenderer(); | 28 virtual ~AudioRenderer(); |
27 | 29 |
28 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon | 30 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon |
29 // completion. | 31 // completion. |
30 // | 32 // |
31 // |statistics_cb| is executed periodically with audio rendering stats. | 33 // |statistics_cb| is executed periodically with audio rendering stats. |
32 // | 34 // |
33 // |time_cb| is executed whenever time has advanced by way of audio rendering. | 35 // |time_cb| is executed whenever time has advanced by way of audio rendering. |
34 // | 36 // |
35 // |buffering_state_cb| is executed when audio rendering has either run out of | 37 // |buffering_state_cb| is executed when audio rendering has either run out of |
(...skipping 17 matching lines...) Expand all Loading... |
53 // | 55 // |
54 // Clients should expect |buffering_state_cb| to be called with | 56 // Clients should expect |buffering_state_cb| to be called with |
55 // BUFFERING_HAVE_NOTHING while flushing is in progress. | 57 // BUFFERING_HAVE_NOTHING while flushing is in progress. |
56 virtual void Flush(const base::Closure& callback) = 0; | 58 virtual void Flush(const base::Closure& callback) = 0; |
57 | 59 |
58 // Starts playback by reading from |stream| and decoding and rendering audio. | 60 // Starts playback by reading from |stream| and decoding and rendering audio. |
59 // | 61 // |
60 // Only valid to call after a successful Initialize() or Flush(). | 62 // Only valid to call after a successful Initialize() or Flush(). |
61 virtual void StartPlaying() = 0; | 63 virtual void StartPlaying() = 0; |
62 | 64 |
63 // Stop all operations in preparation for being deleted, executing |callback| | |
64 // when complete. | |
65 virtual void Stop(const base::Closure& callback) = 0; | |
66 | |
67 // Sets the output volume. | 65 // Sets the output volume. |
68 virtual void SetVolume(float volume) = 0; | 66 virtual void SetVolume(float volume) = 0; |
69 | 67 |
70 private: | 68 private: |
71 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); | 69 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); |
72 }; | 70 }; |
73 | 71 |
74 } // namespace media | 72 } // namespace media |
75 | 73 |
76 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ | 74 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ |
OLD | NEW |