| 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 // 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. |
| 11 // | 11 // |
| 12 // WebMediaPlayerImpl works with multiple objects, the most important ones are: | 12 // WebMediaPlayerImpl works with multiple objects, the most important ones are: |
| 13 // | 13 // |
| 14 // media::PipelineImpl | 14 // media::PipelineImpl |
| 15 // The media playback pipeline. | 15 // The media playback pipeline. |
| 16 // | 16 // |
| 17 // WebVideoRenderer | 17 // VideoRendererImpl |
| 18 // Video renderer object. | 18 // Video renderer object. |
| 19 // | 19 // |
| 20 // WebKit::WebMediaPlayerClient | 20 // WebKit::WebMediaPlayerClient |
| 21 // WebKit client of this media player object. | 21 // WebKit client of this media player object. |
| 22 // | 22 // |
| 23 // The following diagram shows the relationship of these objects: | 23 // The following diagram shows the relationship of these objects: |
| 24 // (note: ref-counted reference is marked by a "r".) | 24 // (note: ref-counted reference is marked by a "r".) |
| 25 // | 25 // |
| 26 // WebMediaPlayerClient (WebKit object) | 26 // WebMediaPlayerClient (WebKit object) |
| 27 // ^ | 27 // ^ |
| 28 // | | 28 // | |
| 29 // WebMediaPlayerImpl ---> PipelineImpl | 29 // WebMediaPlayerImpl ---> PipelineImpl |
| 30 // | ^ | | 30 // | ^ | |
| 31 // | | v r | 31 // | | v r |
| 32 // | | WebVideoRenderer | 32 // | | VideoRendererImpl |
| 33 // | | | ^ r | 33 // | | | ^ r |
| 34 // | r | v r | | 34 // | r | v r | |
| 35 // '---> WebMediaPlayerProxy --' | 35 // '---> WebMediaPlayerProxy --' |
| 36 // | 36 // |
| 37 // Notice that WebMediaPlayerProxy and WebVideoRenderer are referencing each | 37 // Notice that WebMediaPlayerProxy and VideoRendererImpl are referencing each |
| 38 // other. This interdependency has to be treated carefully. | 38 // other. This interdependency has to be treated carefully. |
| 39 // | 39 // |
| 40 // Other issues: | 40 // Other issues: |
| 41 // During tear down of the whole browser or a tab, the DOM tree may not be | 41 // During tear down of the whole browser or a tab, the DOM tree may not be |
| 42 // destructed nicely, and there will be some dangling media threads trying to | 42 // destructed nicely, and there will be some dangling media threads trying to |
| 43 // the main thread, so we need this class to listen to destruction event of the | 43 // the main thread, so we need this class to listen to destruction event of the |
| 44 // main thread and cleanup the media threads when the even is received. Also | 44 // main thread and cleanup the media threads when the even is received. Also |
| 45 // at destruction of this class we will need to unhook it from destruction event | 45 // at destruction of this class we will need to unhook it from destruction event |
| 46 // list of the main thread. | 46 // list of the main thread. |
| 47 | 47 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 namespace media { | 66 namespace media { |
| 67 class MediaLog; | 67 class MediaLog; |
| 68 } | 68 } |
| 69 | 69 |
| 70 namespace webkit_media { | 70 namespace webkit_media { |
| 71 | 71 |
| 72 class MediaStreamClient; | 72 class MediaStreamClient; |
| 73 class WebMediaPlayerDelegate; | 73 class WebMediaPlayerDelegate; |
| 74 class WebMediaPlayerProxy; | 74 class WebMediaPlayerProxy; |
| 75 class WebVideoRenderer; | |
| 76 | 75 |
| 77 class WebMediaPlayerImpl | 76 class WebMediaPlayerImpl |
| 78 : public WebKit::WebMediaPlayer, | 77 : public WebKit::WebMediaPlayer, |
| 79 public MessageLoop::DestructionObserver, | 78 public MessageLoop::DestructionObserver, |
| 80 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 79 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
| 81 public: | 80 public: |
| 82 // Construct a WebMediaPlayerImpl with reference to the client, and media | 81 // Construct a WebMediaPlayerImpl with reference to the client, and media |
| 83 // filter collection. By providing the filter collection the implementor can | 82 // filter collection. By providing the filter collection the implementor can |
| 84 // provide more specific media filters that does resource loading and | 83 // provide more specific media filters that does resource loading and |
| 85 // rendering. |collection| should contain filter factories for: | 84 // rendering. |collection| should contain filter factories for: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 103 // Callers must call |Initialize()| before they can use the object. | 102 // Callers must call |Initialize()| before they can use the object. |
| 104 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, | 103 WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, |
| 105 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 104 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
| 106 media::FilterCollection* collection, | 105 media::FilterCollection* collection, |
| 107 media::MessageLoopFactory* message_loop_factory, | 106 media::MessageLoopFactory* message_loop_factory, |
| 108 MediaStreamClient* media_stream_client, | 107 MediaStreamClient* media_stream_client, |
| 109 media::MediaLog* media_log); | 108 media::MediaLog* media_log); |
| 110 virtual ~WebMediaPlayerImpl(); | 109 virtual ~WebMediaPlayerImpl(); |
| 111 | 110 |
| 112 // Finalizes initialization of the object. | 111 // Finalizes initialization of the object. |
| 113 bool Initialize( | 112 bool Initialize(WebKit::WebFrame* frame, bool use_simple_data_source); |
| 114 WebKit::WebFrame* frame, | |
| 115 bool use_simple_data_source, | |
| 116 scoped_refptr<WebVideoRenderer> web_video_renderer); | |
| 117 | 113 |
| 118 virtual void load(const WebKit::WebURL& url); | 114 virtual void load(const WebKit::WebURL& url); |
| 119 virtual void cancelLoad(); | 115 virtual void cancelLoad(); |
| 120 | 116 |
| 121 // Playback controls. | 117 // Playback controls. |
| 122 virtual void play(); | 118 virtual void play(); |
| 123 virtual void pause(); | 119 virtual void pause(); |
| 124 virtual bool supportsFullscreen() const; | 120 virtual bool supportsFullscreen() const; |
| 125 virtual bool supportsSave() const; | 121 virtual bool supportsSave() const; |
| 126 virtual void seek(float seconds); | 122 virtual void seek(float seconds); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 bool is_accelerated_compositing_active_; | 263 bool is_accelerated_compositing_active_; |
| 268 | 264 |
| 269 bool incremented_externally_allocated_memory_; | 265 bool incremented_externally_allocated_memory_; |
| 270 | 266 |
| 271 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 267 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 272 }; | 268 }; |
| 273 | 269 |
| 274 } // namespace webkit_media | 270 } // namespace webkit_media |
| 275 | 271 |
| 276 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 272 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |