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 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/base/pipeline.h" | 12 #include "media/base/pipeline.h" |
13 #include "media/filters/chunk_demuxer_client.h" | 13 #include "media/filters/chunk_demuxer_client.h" |
| 14 #include "webkit/media/buffered_data_source.h" |
14 #include "webkit/media/skcanvas_video_renderer.h" | 15 #include "webkit/media/skcanvas_video_renderer.h" |
15 #include "webkit/media/web_data_source.h" | |
16 | 16 |
17 class SkCanvas; | 17 class SkCanvas; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class MessageLoopProxy; | 20 class MessageLoopProxy; |
21 } | 21 } |
22 | 22 |
23 namespace gfx { | 23 namespace gfx { |
24 class Rect; | 24 class Rect; |
25 } | 25 } |
26 | 26 |
27 namespace media { | 27 namespace media { |
28 class VideoFrame; | 28 class VideoFrame; |
29 class VideoRendererBase; | 29 class VideoRendererBase; |
30 } | 30 } |
31 | 31 |
32 namespace webkit_media { | 32 namespace webkit_media { |
33 | 33 |
34 class WebMediaPlayerImpl; | 34 class WebMediaPlayerImpl; |
35 | 35 |
36 // Acts as a thread proxy between the various threads used for multimedia and | 36 // Acts as a thread proxy between the various threads used for multimedia and |
37 // the render thread that WebMediaPlayerImpl is running on. | 37 // the render thread that WebMediaPlayerImpl is running on. |
38 class WebMediaPlayerProxy | 38 class WebMediaPlayerProxy |
39 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, | 39 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, |
40 public media::ChunkDemuxerClient { | 40 public media::ChunkDemuxerClient { |
41 public: | 41 public: |
42 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, | 42 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, |
43 WebMediaPlayerImpl* webmediaplayer); | 43 WebMediaPlayerImpl* webmediaplayer); |
44 const scoped_refptr<WebDataSource>& data_source() { | 44 const scoped_refptr<BufferedDataSource>& data_source() { |
45 return data_source_; | 45 return data_source_; |
46 } | 46 } |
47 void set_data_source(const scoped_refptr<WebDataSource>& data_source) { | 47 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { |
48 data_source_ = data_source; | 48 data_source_ = data_source; |
49 } | 49 } |
50 | 50 |
51 // TODO(scherkus): remove this once VideoRendererBase::PaintCB passes | 51 // TODO(scherkus): remove this once VideoRendererBase::PaintCB passes |
52 // ownership of the VideoFrame http://crbug.com/108435 | 52 // ownership of the VideoFrame http://crbug.com/108435 |
53 void set_frame_provider(media::VideoRendererBase* frame_provider) { | 53 void set_frame_provider(media::VideoRendererBase* frame_provider) { |
54 frame_provider_ = frame_provider; | 54 frame_provider_ = frame_provider; |
55 } | 55 } |
56 | 56 |
57 // Methods for Filter -> WebMediaPlayerImpl communication. | 57 // Methods for Filter -> WebMediaPlayerImpl communication. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Notify |webmediaplayer_| that there's a network event. | 109 // Notify |webmediaplayer_| that there's a network event. |
110 void NetworkEventTask(media::NetworkEvent type); | 110 void NetworkEventTask(media::NetworkEvent type); |
111 | 111 |
112 // Inform |webmediaplayer_| whether the video content is opaque. | 112 // Inform |webmediaplayer_| whether the video content is opaque. |
113 void SetOpaqueTask(bool opaque); | 113 void SetOpaqueTask(bool opaque); |
114 | 114 |
115 // The render message loop where WebKit lives. | 115 // The render message loop where WebKit lives. |
116 scoped_refptr<base::MessageLoopProxy> render_loop_; | 116 scoped_refptr<base::MessageLoopProxy> render_loop_; |
117 WebMediaPlayerImpl* webmediaplayer_; | 117 WebMediaPlayerImpl* webmediaplayer_; |
118 | 118 |
119 scoped_refptr<WebDataSource> data_source_; | 119 scoped_refptr<BufferedDataSource> data_source_; |
120 scoped_refptr<media::VideoRendererBase> frame_provider_; | 120 scoped_refptr<media::VideoRendererBase> frame_provider_; |
121 SkCanvasVideoRenderer video_renderer_; | 121 SkCanvasVideoRenderer video_renderer_; |
122 | 122 |
123 base::Lock lock_; | 123 base::Lock lock_; |
124 int outstanding_repaints_; | 124 int outstanding_repaints_; |
125 | 125 |
126 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; | 126 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; |
127 | 127 |
128 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); | 128 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); |
129 }; | 129 }; |
130 | 130 |
131 } // namespace webkit_media | 131 } // namespace webkit_media |
132 | 132 |
133 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 133 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
OLD | NEW |