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. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Methods for WebMediaPlayerImpl -> Filter communication. | 104 // Methods for WebMediaPlayerImpl -> Filter communication. |
105 void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); | 105 void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); |
106 void SetSize(const gfx::Rect& rect); | 106 void SetSize(const gfx::Rect& rect); |
107 void Detach(); | 107 void Detach(); |
108 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | 108 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); |
109 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); | 109 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); |
110 bool HasSingleOrigin(); | 110 bool HasSingleOrigin(); |
111 void AbortDataSources(); | 111 void AbortDataSources(); |
112 | 112 |
113 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. | 113 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. |
114 void PipelineInitializationCallback(); | 114 void PipelineInitializationCallback(media::PipelineStatus status); |
115 void PipelineSeekCallback(); | 115 void PipelineSeekCallback(media::PipelineStatus status); |
116 void PipelineEndedCallback(); | 116 void PipelineEndedCallback(media::PipelineStatus status); |
117 void PipelineErrorCallback(); | 117 void PipelineErrorCallback(media::PipelineStatus error); |
118 void NetworkEventCallback(); | 118 void NetworkEventCallback(media::PipelineStatus status); |
119 | 119 |
120 // Returns the message loop used by the proxy. | 120 // Returns the message loop used by the proxy. |
121 MessageLoop* message_loop() { return render_loop_; } | 121 MessageLoop* message_loop() { return render_loop_; } |
122 | 122 |
123 private: | 123 private: |
124 friend class base::RefCountedThreadSafe<Proxy>; | 124 friend class base::RefCountedThreadSafe<Proxy>; |
125 | 125 |
126 virtual ~Proxy(); | 126 virtual ~Proxy(); |
127 | 127 |
128 // Adds a data source to data_sources_. | 128 // Adds a data source to data_sources_. |
129 void AddDataSource(WebDataSource* data_source); | 129 void AddDataSource(WebDataSource* data_source); |
130 | 130 |
131 // Invoke |webmediaplayer_| to perform a repaint. | 131 // Invoke |webmediaplayer_| to perform a repaint. |
132 void RepaintTask(); | 132 void RepaintTask(); |
133 | 133 |
134 // Notify |webmediaplayer_| that initialization has finished. | 134 // Notify |webmediaplayer_| that initialization has finished. |
135 void PipelineInitializationTask(); | 135 void PipelineInitializationTask(media::PipelineStatus status); |
136 | 136 |
137 // Notify |webmediaplayer_| that a seek has finished. | 137 // Notify |webmediaplayer_| that a seek has finished. |
138 void PipelineSeekTask(); | 138 void PipelineSeekTask(media::PipelineStatus status); |
139 | 139 |
140 // Notify |webmediaplayer_| that the media has ended. | 140 // Notify |webmediaplayer_| that the media has ended. |
141 void PipelineEndedTask(); | 141 void PipelineEndedTask(media::PipelineStatus status); |
142 | 142 |
143 // Notify |webmediaplayer_| that a pipeline error has been set. | 143 // Notify |webmediaplayer_| that a pipeline error has occurred during |
144 void PipelineErrorTask(); | 144 // playback. |
| 145 void PipelineErrorTask(media::PipelineStatus error); |
145 | 146 |
146 // Notify |webmediaplayer_| that there's a network event. | 147 // Notify |webmediaplayer_| that there's a network event. |
147 void NetworkEventTask(); | 148 void NetworkEventTask(media::PipelineStatus status); |
148 | 149 |
149 // The render message loop where WebKit lives. | 150 // The render message loop where WebKit lives. |
150 MessageLoop* render_loop_; | 151 MessageLoop* render_loop_; |
151 WebMediaPlayerImpl* webmediaplayer_; | 152 WebMediaPlayerImpl* webmediaplayer_; |
152 | 153 |
153 base::Lock data_sources_lock_; | 154 base::Lock data_sources_lock_; |
154 typedef std::list<scoped_refptr<WebDataSource> > DataSourceList; | 155 typedef std::list<scoped_refptr<WebDataSource> > DataSourceList; |
155 DataSourceList data_sources_; | 156 DataSourceList data_sources_; |
156 scoped_ptr<WebDataSourceBuildObserverHack> build_observer_; | 157 scoped_ptr<WebDataSourceBuildObserverHack> build_observer_; |
157 | 158 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 virtual void putCurrentFrame(WebKit::WebVideoFrame* web_video_frame); | 255 virtual void putCurrentFrame(WebKit::WebVideoFrame* web_video_frame); |
255 | 256 |
256 // As we are closing the tab or even the browser, |main_loop_| is destroyed | 257 // As we are closing the tab or even the browser, |main_loop_| is destroyed |
257 // even before this object gets destructed, so we need to know when | 258 // even before this object gets destructed, so we need to know when |
258 // |main_loop_| is being destroyed and we can stop posting repaint task | 259 // |main_loop_| is being destroyed and we can stop posting repaint task |
259 // to it. | 260 // to it. |
260 virtual void WillDestroyCurrentMessageLoop(); | 261 virtual void WillDestroyCurrentMessageLoop(); |
261 | 262 |
262 void Repaint(); | 263 void Repaint(); |
263 | 264 |
264 void OnPipelineInitialize(); | 265 void OnPipelineInitialize(media::PipelineStatus status); |
265 | 266 |
266 void OnPipelineSeek(); | 267 void OnPipelineSeek(media::PipelineStatus status); |
267 | 268 |
268 void OnPipelineEnded(); | 269 void OnPipelineEnded(media::PipelineStatus status); |
269 | 270 |
270 void OnPipelineError(); | 271 void OnPipelineError(media::PipelineStatus error); |
271 | 272 |
272 void OnNetworkEvent(); | 273 void OnNetworkEvent(media::PipelineStatus status); |
273 | 274 |
274 private: | 275 private: |
275 // Helpers that set the network/ready state and notifies the client if | 276 // Helpers that set the network/ready state and notifies the client if |
276 // they've changed. | 277 // they've changed. |
277 void SetNetworkState(WebKit::WebMediaPlayer::NetworkState state); | 278 void SetNetworkState(WebKit::WebMediaPlayer::NetworkState state); |
278 void SetReadyState(WebKit::WebMediaPlayer::ReadyState state); | 279 void SetReadyState(WebKit::WebMediaPlayer::ReadyState state); |
279 | 280 |
280 // Destroy resources held. | 281 // Destroy resources held. |
281 void Destroy(); | 282 void Destroy(); |
282 | 283 |
283 // Callback executed after |pipeline_| stops which signals Destroy() | 284 // Callback executed after |pipeline_| stops which signals Destroy() |
284 // to continue. | 285 // to continue. |
285 void PipelineStoppedCallback(); | 286 void PipelineStoppedCallback(media::PipelineStatus status); |
286 | 287 |
287 // Getter method to |client_|. | 288 // Getter method to |client_|. |
288 WebKit::WebMediaPlayerClient* GetClient(); | 289 WebKit::WebMediaPlayerClient* GetClient(); |
289 | 290 |
290 // TODO(hclam): get rid of these members and read from the pipeline directly. | 291 // TODO(hclam): get rid of these members and read from the pipeline directly. |
291 WebKit::WebMediaPlayer::NetworkState network_state_; | 292 WebKit::WebMediaPlayer::NetworkState network_state_; |
292 WebKit::WebMediaPlayer::ReadyState ready_state_; | 293 WebKit::WebMediaPlayer::ReadyState ready_state_; |
293 | 294 |
294 // Keep a list of buffered time ranges. | 295 // Keep a list of buffered time ranges. |
295 WebKit::WebTimeRanges buffered_; | 296 WebKit::WebTimeRanges buffered_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 #if WEBKIT_USING_CG | 334 #if WEBKIT_USING_CG |
334 scoped_ptr<skia::PlatformCanvas> skia_canvas_; | 335 scoped_ptr<skia::PlatformCanvas> skia_canvas_; |
335 #endif | 336 #endif |
336 | 337 |
337 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 338 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
338 }; | 339 }; |
339 | 340 |
340 } // namespace webkit_glue | 341 } // namespace webkit_glue |
341 | 342 |
342 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ | 343 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |