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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // Also we want to be notified of |main_loop_| destruction. | 357 // Also we want to be notified of |main_loop_| destruction. |
358 main_loop_->AddDestructionObserver(this); | 358 main_loop_->AddDestructionObserver(this); |
359 | 359 |
360 // Creates the proxy. | 360 // Creates the proxy. |
361 proxy_ = new Proxy(main_loop_, this); | 361 proxy_ = new Proxy(main_loop_, this); |
362 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_); | 362 web_video_renderer->SetWebMediaPlayerImplProxy(proxy_); |
363 proxy_->SetVideoRenderer(web_video_renderer); | 363 proxy_->SetVideoRenderer(web_video_renderer); |
364 | 364 |
365 // Set our pipeline callbacks. | 365 // Set our pipeline callbacks. |
366 pipeline_->Init( | 366 pipeline_->Init( |
367 NewCallback(proxy_.get(), | 367 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineEndedCallback, |
368 &WebMediaPlayerImpl::Proxy::PipelineEndedCallback), | 368 proxy_.get()), |
369 NewCallback(proxy_.get(), | 369 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineErrorCallback, |
370 &WebMediaPlayerImpl::Proxy::PipelineErrorCallback), | 370 proxy_.get()), |
371 NewCallback(proxy_.get(), | 371 base::Bind(&WebMediaPlayerImpl::Proxy::NetworkEventCallback, |
372 &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); | 372 proxy_.get())); |
373 | 373 |
374 // A simple data source that keeps all data in memory. | 374 // A simple data source that keeps all data in memory. |
375 scoped_ptr<media::DataSourceFactory> simple_data_source_factory( | 375 scoped_ptr<media::DataSourceFactory> simple_data_source_factory( |
376 SimpleDataSource::CreateFactory(MessageLoop::current(), frame, | 376 SimpleDataSource::CreateFactory(MessageLoop::current(), frame, |
377 proxy_->GetBuildObserver())); | 377 proxy_->GetBuildObserver())); |
378 | 378 |
379 // A sophisticated data source that does memory caching. | 379 // A sophisticated data source that does memory caching. |
380 scoped_ptr<media::DataSourceFactory> buffered_data_source_factory( | 380 scoped_ptr<media::DataSourceFactory> buffered_data_source_factory( |
381 BufferedDataSource::CreateFactory(MessageLoop::current(), frame, | 381 BufferedDataSource::CreateFactory(MessageLoop::current(), frame, |
382 proxy_->GetBuildObserver())); | 382 proxy_->GetBuildObserver())); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 setVolume(GetClient()->volume()); | 454 setVolume(GetClient()->volume()); |
455 // Get the preload value. | 455 // Get the preload value. |
456 setPreload(GetClient()->preload()); | 456 setPreload(GetClient()->preload()); |
457 | 457 |
458 // Initialize the pipeline. | 458 // Initialize the pipeline. |
459 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 459 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
460 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); | 460 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); |
461 pipeline_->Start( | 461 pipeline_->Start( |
462 filter_collection_.release(), | 462 filter_collection_.release(), |
463 url.spec(), | 463 url.spec(), |
464 NewCallback(proxy_.get(), | 464 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineInitializationCallback, |
465 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); | 465 proxy_.get())); |
466 | 466 |
467 media_log_->Load(url.spec()); | 467 media_log_->Load(url.spec()); |
468 } | 468 } |
469 | 469 |
470 void WebMediaPlayerImpl::cancelLoad() { | 470 void WebMediaPlayerImpl::cancelLoad() { |
471 DCHECK(MessageLoop::current() == main_loop_); | 471 DCHECK(MessageLoop::current() == main_loop_); |
472 } | 472 } |
473 | 473 |
474 void WebMediaPlayerImpl::play() { | 474 void WebMediaPlayerImpl::play() { |
475 DCHECK(MessageLoop::current() == main_loop_); | 475 DCHECK(MessageLoop::current() == main_loop_); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 paused_time_ = seek_time; | 522 paused_time_ = seek_time; |
523 } | 523 } |
524 | 524 |
525 seeking_ = true; | 525 seeking_ = true; |
526 | 526 |
527 proxy_->DemuxerFlush(); | 527 proxy_->DemuxerFlush(); |
528 | 528 |
529 // Kick off the asynchronous seek! | 529 // Kick off the asynchronous seek! |
530 pipeline_->Seek( | 530 pipeline_->Seek( |
531 seek_time, | 531 seek_time, |
532 NewCallback(proxy_.get(), | 532 base::Bind(&WebMediaPlayerImpl::Proxy::PipelineSeekCallback, |
533 &WebMediaPlayerImpl::Proxy::PipelineSeekCallback)); | 533 proxy_.get())); |
534 } | 534 } |
535 | 535 |
536 void WebMediaPlayerImpl::setEndTime(float seconds) { | 536 void WebMediaPlayerImpl::setEndTime(float seconds) { |
537 DCHECK(MessageLoop::current() == main_loop_); | 537 DCHECK(MessageLoop::current() == main_loop_); |
538 | 538 |
539 // TODO(hclam): add method call when it has been implemented. | 539 // TODO(hclam): add method call when it has been implemented. |
540 return; | 540 return; |
541 } | 541 } |
542 | 542 |
543 void WebMediaPlayerImpl::setRate(float rate) { | 543 void WebMediaPlayerImpl::setRate(float rate) { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 } | 1043 } |
1044 } | 1044 } |
1045 | 1045 |
1046 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 1046 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
1047 DCHECK(MessageLoop::current() == main_loop_); | 1047 DCHECK(MessageLoop::current() == main_loop_); |
1048 DCHECK(client_); | 1048 DCHECK(client_); |
1049 return client_; | 1049 return client_; |
1050 } | 1050 } |
1051 | 1051 |
1052 } // namespace webkit_glue | 1052 } // namespace webkit_glue |
OLD | NEW |