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

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

Issue 10796074: Move VideoRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: GetMediaTime Created 8 years, 5 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/video_frame_unittest.cc ('k') | media/base/video_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
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_VIDEO_RENDERER_H_ 5 #ifndef MEDIA_BASE_VIDEO_RENDERER_H_
6 #define MEDIA_BASE_VIDEO_RENDERER_H_ 6 #define MEDIA_BASE_VIDEO_RENDERER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "media/base/filters.h"
12 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
13 #include "media/base/pipeline_status.h" 12 #include "media/base/pipeline_status.h"
14 13
14 namespace gfx {
15 class Size;
16 }
17
15 namespace media { 18 namespace media {
16 19
17 class VideoDecoder; 20 class VideoDecoder;
18 21
19 class MEDIA_EXPORT VideoRenderer : public Filter { 22 class MEDIA_EXPORT VideoRenderer
23 : public base::RefCountedThreadSafe<VideoRenderer> {
20 public: 24 public:
21 // Used to update the pipeline's clock time. The parameter is the time that 25 // Used to update the pipeline's clock time. The parameter is the time that
22 // the clock should not exceed. 26 // the clock should not exceed.
23 typedef base::Callback<void(base::TimeDelta)> TimeCB; 27 typedef base::Callback<void(base::TimeDelta)> TimeCB;
24 28
25 // Initialize a VideoRenderer with the given VideoDecoder, executing the 29 // Executed when the natural size of the video has changed.
26 // callback upon completion. 30 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB;
31
32 // Used to query the current time or duration of the media.
33 typedef base::Callback<base::TimeDelta()> TimeDeltaCB;
34
35 // Initialize a VideoRenderer with the given VideoDecoder, executing
36 // |init_cb| callback upon completion.
37 //
38 // |statistics_cb| is executed periodically with video rendering stats, such
39 // as dropped frames.
40 //
41 // |time_cb| is executed whenever time has advanced by way of video rendering.
42 //
43 // |size_changed_cb| is executed whenever the dimensions of the video has
44 // changed.
45 //
46 // |ended_cb| is executed when video rendering has reached the end of stream.
47 //
48 // |error_cb| is executed if an error was encountered.
49 //
50 // |get_time_cb| is used to query the current media playback time.
51 //
52 // |get_duration_cb| is used to query the media duration.
27 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder, 53 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder,
28 const PipelineStatusCB& status_cb, 54 const PipelineStatusCB& init_cb,
29 const StatisticsCB& statistics_cb, 55 const StatisticsCB& statistics_cb,
30 const TimeCB& time_cb) = 0; 56 const TimeCB& time_cb,
57 const NaturalSizeChangedCB& size_changed_cb,
58 const base::Closure& ended_cb,
59 const PipelineStatusCB& error_cb,
60 const TimeDeltaCB& get_time_cb,
61 const TimeDeltaCB& get_duration_cb) = 0;
31 62
32 // Returns true if this filter has received and processed an end-of-stream 63 // Start audio decoding and rendering at the current playback rate, executing
33 // buffer. 64 // |callback| when playback is underway.
65 virtual void Play(const base::Closure& callback) = 0;
66
67 // Temporarily suspend decoding and rendering video, executing |callback| when
68 // playback has been suspended.
69 virtual void Pause(const base::Closure& callback) = 0;
70
71 // Discard any video data, executing |callback| when completed.
72 virtual void Flush(const base::Closure& callback) = 0;
73
74 // Start prerolling video data for samples starting at |time|, executing
75 // |callback| when completed.
76 //
77 // Only valid to call after a successful Initialize() or Flush().
78 //
79 // TODO(scherkus): rename this to Preroll().
80 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback) = 0;
81
82 // Stop all operations in preparation for being deleted, executing |callback|
83 // when complete.
84 virtual void Stop(const base::Closure& callback) = 0;
85
86 // Updates the current playback rate.
87 virtual void SetPlaybackRate(float playback_rate) = 0;
88
89 // Returns true if all video data has been rendered.
34 virtual bool HasEnded() = 0; 90 virtual bool HasEnded() = 0;
35 91
36 protected: 92 protected:
37 virtual ~VideoRenderer() {} 93 friend class base::RefCountedThreadSafe<VideoRenderer>;
94
95 VideoRenderer();
96 virtual ~VideoRenderer();
97
98 private:
99 DISALLOW_COPY_AND_ASSIGN(VideoRenderer);
38 }; 100 };
39 101
40 } // namespace media 102 } // namespace media
41 103
42 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ 104 #endif // MEDIA_BASE_VIDEO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | media/base/video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698