Chromium Code Reviews| Index: media/base/renderer.h |
| diff --git a/media/base/renderer.h b/media/base/renderer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e6163e32b35d529f5f8b8a31a29ff9831f18780 |
| --- /dev/null |
| +++ b/media/base/renderer.h |
| @@ -0,0 +1,77 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_BASE_RENDERER_H_ |
| +#define MEDIA_BASE_RENDERER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/time/time.h" |
| +#include "media/base/buffering_state.h" |
| +#include "media/base/media_export.h" |
| +#include "media/base/pipeline_status.h" |
| + |
| +namespace media { |
| + |
| +class MediaKeys; |
| +class TimeDeltaInterpolator; |
| + |
| +class MEDIA_EXPORT Renderer { |
| + public: |
| + typedef base::Callback<base::TimeDelta()> TimeDeltaCB; |
| + |
| + Renderer(); |
| + |
| + // Stops rendering and fires any pending callbacks. |
| + virtual ~Renderer(); |
| + |
| + // Initializes the Renderer, executing |init_cb| upon completion. |
| + // TODO(xhwang): Provide a set of DemuxerStreams in Initialize(). |
| + // TODO(xhwang): Replace |init_cb| and |flush_cb| with Closures. |
|
tim (not reviewing)
2014/08/22 22:26:42
nit: Looks like you already did this for |flush_cb
xhwang
2014/08/22 22:48:23
Done.
|
| + // |
| + // Permanent callbacks: |
| + // - |statistics_cb|: Executed periodically with rendering statistics. |
| + // - |time_cb|: Executed whenever time has advanced through rendering. |
| + // - |ended_cb|: Executed when rendering has reached the end of stream. |
| + // - |error_cb|: Executed if any error was encountered during rendering. |
| + virtual void Initialize(const PipelineStatusCB& init_cb, |
| + const StatisticsCB& statistics_cb, |
| + const base::Closure& ended_cb, |
| + const PipelineStatusCB& error_cb, |
| + const BufferingStateCB& buffering_state_cb, |
| + const TimeDeltaCB& get_duration_cb) = 0; |
| + |
| + // The following functions must be called after Initialize(). |
| + |
| + // Discards any buffered data, executing |flush_cb| when completed. |
| + virtual void Flush(const base::Closure& flush_cb) = 0; |
| + |
| + // Starts rendering from |time|. |
| + // TODO(xhwang): Switch to SetMediaTime() + StartPlaying() model? |
|
scherkus (not reviewing)
2014/08/22 20:50:01
does this still need to be done? should we chat ab
xhwang
2014/08/22 22:48:23
Dropped the TODO. SetMediaTime() doesn't make too
|
| + virtual void StartPlayingFrom(base::TimeDelta time) = 0; |
| + |
| + // Updates the current playback rate. The default playback rate should be 1. |
| + virtual void SetPlaybackRate(float playback_rate) = 0; |
| + |
| + // Sets the output volume. The default volume should be 1. |
| + virtual void SetVolume(float volume) = 0; |
| + |
| + // Returns the current media time. |
| + virtual base::TimeDelta GetMediaTime() = 0; |
|
scherkus (not reviewing)
2014/08/22 20:50:01
note that this is the only method that gets called
xhwang
2014/08/22 22:48:23
I have that comment in renderer_impl.h. I am hesit
|
| + |
| + // Returns whether |this| renders audio. |
| + virtual bool HasAudio() = 0; |
| + |
| + // Returns whether |this| renders video. |
| + virtual bool HasVideo() = 0; |
| + |
| + // Associates the |cdm| with this Renderer. |
| + virtual void SetCdm(MediaKeys* cdm) = 0; |
|
scherkus (not reviewing)
2014/08/22 20:50:01
does this need to be on the interface, or can it b
xhwang
2014/08/22 22:48:23
It needs to be on the interface because all Render
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Renderer); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_BASE_RENDERER_H_ |