| 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 #include "webkit/glue/webmediaplayer_impl.h" | 5 #include "webkit/glue/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // Also we want to be notified of |main_loop_| destruction. | 353 // Also we want to be notified of |main_loop_| destruction. |
| 354 main_loop_->AddDestructionObserver(this); | 354 main_loop_->AddDestructionObserver(this); |
| 355 | 355 |
| 356 // Creates the proxy. | 356 // Creates the proxy. |
| 357 proxy_ = new Proxy(main_loop_, this); | 357 proxy_ = new Proxy(main_loop_, this); |
| 358 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_); | 358 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_); |
| 359 proxy_->SetVideoRenderer(web_video_renderer); | 359 proxy_->SetVideoRenderer(web_video_renderer); |
| 360 | 360 |
| 361 // Set our pipeline callbacks. | 361 // Set our pipeline callbacks. |
| 362 pipeline_->Init( | 362 pipeline_->Init( |
| 363 NewCallback(proxy_.get(), | 363 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineEndedCallback, |
| 364 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback), | 364 proxy_.get()), |
| 365 NewCallback(proxy_.get(), | 365 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineErrorCallback, |
| 366 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback), | 366 proxy_.get()), |
| 367 NewCallback(proxy_.get(), | 367 base::Bind(&WebMediaPlayerImpl::Proxy::NetworkEventCallback, |
| 368 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); | 368 proxy_.get())); |
| 369 | 369 |
| 370 // A simple data source that keeps all data in memory. | 370 // A simple data source that keeps all data in memory. |
| 371 scoped_ptr<media::DataSourceFactory> simple_data_source_factory( | 371 scoped_ptr<media::DataSourceFactory> simple_data_source_factory( |
| 372 SimpleDataSource::CreateFactory(MessageLoop::current(), frame, | 372 SimpleDataSource::CreateFactory(MessageLoop::current(), frame, |
| 373 proxy_->GetBuildObserver())); | 373 proxy_->GetBuildObserver())); |
| 374 | 374 |
| 375 // A sophisticated data source that does memory caching. | 375 // A sophisticated data source that does memory caching. |
| 376 scoped_ptr<media::DataSourceFactory> buffered_data_source_factory( | 376 scoped_ptr<media::DataSourceFactory> buffered_data_source_factory( |
| 377 BufferedDataSource::CreateFactory(MessageLoop::current(), frame, | 377 BufferedDataSource::CreateFactory(MessageLoop::current(), frame, |
| 378 proxy_->GetBuildObserver())); | 378 proxy_->GetBuildObserver())); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 setVolume(GetClient()->volume()); | 449 setVolume(GetClient()->volume()); |
| 450 // Get the preload value. | 450 // Get the preload value. |
| 451 setPreload(GetClient()->preload()); | 451 setPreload(GetClient()->preload()); |
| 452 | 452 |
| 453 // Initialize the pipeline. | 453 // Initialize the pipeline. |
| 454 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 454 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
| 455 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); | 455 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); |
| 456 pipeline_->Start( | 456 pipeline_->Start( |
| 457 filter_collection_.release(), | 457 filter_collection_.release(), |
| 458 url.spec(), | 458 url.spec(), |
| 459 NewCallback(proxy_.get(), | 459 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineInitializationCallback, |
| 460 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); | 460 proxy_.get())); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void WebMediaPlayerImpl::cancelLoad() { | 463 void WebMediaPlayerImpl::cancelLoad() { |
| 464 DCHECK(MessageLoop::current() == main_loop_); | 464 DCHECK(MessageLoop::current() == main_loop_); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void WebMediaPlayerImpl::play() { | 467 void WebMediaPlayerImpl::play() { |
| 468 DCHECK(MessageLoop::current() == main_loop_); | 468 DCHECK(MessageLoop::current() == main_loop_); |
| 469 | 469 |
| 470 paused_ = false; | 470 paused_ = false; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 paused_time_ = seek_time; | 511 paused_time_ = seek_time; |
| 512 } | 512 } |
| 513 | 513 |
| 514 seeking_ = true; | 514 seeking_ = true; |
| 515 | 515 |
| 516 proxy_->DemuxerFlush(); | 516 proxy_->DemuxerFlush(); |
| 517 | 517 |
| 518 // Kick off the asynchronous seek! | 518 // Kick off the asynchronous seek! |
| 519 pipeline_->Seek( | 519 pipeline_->Seek( |
| 520 seek_time, | 520 seek_time, |
| 521 NewCallback(proxy_.get(), | 521 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineSeekCallback, |
| 522 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback)); | 522 proxy_.get())); |
| 523 } | 523 } |
| 524 | 524 |
| 525 void WebMediaPlayerImpl::setEndTime(float seconds) { | 525 void WebMediaPlayerImpl::setEndTime(float seconds) { |
| 526 DCHECK(MessageLoop::current() == main_loop_); | 526 DCHECK(MessageLoop::current() == main_loop_); |
| 527 | 527 |
| 528 // TODO(hclam): add method call when it has been implemented. | 528 // TODO(hclam): add method call when it has been implemented. |
| 529 return; | 529 return; |
| 530 } | 530 } |
| 531 | 531 |
| 532 void WebMediaPlayerImpl::setRate(float rate) { | 532 void WebMediaPlayerImpl::setRate(float rate) { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 } | 1027 } |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 1030 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 1031 DCHECK(MessageLoop::current() == main_loop_); | 1031 DCHECK(MessageLoop::current() == main_loop_); |
| 1032 DCHECK(client_); | 1032 DCHECK(client_); |
| 1033 return client_; | 1033 return client_; |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 } // namespace webkit_glue | 1036 } // namespace webkit_glue |
| OLD | NEW |