| 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 #include "webkit/glue/webmediaplayer_impl.h" | 5 #include "webkit/glue/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "media/base/limits.h" | 11 #include "media/base/limits.h" |
| 12 #include "media/base/media_format.h" | 12 #include "media/base/media_format.h" |
| 13 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
| 14 #include "media/base/video_frame.h" |
| 14 #include "media/filters/ffmpeg_audio_decoder.h" | 15 #include "media/filters/ffmpeg_audio_decoder.h" |
| 15 #include "media/filters/ffmpeg_demuxer.h" | 16 #include "media/filters/ffmpeg_demuxer.h" |
| 16 #include "media/filters/ffmpeg_video_decoder.h" | 17 #include "media/filters/ffmpeg_video_decoder.h" |
| 17 #include "media/filters/null_audio_renderer.h" | 18 #include "media/filters/null_audio_renderer.h" |
| 18 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
| 21 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 23 #include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" |
| 24 #include "webkit/glue/webvideoframe_impl.h" |
| 22 #include "webkit/glue/media/video_renderer_impl.h" | 25 #include "webkit/glue/media/video_renderer_impl.h" |
| 23 #include "webkit/glue/media/web_video_renderer.h" | 26 #include "webkit/glue/media/web_video_renderer.h" |
| 24 | 27 |
| 25 using WebKit::WebCanvas; | 28 using WebKit::WebCanvas; |
| 26 using WebKit::WebRect; | 29 using WebKit::WebRect; |
| 27 using WebKit::WebSize; | 30 using WebKit::WebSize; |
| 28 | 31 |
| 29 namespace { | 32 namespace { |
| 30 | 33 |
| 31 // Limits the maximum outstanding repaints posted on render thread. | 34 // Limits the maximum outstanding repaints posted on render thread. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 176 } |
| 174 } | 177 } |
| 175 | 178 |
| 176 void WebMediaPlayerImpl::Proxy::NetworkEventTask() { | 179 void WebMediaPlayerImpl::Proxy::NetworkEventTask() { |
| 177 DCHECK(MessageLoop::current() == render_loop_); | 180 DCHECK(MessageLoop::current() == render_loop_); |
| 178 if (webmediaplayer_) { | 181 if (webmediaplayer_) { |
| 179 webmediaplayer_->OnNetworkEvent(); | 182 webmediaplayer_->OnNetworkEvent(); |
| 180 } | 183 } |
| 181 } | 184 } |
| 182 | 185 |
| 186 void WebMediaPlayerImpl::Proxy::GetCurrentFrame(scoped_refptr<media::VideoFrame>
* frame_out) { |
| 187 if (video_renderer_) { |
| 188 video_renderer_->GetCurrentFrame(frame_out); |
| 189 } |
| 190 } |
| 191 |
| 192 void WebMediaPlayerImpl::Proxy::PutCurrentFrame(scoped_refptr<media::VideoFrame>
frame) { |
| 193 if (video_renderer_) { |
| 194 video_renderer_->PutCurrentFrame(frame); |
| 195 } |
| 196 } |
| 197 |
| 183 ///////////////////////////////////////////////////////////////////////////// | 198 ///////////////////////////////////////////////////////////////////////////// |
| 184 // WebMediaPlayerImpl implementation | 199 // WebMediaPlayerImpl implementation |
| 185 | 200 |
| 186 WebMediaPlayerImpl::WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, | 201 WebMediaPlayerImpl::WebMediaPlayerImpl(WebKit::WebMediaPlayerClient* client, |
| 187 media::FilterFactoryCollection* factory, | 202 media::FilterFactoryCollection* factory, |
| 188 WebVideoRendererFactoryFactory* | 203 WebVideoRendererFactoryFactory* |
| 189 video_renderer_factory) | 204 video_renderer_factory) |
| 190 : network_state_(WebKit::WebMediaPlayer::Empty), | 205 : network_state_(WebKit::WebMediaPlayer::Empty), |
| 191 ready_state_(WebKit::WebMediaPlayer::HaveNothing), | 206 ready_state_(WebKit::WebMediaPlayer::HaveNothing), |
| 192 main_loop_(NULL), | 207 main_loop_(NULL), |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 void WebMediaPlayerImpl::PipelineStoppedCallback() { | 727 void WebMediaPlayerImpl::PipelineStoppedCallback() { |
| 713 pipeline_stopped_.Signal(); | 728 pipeline_stopped_.Signal(); |
| 714 } | 729 } |
| 715 | 730 |
| 716 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 731 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 717 DCHECK(MessageLoop::current() == main_loop_); | 732 DCHECK(MessageLoop::current() == main_loop_); |
| 718 DCHECK(client_); | 733 DCHECK(client_); |
| 719 return client_; | 734 return client_; |
| 720 } | 735 } |
| 721 | 736 |
| 737 void WebMediaPlayerImpl::getCurrentFrame(WebKit::WebVideoFrame** output) { |
| 738 scoped_refptr<media::VideoFrame> video_frame; |
| 739 proxy_->GetCurrentFrame(&video_frame); |
| 740 if (video_frame.get()) |
| 741 *output = new WebVideoFrameImpl(video_frame.get()); |
| 742 else |
| 743 *output = 0; |
| 744 } |
| 745 |
| 746 void WebMediaPlayerImpl::putCurrentFrame(WebKit::WebVideoFrame* frame) { |
| 747 scoped_refptr<media::VideoFrame> video_frame = WebVideoFrameImpl::toVideoFrame
(frame); |
| 748 proxy_->PutCurrentFrame(video_frame); |
| 749 } |
| 750 |
| 722 } // namespace webkit_glue | 751 } // namespace webkit_glue |
| OLD | NEW |