OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "media/filters/chunk_demuxer_client.h" | 12 #include "media/filters/chunk_demuxer_client.h" |
13 #include "webkit/media/web_data_source.h" | 13 #include "webkit/media/web_data_source.h" |
14 | 14 |
15 class MessageLoop; | 15 class MessageLoop; |
16 class SkCanvas; | 16 class SkCanvas; |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Rect; | 19 class Rect; |
20 } | 20 } |
21 | 21 |
22 namespace webkit_media { | 22 namespace webkit_media { |
23 | 23 |
24 class WebMediaPlayerImpl; | 24 class WebMediaPlayerImpl; |
25 class WebVideoRenderer; | 25 class VideoRendererImpl; |
26 | 26 |
27 // Acts as a thread proxy between the various threads used for multimedia and | 27 // Acts as a thread proxy between the various threads used for multimedia and |
28 // the render thread that WebMediaPlayerImpl is running on. | 28 // the render thread that WebMediaPlayerImpl is running on. |
29 class WebMediaPlayerProxy | 29 class WebMediaPlayerProxy |
30 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, | 30 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, |
31 public media::ChunkDemuxerClient { | 31 public media::ChunkDemuxerClient { |
32 public: | 32 public: |
33 WebMediaPlayerProxy(MessageLoop* render_loop, | 33 WebMediaPlayerProxy(MessageLoop* render_loop, |
34 WebMediaPlayerImpl* webmediaplayer); | 34 WebMediaPlayerImpl* webmediaplayer); |
35 | 35 |
36 // Methods for Filter -> WebMediaPlayerImpl communication. | 36 // Methods for Filter -> WebMediaPlayerImpl communication. |
37 void Repaint(); | 37 void Repaint(); |
38 void SetVideoRenderer(scoped_refptr<WebVideoRenderer> video_renderer); | 38 void SetVideoRenderer(const scoped_refptr<VideoRendererImpl>& video_renderer); |
39 WebDataSourceBuildObserverHack GetBuildObserver(); | 39 WebDataSourceBuildObserverHack GetBuildObserver(); |
40 | 40 |
41 // Methods for WebMediaPlayerImpl -> Filter communication. | 41 // Methods for WebMediaPlayerImpl -> Filter communication. |
42 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect); | 42 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect); |
43 void SetSize(const gfx::Rect& rect); | |
44 void Detach(); | 43 void Detach(); |
45 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | 44 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); |
46 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); | 45 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); |
47 bool HasSingleOrigin(); | 46 bool HasSingleOrigin(); |
48 void AbortDataSources(); | 47 void AbortDataSources(); |
49 | 48 |
50 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. | 49 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. |
51 void PipelineInitializationCallback(media::PipelineStatus status); | 50 void PipelineInitializationCallback(media::PipelineStatus status); |
52 void PipelineSeekCallback(media::PipelineStatus status); | 51 void PipelineSeekCallback(media::PipelineStatus status); |
53 void PipelineEndedCallback(media::PipelineStatus status); | 52 void PipelineEndedCallback(media::PipelineStatus status); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void NetworkEventTask(bool network_activity); | 96 void NetworkEventTask(bool network_activity); |
98 | 97 |
99 // The render message loop where WebKit lives. | 98 // The render message loop where WebKit lives. |
100 MessageLoop* render_loop_; | 99 MessageLoop* render_loop_; |
101 WebMediaPlayerImpl* webmediaplayer_; | 100 WebMediaPlayerImpl* webmediaplayer_; |
102 | 101 |
103 base::Lock data_sources_lock_; | 102 base::Lock data_sources_lock_; |
104 typedef std::list<scoped_refptr<WebDataSource> > DataSourceList; | 103 typedef std::list<scoped_refptr<WebDataSource> > DataSourceList; |
105 DataSourceList data_sources_; | 104 DataSourceList data_sources_; |
106 | 105 |
107 scoped_refptr<WebVideoRenderer> video_renderer_; | 106 scoped_refptr<VideoRendererImpl> video_renderer_; |
108 | 107 |
109 base::Lock lock_; | 108 base::Lock lock_; |
110 int outstanding_repaints_; | 109 int outstanding_repaints_; |
111 | 110 |
112 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; | 111 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; |
113 | 112 |
114 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); | 113 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); |
115 }; | 114 }; |
116 | 115 |
117 } // namespace webkit_media | 116 } // namespace webkit_media |
118 | 117 |
119 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 118 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
OLD | NEW |