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" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Set our pipeline callbacks. | 261 // Set our pipeline callbacks. |
262 pipeline_->SetPipelineEndedCallback(NewCallback(proxy_.get(), | 262 pipeline_->SetPipelineEndedCallback(NewCallback(proxy_.get(), |
263 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback)); | 263 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback)); |
264 pipeline_->SetPipelineErrorCallback(NewCallback(proxy_.get(), | 264 pipeline_->SetPipelineErrorCallback(NewCallback(proxy_.get(), |
265 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback)); | 265 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback)); |
266 pipeline_->SetNetworkEventCallback(NewCallback(proxy_.get(), | 266 pipeline_->SetNetworkEventCallback(NewCallback(proxy_.get(), |
267 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); | 267 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); |
268 | 268 |
269 // A simple data source that keeps all data in memory. | 269 // A simple data source that keeps all data in memory. |
270 scoped_refptr<SimpleDataSource> simple_data_source = | 270 scoped_refptr<SimpleDataSource> simple_data_source( |
271 new SimpleDataSource(MessageLoop::current(), bridge_factory_simple); | 271 new SimpleDataSource(MessageLoop::current(), bridge_factory_simple)); |
272 | 272 |
273 // A sophisticated data source that does memory caching. | 273 // A sophisticated data source that does memory caching. |
274 scoped_refptr<BufferedDataSource> buffered_data_source = | 274 scoped_refptr<BufferedDataSource> buffered_data_source( |
275 new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered); | 275 new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered)); |
276 proxy_->SetDataSource(buffered_data_source); | 276 proxy_->SetDataSource(buffered_data_source); |
277 | 277 |
278 if (use_simple_data_source) { | 278 if (use_simple_data_source) { |
279 filter_collection_.push_back(simple_data_source); | 279 filter_collection_.push_back(simple_data_source); |
280 filter_collection_.push_back(buffered_data_source); | 280 filter_collection_.push_back(buffered_data_source); |
281 } else { | 281 } else { |
282 filter_collection_.push_back(buffered_data_source); | 282 filter_collection_.push_back(buffered_data_source); |
283 filter_collection_.push_back(simple_data_source); | 283 filter_collection_.push_back(simple_data_source); |
284 } | 284 } |
285 | 285 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 scoped_refptr<media::VideoFrame> video_frame; | 626 scoped_refptr<media::VideoFrame> video_frame; |
627 proxy_->GetCurrentFrame(&video_frame); | 627 proxy_->GetCurrentFrame(&video_frame); |
628 if (video_frame.get()) | 628 if (video_frame.get()) |
629 return new WebVideoFrameImpl(video_frame); | 629 return new WebVideoFrameImpl(video_frame); |
630 return NULL; | 630 return NULL; |
631 } | 631 } |
632 | 632 |
633 void WebMediaPlayerImpl::putCurrentFrame( | 633 void WebMediaPlayerImpl::putCurrentFrame( |
634 WebKit::WebVideoFrame* web_video_frame) { | 634 WebKit::WebVideoFrame* web_video_frame) { |
635 if (web_video_frame) { | 635 if (web_video_frame) { |
636 scoped_refptr<media::VideoFrame> video_frame = | 636 scoped_refptr<media::VideoFrame> video_frame( |
637 WebVideoFrameImpl::toVideoFrame(web_video_frame); | 637 WebVideoFrameImpl::toVideoFrame(web_video_frame)); |
638 proxy_->PutCurrentFrame(video_frame); | 638 proxy_->PutCurrentFrame(video_frame); |
639 delete web_video_frame; | 639 delete web_video_frame; |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() { | 643 void WebMediaPlayerImpl::WillDestroyCurrentMessageLoop() { |
644 Destroy(); | 644 Destroy(); |
645 main_loop_ = NULL; | 645 main_loop_ = NULL; |
646 } | 646 } |
647 | 647 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 pipeline_stopped_.Signal(); | 791 pipeline_stopped_.Signal(); |
792 } | 792 } |
793 | 793 |
794 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 794 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
795 DCHECK(MessageLoop::current() == main_loop_); | 795 DCHECK(MessageLoop::current() == main_loop_); |
796 DCHECK(client_); | 796 DCHECK(client_); |
797 return client_; | 797 return client_; |
798 } | 798 } |
799 | 799 |
800 } // namespace webkit_glue | 800 } // namespace webkit_glue |
OLD | NEW |