Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_RENDERER_H_ | |
| 6 #define MEDIA_BASE_RENDERER_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "media/base/buffering_state.h" | |
| 11 #include "media/base/media_export.h" | |
| 12 #include "media/base/pipeline_status.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 class MediaKeys; | |
| 17 class TimeDeltaInterpolator; | |
| 18 | |
| 19 class MEDIA_EXPORT Renderer { | |
| 20 public: | |
| 21 Renderer(); | |
| 22 | |
| 23 // Stops rendering and fires any pending callbacks. | |
| 24 virtual ~Renderer(); | |
| 25 | |
| 26 // Initializes the Renderer, executing |init_cb| upon completion. | |
| 27 // TODO(xhwang): Provide a set of DemuxerStreams in Initialize(). | |
| 28 // TODO(xhwang): Replace |init_cb|, |flush_cb| and |stop_cb| with Closures. | |
| 29 // | |
| 30 // Permanent callbacks: | |
| 31 // - |statistics_cb|: Executed periodically with rendering statistics. | |
| 32 // - |time_cb|: Executed whenever time has advanced through rendering. | |
| 33 // - |ended_cb|: Executed when rendering has reached the end of stream. | |
| 34 // - |error_cb|: Executed if any error was encountered during rendering. | |
| 35 virtual void Initialize(const PipelineStatusCB& init_cb, | |
| 36 const StatisticsCB& statistics_cb, | |
| 37 const base::Closure& ended_cb, | |
| 38 const PipelineStatusCB& error_cb, | |
| 39 const BufferingStateCB& buffering_state_cb) = 0; | |
| 40 | |
| 41 // Discards any buffered data, executing |done_cb| when completed. | |
| 42 virtual void Flush(const base::Closure& flush_cb) = 0; | |
| 43 | |
| 44 // Starts rendering from |timestamp|. | |
| 45 // TODO(xhwang): Switch to SetMediaTime() + StartPlaying() model? | |
|
xhwang
2014/07/25 00:39:29
See TODO :)
| |
| 46 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0; | |
| 47 | |
| 48 // Updates the current playback rate. The default playback rate should be 1. | |
| 49 virtual void SetPlaybackRate(float playback_rate) = 0; | |
| 50 | |
| 51 // Sets the output volume. The default volume should be 1. | |
| 52 virtual void SetVolume(float volume) = 0; | |
| 53 | |
| 54 virtual base::TimeDelta GetMediaTime() const = 0; | |
| 55 | |
| 56 virtual bool HasAudio() const = 0; | |
| 57 | |
| 58 virtual bool HasVideo() const = 0; | |
| 59 | |
| 60 // Associates the |cdm| with this Renderer. | |
| 61 virtual void SetCdm(MediaKeys* cdm) = 0; | |
| 62 | |
| 63 // Helper functions for testing purposes. Must be called before Initialize(). | |
| 64 virtual void DisableUnderflowForTesting(); | |
| 65 virtual void SetTimeDeltaInterpolatorForTesting( | |
| 66 TimeDeltaInterpolator* interpolator); | |
|
xhwang
2014/07/25 00:39:29
It's ugly to put these two here. But I don't have
| |
| 67 | |
| 68 private: | |
| 69 DISALLOW_COPY_AND_ASSIGN(Renderer); | |
| 70 }; | |
| 71 | |
| 72 } // namespace media | |
| 73 | |
| 74 #endif // MEDIA_BASE_RENDERER_H_ | |
| OLD | NEW |