OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. | 5 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. |
6 // It contains PipelineImpl which is the actual media player pipeline, it glues | 6 // It contains PipelineImpl which is the actual media player pipeline, it glues |
7 // the media player pipeline, data source, audio renderer and renderer. | 7 // the media player pipeline, data source, audio renderer and renderer. |
8 // PipelineImpl would creates multiple threads and access some public methods | 8 // PipelineImpl would creates multiple threads and access some public methods |
9 // of this class, so we need to be extra careful about concurrent access of | 9 // of this class, so we need to be extra careful about concurrent access of |
10 // methods and members. | 10 // methods and members. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // initialization events, etc, we have this class to bridge all method calls | 88 // initialization events, etc, we have this class to bridge all method calls |
89 // from the media pipeline on different threads and serialize these calls | 89 // from the media pipeline on different threads and serialize these calls |
90 // on the render thread. | 90 // on the render thread. |
91 // Because of the nature of this object that it works with different threads, | 91 // Because of the nature of this object that it works with different threads, |
92 // it is made ref-counted. | 92 // it is made ref-counted. |
93 class Proxy : public base::RefCountedThreadSafe<Proxy> { | 93 class Proxy : public base::RefCountedThreadSafe<Proxy> { |
94 public: | 94 public: |
95 Proxy(MessageLoop* render_loop, | 95 Proxy(MessageLoop* render_loop, |
96 WebMediaPlayerImpl* webmediaplayer); | 96 WebMediaPlayerImpl* webmediaplayer); |
97 | 97 |
98 // Methods for MediaFilter -> WebMediaPlayerImpl communication. | 98 // Methods for Filter -> WebMediaPlayerImpl communication. |
99 void Repaint(); | 99 void Repaint(); |
100 void SetVideoRenderer(scoped_refptr<WebVideoRenderer> video_renderer); | 100 void SetVideoRenderer(scoped_refptr<WebVideoRenderer> video_renderer); |
101 void SetDataSource(scoped_refptr<WebDataSource> data_source); | 101 void SetDataSource(scoped_refptr<WebDataSource> data_source); |
102 | 102 |
103 // Methods for WebMediaPlayerImpl -> MediaFilter communication. | 103 // Methods for WebMediaPlayerImpl -> Filter communication. |
104 void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); | 104 void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); |
105 void SetSize(const gfx::Rect& rect); | 105 void SetSize(const gfx::Rect& rect); |
106 void Detach(); | 106 void Detach(); |
107 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | 107 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); |
108 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); | 108 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); |
109 bool HasSingleOrigin(); | 109 bool HasSingleOrigin(); |
110 void AbortDataSource(); | 110 void AbortDataSource(); |
111 | 111 |
112 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. | 112 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. |
113 void PipelineInitializationCallback(); | 113 void PipelineInitializationCallback(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // 5. Null audio renderer | 168 // 5. Null audio renderer |
169 // The video renderer provided by this class is using the graphics context | 169 // The video renderer provided by this class is using the graphics context |
170 // provided by WebKit to perform renderering. The simple data source does | 170 // provided by WebKit to perform renderering. The simple data source does |
171 // resource loading by loading the whole resource object into memory. Null | 171 // resource loading by loading the whole resource object into memory. Null |
172 // audio renderer is a fake audio device that plays silence. Provider of the | 172 // audio renderer is a fake audio device that plays silence. Provider of the |
173 // |collection| can override the default filters by adding extra filters to | 173 // |collection| can override the default filters by adding extra filters to |
174 // |collection| before calling this method. | 174 // |collection| before calling this method. |
175 // | 175 // |
176 // Callers must call |Initialize()| before they can use the object. | 176 // Callers must call |Initialize()| before they can use the object. |
177 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, | 177 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, |
178 media::MediaFilterCollection* collection); | 178 media::FilterCollection* collection); |
179 virtual ~WebMediaPlayerImpl(); | 179 virtual ~WebMediaPlayerImpl(); |
180 | 180 |
181 // Finalizes initialization of the object. | 181 // Finalizes initialization of the object. |
182 bool Initialize( | 182 bool Initialize( |
183 WebKit::WebFrame* frame, | 183 WebKit::WebFrame* frame, |
184 bool use_simple_data_source, | 184 bool use_simple_data_source, |
185 scoped_refptr<WebVideoRenderer> web_video_renderer); | 185 scoped_refptr<WebVideoRenderer> web_video_renderer); |
186 | 186 |
187 virtual void load(const WebKit::WebURL& url); | 187 virtual void load(const WebKit::WebURL& url); |
188 virtual void cancelLoad(); | 188 virtual void cancelLoad(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 WebKit::WebMediaPlayer::ReadyState ready_state_; | 281 WebKit::WebMediaPlayer::ReadyState ready_state_; |
282 | 282 |
283 // Keep a list of buffered time ranges. | 283 // Keep a list of buffered time ranges. |
284 WebKit::WebTimeRanges buffered_; | 284 WebKit::WebTimeRanges buffered_; |
285 | 285 |
286 // Message loops for posting tasks between Chrome's main thread. Also used | 286 // Message loops for posting tasks between Chrome's main thread. Also used |
287 // for DCHECKs so methods calls won't execute in the wrong thread. | 287 // for DCHECKs so methods calls won't execute in the wrong thread. |
288 MessageLoop* main_loop_; | 288 MessageLoop* main_loop_; |
289 | 289 |
290 // A collection of filters. | 290 // A collection of filters. |
291 scoped_ptr<media::MediaFilterCollection> filter_collection_; | 291 scoped_ptr<media::FilterCollection> filter_collection_; |
292 | 292 |
293 // The actual pipeline and the thread it runs on. | 293 // The actual pipeline and the thread it runs on. |
294 scoped_refptr<media::Pipeline> pipeline_; | 294 scoped_refptr<media::Pipeline> pipeline_; |
295 base::Thread pipeline_thread_; | 295 base::Thread pipeline_thread_; |
296 | 296 |
297 // Playback state. | 297 // Playback state. |
298 // | 298 // |
299 // TODO(scherkus): we have these because Pipeline favours the simplicity of a | 299 // TODO(scherkus): we have these because Pipeline favours the simplicity of a |
300 // single "playback rate" over worrying about paused/stopped etc... It forces | 300 // single "playback rate" over worrying about paused/stopped etc... It forces |
301 // all clients to manage the pause+playback rate externally, but is that | 301 // all clients to manage the pause+playback rate externally, but is that |
(...skipping 18 matching lines...) Expand all Loading... |
320 #if WEBKIT_USING_CG | 320 #if WEBKIT_USING_CG |
321 scoped_ptr<skia::PlatformCanvas> skia_canvas_; | 321 scoped_ptr<skia::PlatformCanvas> skia_canvas_; |
322 #endif | 322 #endif |
323 | 323 |
324 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 324 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
325 }; | 325 }; |
326 | 326 |
327 } // namespace webkit_glue | 327 } // namespace webkit_glue |
328 | 328 |
329 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ | 329 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |