Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: media/base/renderer.h

Issue 418143005: media: Introduce Renderer interface and RendererImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/base/renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 typedef base::Callback<base::TimeDelta()> TimeDeltaCB;
22
23 Renderer();
24
25 // Stops rendering and fires any pending callbacks.
26 virtual ~Renderer();
27
28 // Initializes the Renderer, executing |init_cb| upon completion.
29 // TODO(xhwang): Provide a set of DemuxerStreams in Initialize().
30 // TODO(xhwang): Replace |init_cb|, |flush_cb| and |stop_cb| with Closures.
damienv1 2014/08/22 16:39:48 1) I don't see a Stop. Is it missing ? (or Stop ca
xhwang 2014/08/22 19:11:31 Stop() has been folded into the dtor. Fixed the co
31 //
32 // Permanent callbacks:
33 // - |statistics_cb|: Executed periodically with rendering statistics.
34 // - |time_cb|: Executed whenever time has advanced through rendering.
35 // - |ended_cb|: Executed when rendering has reached the end of stream.
36 // - |error_cb|: Executed if any error was encountered during rendering.
37 virtual void Initialize(const PipelineStatusCB& init_cb,
38 const StatisticsCB& statistics_cb,
39 const base::Closure& ended_cb,
40 const PipelineStatusCB& error_cb,
41 const BufferingStateCB& buffering_state_cb,
42 const TimeDeltaCB& get_duration_cb) = 0;
43
44 // The following functions must be called after Initialize().
45
46 // Discards any buffered data, executing |done_cb| when completed.
damienv1 2014/08/22 16:39:48 nit: done_cb VS flush_cb
xhwang 2014/08/22 19:11:31 Done.
47 virtual void Flush(const base::Closure& flush_cb) = 0;
48
49 // Starts rendering from |timestamp|.
50 // TODO(xhwang): Switch to SetMediaTime() + StartPlaying() model?
51 virtual void StartPlayingFrom(base::TimeDelta timestamp) = 0;
52
53 // Updates the current playback rate. The default playback rate should be 1.
54 virtual void SetPlaybackRate(float playback_rate) = 0;
55
56 // Sets the output volume. The default volume should be 1.
57 virtual void SetVolume(float volume) = 0;
58
59 virtual base::TimeDelta GetMediaTime() = 0;
60
61 virtual bool HasAudio() = 0;
62
63 virtual bool HasVideo() = 0;
64
65 // Associates the |cdm| with this Renderer.
66 virtual void SetCdm(MediaKeys* cdm) = 0;
67
68 // Helper functions for testing purposes. Must be called before Initialize().
69 virtual void DisableUnderflowForTesting();
70 virtual void SetTimeDeltaInterpolatorForTesting(
71 TimeDeltaInterpolator* interpolator);
damienv1 2014/08/22 16:39:48 I don't think this should belong to the base class
xhwang 2014/08/22 19:11:31 scherkus@ had the same comment. Removed and only h
72
73 private:
74 DISALLOW_COPY_AND_ASSIGN(Renderer);
75 };
76
77 } // namespace media
78
79 #endif // MEDIA_BASE_RENDERER_H_
OLDNEW
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/base/renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698