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 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
| 501 COMPILE_ASSERT(int(WebKit::WebMediaPlayer::webkit_name) == \ |
| 502 int(media::chromium_name), \ |
| 503 mismatching_enums) |
| 504 COMPILE_ASSERT_MATCHING_ENUM(None, NONE); |
| 505 COMPILE_ASSERT_MATCHING_ENUM(MetaData, METADATA); |
| 506 COMPILE_ASSERT_MATCHING_ENUM(Auto, AUTO); |
| 507 |
| 508 void WebMediaPlayerImpl::setPreload(WebKit::WebMediaPlayer::Preload preload) { |
499 DCHECK(MessageLoop::current() == main_loop_); | 509 DCHECK(MessageLoop::current() == main_loop_); |
500 | 510 |
501 return false; | 511 pipeline_->SetPreload(static_cast<media::Preload>(preload)); |
502 } | 512 } |
503 | 513 |
504 bool WebMediaPlayerImpl::totalBytesKnown() { | 514 bool WebMediaPlayerImpl::totalBytesKnown() { |
505 DCHECK(MessageLoop::current() == main_loop_); | 515 DCHECK(MessageLoop::current() == main_loop_); |
506 | 516 |
507 return pipeline_->GetTotalBytes() != 0; | 517 return pipeline_->GetTotalBytes() != 0; |
508 } | 518 } |
509 | 519 |
510 bool WebMediaPlayerImpl::hasVideo() const { | 520 bool WebMediaPlayerImpl::hasVideo() const { |
511 DCHECK(MessageLoop::current() == main_loop_); | 521 DCHECK(MessageLoop::current() == main_loop_); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 } | 917 } |
908 } | 918 } |
909 | 919 |
910 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 920 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
911 DCHECK(MessageLoop::current() == main_loop_); | 921 DCHECK(MessageLoop::current() == main_loop_); |
912 DCHECK(client_); | 922 DCHECK(client_); |
913 return client_; | 923 return client_; |
914 } | 924 } |
915 | 925 |
916 } // namespace webkit_glue | 926 } // namespace webkit_glue |
OLD | NEW |