| 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/decryptor.h" | 11 #include "media/base/decryptor.h" |
| 12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 #include "media/base/pipeline_status.h" | 13 #include "media/base/pipeline_status.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class DemuxerStream; | 17 class DemuxerStream; |
| 18 class TimeSource; | 18 class TimeSource; |
| 19 | 19 |
| 20 class MEDIA_EXPORT AudioRenderer { | 20 class MEDIA_EXPORT AudioRenderer { |
| 21 public: | 21 public: |
| 22 AudioRenderer(); | 22 AudioRenderer(); |
| 23 | 23 |
| 24 // Stop all operations and fire all pending callbacks. | 24 // Stop all operations and fire all pending callbacks. |
| 25 virtual ~AudioRenderer(); | 25 virtual ~AudioRenderer(); |
| 26 | 26 |
| 27 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon | 27 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon |
| 28 // completion. | 28 // completion. If initialization fails, only |init_cb| (not |error_cb|) will |
| 29 // be called. |
| 29 // | 30 // |
| 30 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the | 31 // |set_decryptor_ready_cb| is fired when a Decryptor is needed, i.e. when the |
| 31 // |stream| is encrypted. | 32 // |stream| is encrypted. |
| 32 // | 33 // |
| 33 // |statistics_cb| is executed periodically with audio rendering stats. | 34 // |statistics_cb| is executed periodically with audio rendering stats. |
| 34 // | 35 // |
| 35 // |buffering_state_cb| is executed when audio rendering has either run out of | 36 // |buffering_state_cb| is executed when audio rendering has either run out of |
| 36 // data or has enough data to continue playback. | 37 // data or has enough data to continue playback. |
| 37 // | 38 // |
| 38 // |ended_cb| is executed when audio rendering has reached the end of stream. | 39 // |ended_cb| is executed when audio rendering has reached the end of stream. |
| 39 // | 40 // |
| 40 // |error_cb| is executed if an error was encountered. | 41 // |error_cb| is executed if an error was encountered after initialization. |
| 41 virtual void Initialize(DemuxerStream* stream, | 42 virtual void Initialize(DemuxerStream* stream, |
| 42 const PipelineStatusCB& init_cb, | 43 const PipelineStatusCB& init_cb, |
| 43 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 44 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
| 44 const StatisticsCB& statistics_cb, | 45 const StatisticsCB& statistics_cb, |
| 45 const BufferingStateCB& buffering_state_cb, | 46 const BufferingStateCB& buffering_state_cb, |
| 46 const base::Closure& ended_cb, | 47 const base::Closure& ended_cb, |
| 47 const PipelineStatusCB& error_cb) = 0; | 48 const PipelineStatusCB& error_cb) = 0; |
| 48 | 49 |
| 49 // Returns the TimeSource associated with audio rendering. | 50 // Returns the TimeSource associated with audio rendering. |
| 50 virtual TimeSource* GetTimeSource() = 0; | 51 virtual TimeSource* GetTimeSource() = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 63 // Sets the output volume. | 64 // Sets the output volume. |
| 64 virtual void SetVolume(float volume) = 0; | 65 virtual void SetVolume(float volume) = 0; |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); | 68 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace media | 71 } // namespace media |
| 71 | 72 |
| 72 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ | 73 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ |
| OLD | NEW |