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

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: 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
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
29 // Executed when the natural size of the video has changed.
30 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB;
31
32 // Used to query the current time and duration of the media.
Ami GONE FROM CHROMIUM 2012/07/21 05:02:35 s/and/or/
scherkus (not reviewing) 2012/07/23 03:21:12 Done.
33 typedef base::Callback<base::TimeDelta()> TimeDeltaCB;
34
25 // Initialize a VideoRenderer with the given VideoDecoder, executing the 35 // Initialize a VideoRenderer with the given VideoDecoder, executing the
26 // callback upon completion. 36 // callback upon completion.
27 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder, 37 virtual void Initialize(const scoped_refptr<VideoDecoder>& decoder,
28 const PipelineStatusCB& status_cb, 38 const PipelineStatusCB& status_cb,
29 const StatisticsCB& statistics_cb, 39 const StatisticsCB& statistics_cb,
30 const TimeCB& time_cb) = 0; 40 const TimeCB& time_cb,
41 const NaturalSizeChangedCB& size_changed_cb,
42 const base::Closure& ended_cb,
43 const PipelineStatusCB& error_cb,
Ami GONE FROM CHROMIUM 2012/07/21 05:02:35 This highlights that "status_cb" is a bad name (sh
scherkus (not reviewing) 2012/07/23 03:21:12 Agreed - changed status_cb to init_cb
44 const TimeDeltaCB& get_time_cb,
45 const TimeDeltaCB& get_duration_cb) = 0;
31 46
32 // Returns true if this filter has received and processed an end-of-stream 47 // Start audio decoding and rendering at the current playback rate, executing
33 // buffer. 48 // |callback| when playback is underway.
49 virtual void Play(const base::Closure& callback) = 0;
50
51 // Temporarily suspend decoding and rendering video, executing |callback| when
52 // playback has been suspended.
53 virtual void Pause(const base::Closure& callback) = 0;
54
55 // Discard any video data, executing |callback| when completed.
56 virtual void Flush(const base::Closure& callback) = 0;
57
58 // Start prerolling video data for samples starting at |time|, executing
59 // |callback| when completed.
60 //
61 // Only valid to call after a successful Initialize() or Flush().
62 //
63 // TODO(scherkus): rename this to Preroll().
64 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback) = 0;
65
66 // Stop all operations in preparation for being deleted, executing |callback|
67 // when complete.
68 virtual void Stop(const base::Closure& callback) = 0;
69
70 // Updates the current playback rate.
71 virtual void SetPlaybackRate(float playback_rate) = 0;
72
73 // Returns true if all video data has been rendered.
34 virtual bool HasEnded() = 0; 74 virtual bool HasEnded() = 0;
35 75
36 protected: 76 protected:
37 virtual ~VideoRenderer() {} 77 friend class base::RefCountedThreadSafe<VideoRenderer>;
78
79 VideoRenderer();
80 virtual ~VideoRenderer();
81
82 private:
83 DISALLOW_COPY_AND_ASSIGN(VideoRenderer);
38 }; 84 };
39 85
40 } // namespace media 86 } // namespace media
41 87
42 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ 88 #endif // MEDIA_BASE_VIDEO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698