OLD | NEW |
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 <list> | 8 #include <list> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 #include "media/base/pipeline_status.h" | 14 #include "media/base/pipeline_status.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Size; | 17 class Size; |
18 } | 18 } |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 class DemuxerStream; | 22 class DemuxerStream; |
23 class VideoDecoder; | 23 class VideoDecoder; |
24 | 24 |
25 class MEDIA_EXPORT VideoRenderer { | 25 class MEDIA_EXPORT VideoRenderer |
| 26 : public base::RefCountedThreadSafe<VideoRenderer> { |
26 public: | 27 public: |
27 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList; | 28 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList; |
28 | 29 |
29 // Used to update the pipeline's clock time. The parameter is the time that | 30 // Used to update the pipeline's clock time. The parameter is the time that |
30 // the clock should not exceed. | 31 // the clock should not exceed. |
31 typedef base::Callback<void(base::TimeDelta)> TimeCB; | 32 typedef base::Callback<void(base::TimeDelta)> TimeCB; |
32 | 33 |
33 // Executed when the natural size of the video has changed. | 34 // Executed when the natural size of the video has changed. |
34 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB; | 35 typedef base::Callback<void(const gfx::Size& size)> NaturalSizeChangedCB; |
35 | 36 |
36 // Used to query the current time or duration of the media. | 37 // Used to query the current time or duration of the media. |
37 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; | 38 typedef base::Callback<base::TimeDelta()> TimeDeltaCB; |
38 | 39 |
39 VideoRenderer(); | |
40 virtual ~VideoRenderer(); | |
41 | |
42 // Initialize a VideoRenderer with the given DemuxerStream and | 40 // Initialize a VideoRenderer with the given DemuxerStream and |
43 // VideoDecoderList, executing |init_cb| callback upon completion. | 41 // VideoDecoderList, executing |init_cb| callback upon completion. |
44 // | 42 // |
45 // |statistics_cb| is executed periodically with video rendering stats, such | 43 // |statistics_cb| is executed periodically with video rendering stats, such |
46 // as dropped frames. | 44 // as dropped frames. |
47 // | 45 // |
48 // |time_cb| is executed whenever time has advanced by way of video rendering. | 46 // |time_cb| is executed whenever time has advanced by way of video rendering. |
49 // | 47 // |
50 // |size_changed_cb| is executed whenever the dimensions of the video has | 48 // |size_changed_cb| is executed whenever the dimensions of the video has |
51 // changed. | 49 // changed. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 virtual void Preroll(base::TimeDelta time, | 84 virtual void Preroll(base::TimeDelta time, |
87 const PipelineStatusCB& callback) = 0; | 85 const PipelineStatusCB& callback) = 0; |
88 | 86 |
89 // Stop all operations in preparation for being deleted, executing |callback| | 87 // Stop all operations in preparation for being deleted, executing |callback| |
90 // when complete. | 88 // when complete. |
91 virtual void Stop(const base::Closure& callback) = 0; | 89 virtual void Stop(const base::Closure& callback) = 0; |
92 | 90 |
93 // Updates the current playback rate. | 91 // Updates the current playback rate. |
94 virtual void SetPlaybackRate(float playback_rate) = 0; | 92 virtual void SetPlaybackRate(float playback_rate) = 0; |
95 | 93 |
| 94 protected: |
| 95 friend class base::RefCountedThreadSafe<VideoRenderer>; |
| 96 |
| 97 VideoRenderer(); |
| 98 virtual ~VideoRenderer(); |
| 99 |
96 private: | 100 private: |
97 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); | 101 DISALLOW_COPY_AND_ASSIGN(VideoRenderer); |
98 }; | 102 }; |
99 | 103 |
100 } // namespace media | 104 } // namespace media |
101 | 105 |
102 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ | 106 #endif // MEDIA_BASE_VIDEO_RENDERER_H_ |
OLD | NEW |