Chromium Code Reviews| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 filter_collection_->SelectVideoDecoder(&old_videodecoder); | 375 filter_collection_->SelectVideoDecoder(&old_videodecoder); |
| 376 media::RTCVideoDecoder* rtc_video_decoder = | 376 media::RTCVideoDecoder* rtc_video_decoder = |
| 377 new media::RTCVideoDecoder( | 377 new media::RTCVideoDecoder( |
| 378 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), | 378 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), |
| 379 url.spec()); | 379 url.spec()); |
| 380 filter_collection_->AddVideoDecoder(rtc_video_decoder); | 380 filter_collection_->AddVideoDecoder(rtc_video_decoder); |
| 381 } | 381 } |
| 382 | 382 |
| 383 // Handle any volume changes that occured before load(). | 383 // Handle any volume changes that occured before load(). |
| 384 setVolume(GetClient()->volume()); | 384 setVolume(GetClient()->volume()); |
| 385 // Get the preload value. | |
| 386 setPreload(GetClient()->preload()); | |
| 385 | 387 |
| 386 // Initialize the pipeline. | 388 // Initialize the pipeline. |
| 387 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 389 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
| 388 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); | 390 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); |
| 389 pipeline_->Start( | 391 pipeline_->Start( |
| 390 filter_collection_.release(), | 392 filter_collection_.release(), |
| 391 url.spec(), | 393 url.spec(), |
| 392 NewCallback(proxy_.get(), | 394 NewCallback(proxy_.get(), |
| 393 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); | 395 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); |
| 394 } | 396 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 pipeline_->SetVolume(volume); | 490 pipeline_->SetVolume(volume); |
| 489 } | 491 } |
| 490 | 492 |
| 491 void WebMediaPlayerImpl::setVisible(bool visible) { | 493 void WebMediaPlayerImpl::setVisible(bool visible) { |
| 492 DCHECK(MessageLoop::current() == main_loop_); | 494 DCHECK(MessageLoop::current() == main_loop_); |
| 493 | 495 |
| 494 // TODO(hclam): add appropriate method call when pipeline has it implemented. | 496 // TODO(hclam): add appropriate method call when pipeline has it implemented. |
| 495 return; | 497 return; |
| 496 } | 498 } |
| 497 | 499 |
| 498 bool WebMediaPlayerImpl::setAutoBuffer(bool autoBuffer) { | 500 void WebMediaPlayerImpl::setPreload(WebKit::WebMediaPlayer::Preload preload) { |
| 499 DCHECK(MessageLoop::current() == main_loop_); | 501 DCHECK(MessageLoop::current() == main_loop_); |
| 500 | 502 |
| 501 return false; | 503 pipeline_->SetPreload(static_cast<media::Preload>(preload)); |
|
acolwell GONE FROM CHROMIUM
2011/03/29 05:52:03
This just makes me nervous. Can we just put a swit
vrk (LEFT CHROMIUM)
2011/03/30 17:41:44
Agreed! Added compile-time asserts.
| |
| 502 } | 504 } |
| 503 | 505 |
| 504 bool WebMediaPlayerImpl::totalBytesKnown() { | 506 bool WebMediaPlayerImpl::totalBytesKnown() { |
| 505 DCHECK(MessageLoop::current() == main_loop_); | 507 DCHECK(MessageLoop::current() == main_loop_); |
| 506 | 508 |
| 507 return pipeline_->GetTotalBytes() != 0; | 509 return pipeline_->GetTotalBytes() != 0; |
| 508 } | 510 } |
| 509 | 511 |
| 510 bool WebMediaPlayerImpl::hasVideo() const { | 512 bool WebMediaPlayerImpl::hasVideo() const { |
| 511 DCHECK(MessageLoop::current() == main_loop_); | 513 DCHECK(MessageLoop::current() == main_loop_); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 } | 909 } |
| 908 } | 910 } |
| 909 | 911 |
| 910 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 912 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 911 DCHECK(MessageLoop::current() == main_loop_); | 913 DCHECK(MessageLoop::current() == main_loop_); |
| 912 DCHECK(client_); | 914 DCHECK(client_); |
| 913 return client_; | 915 return client_; |
| 914 } | 916 } |
| 915 | 917 |
| 916 } // namespace webkit_glue | 918 } // namespace webkit_glue |
| OLD | NEW |