| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 #include "base/lock.h" | 56 #include "base/lock.h" |
| 57 #include "base/message_loop.h" | 57 #include "base/message_loop.h" |
| 58 #include "base/ref_counted.h" | 58 #include "base/ref_counted.h" |
| 59 #include "base/scoped_ptr.h" | 59 #include "base/scoped_ptr.h" |
| 60 #include "base/threading/thread.h" | 60 #include "base/threading/thread.h" |
| 61 #include "base/synchronization/waitable_event.h" | 61 #include "base/synchronization/waitable_event.h" |
| 62 #include "gfx/rect.h" | 62 #include "gfx/rect.h" |
| 63 #include "gfx/size.h" | 63 #include "gfx/size.h" |
| 64 #include "media/base/filters.h" | 64 #include "media/base/filters.h" |
| 65 #include "media/base/message_loop_factory.h" |
| 65 #include "media/base/pipeline.h" | 66 #include "media/base/pipeline.h" |
| 66 #include "skia/ext/platform_canvas.h" | 67 #include "skia/ext/platform_canvas.h" |
| 67 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" | 68 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" |
| 68 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" | 69 #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" |
| 69 | 70 |
| 70 class GURL; | 71 class GURL; |
| 71 | 72 |
| 72 namespace WebKit { | 73 namespace WebKit { |
| 73 class WebFrame; | 74 class WebFrame; |
| 74 } | 75 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // 5. Null audio renderer | 169 // 5. Null audio renderer |
| 169 // The video renderer provided by this class is using the graphics context | 170 // The video renderer provided by this class is using the graphics context |
| 170 // provided by WebKit to perform renderering. The simple data source does | 171 // provided by WebKit to perform renderering. The simple data source does |
| 171 // resource loading by loading the whole resource object into memory. Null | 172 // 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 | 173 // 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 | 174 // |collection| can override the default filters by adding extra filters to |
| 174 // |collection| before calling this method. | 175 // |collection| before calling this method. |
| 175 // | 176 // |
| 176 // Callers must call |Initialize()| before they can use the object. | 177 // Callers must call |Initialize()| before they can use the object. |
| 177 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, | 178 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, |
| 178 media::FilterCollection* collection); | 179 media::FilterCollection* collection, |
| 180 media::MessageLoopFactory* message_loop_factory); |
| 179 virtual ~WebMediaPlayerImpl(); | 181 virtual ~WebMediaPlayerImpl(); |
| 180 | 182 |
| 181 // Finalizes initialization of the object. | 183 // Finalizes initialization of the object. |
| 182 bool Initialize( | 184 bool Initialize( |
| 183 WebKit::WebFrame* frame, | 185 WebKit::WebFrame* frame, |
| 184 bool use_simple_data_source, | 186 bool use_simple_data_source, |
| 185 scoped_refptr<WebVideoRenderer> web_video_renderer); | 187 scoped_refptr<WebVideoRenderer> web_video_renderer); |
| 186 | 188 |
| 187 virtual void load(const WebKit::WebURL& url); | 189 virtual void load(const WebKit::WebURL& url); |
| 188 virtual void cancelLoad(); | 190 virtual void cancelLoad(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 | 283 |
| 282 // Message loops for posting tasks between Chrome's main thread. Also used | 284 // Message loops for posting tasks between Chrome's main thread. Also used |
| 283 // for DCHECKs so methods calls won't execute in the wrong thread. | 285 // for DCHECKs so methods calls won't execute in the wrong thread. |
| 284 MessageLoop* main_loop_; | 286 MessageLoop* main_loop_; |
| 285 | 287 |
| 286 // A collection of filters. | 288 // A collection of filters. |
| 287 scoped_ptr<media::FilterCollection> filter_collection_; | 289 scoped_ptr<media::FilterCollection> filter_collection_; |
| 288 | 290 |
| 289 // The actual pipeline and the thread it runs on. | 291 // The actual pipeline and the thread it runs on. |
| 290 scoped_refptr<media::Pipeline> pipeline_; | 292 scoped_refptr<media::Pipeline> pipeline_; |
| 291 base::Thread pipeline_thread_; | 293 |
| 294 scoped_ptr<media::MessageLoopFactory> message_loop_factory_; |
| 292 | 295 |
| 293 // Playback state. | 296 // Playback state. |
| 294 // | 297 // |
| 295 // TODO(scherkus): we have these because Pipeline favours the simplicity of a | 298 // TODO(scherkus): we have these because Pipeline favours the simplicity of a |
| 296 // single "playback rate" over worrying about paused/stopped etc... It forces | 299 // single "playback rate" over worrying about paused/stopped etc... It forces |
| 297 // all clients to manage the pause+playback rate externally, but is that | 300 // all clients to manage the pause+playback rate externally, but is that |
| 298 // really a bad thing? | 301 // really a bad thing? |
| 299 // | 302 // |
| 300 // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want | 303 // TODO(scherkus): since SetPlaybackRate(0) is asynchronous and we don't want |
| 301 // to hang the render thread during pause(), we record the time at the same | 304 // to hang the render thread during pause(), we record the time at the same |
| (...skipping 15 matching lines...) Expand all Loading... |
| 317 #if WEBKIT_USING_CG | 320 #if WEBKIT_USING_CG |
| 318 scoped_ptr<skia::PlatformCanvas> skia_canvas_; | 321 scoped_ptr<skia::PlatformCanvas> skia_canvas_; |
| 319 #endif | 322 #endif |
| 320 | 323 |
| 321 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 324 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 322 }; | 325 }; |
| 323 | 326 |
| 324 } // namespace webkit_glue | 327 } // namespace webkit_glue |
| 325 | 328 |
| 326 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ | 329 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |