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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 filter_collection_->SelectVideoDecoder(&old_videodecoder); | 380 filter_collection_->SelectVideoDecoder(&old_videodecoder); |
381 media::RTCVideoDecoder* rtc_video_decoder = | 381 media::RTCVideoDecoder* rtc_video_decoder = |
382 new media::RTCVideoDecoder( | 382 new media::RTCVideoDecoder( |
383 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), | 383 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), |
384 url.spec()); | 384 url.spec()); |
385 filter_collection_->AddVideoDecoder(rtc_video_decoder); | 385 filter_collection_->AddVideoDecoder(rtc_video_decoder); |
386 } | 386 } |
387 | 387 |
388 // Handle any volume changes that occured before load(). | 388 // Handle any volume changes that occured before load(). |
389 setVolume(GetClient()->volume()); | 389 setVolume(GetClient()->volume()); |
| 390 // Get the preload value. |
| 391 setPreload(GetClient()->preload()); |
390 | 392 |
391 // Initialize the pipeline. | 393 // Initialize the pipeline. |
392 SetNetworkState(WebKit::WebMediaPlayer::Loading); | 394 SetNetworkState(WebKit::WebMediaPlayer::Loading); |
393 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); | 395 SetReadyState(WebKit::WebMediaPlayer::HaveNothing); |
394 pipeline_->Start( | 396 pipeline_->Start( |
395 filter_collection_.release(), | 397 filter_collection_.release(), |
396 url.spec(), | 398 url.spec(), |
397 NewCallback(proxy_.get(), | 399 NewCallback(proxy_.get(), |
398 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); | 400 &WebMediaPlayerImpl::Proxy::PipelineInitializationCallback)); |
399 } | 401 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 pipeline_->SetVolume(volume); | 495 pipeline_->SetVolume(volume); |
494 } | 496 } |
495 | 497 |
496 void WebMediaPlayerImpl::setVisible(bool visible) { | 498 void WebMediaPlayerImpl::setVisible(bool visible) { |
497 DCHECK(MessageLoop::current() == main_loop_); | 499 DCHECK(MessageLoop::current() == main_loop_); |
498 | 500 |
499 // TODO(hclam): add appropriate method call when pipeline has it implemented. | 501 // TODO(hclam): add appropriate method call when pipeline has it implemented. |
500 return; | 502 return; |
501 } | 503 } |
502 | 504 |
503 bool WebMediaPlayerImpl::setAutoBuffer(bool autoBuffer) { | 505 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, chromium_name) \ |
| 506 COMPILE_ASSERT(int(WebKit::WebMediaPlayer::webkit_name) == \ |
| 507 int(media::chromium_name), \ |
| 508 mismatching_enums) |
| 509 COMPILE_ASSERT_MATCHING_ENUM(None, NONE); |
| 510 COMPILE_ASSERT_MATCHING_ENUM(MetaData, METADATA); |
| 511 COMPILE_ASSERT_MATCHING_ENUM(Auto, AUTO); |
| 512 |
| 513 void WebMediaPlayerImpl::setPreload(WebKit::WebMediaPlayer::Preload preload) { |
504 DCHECK(MessageLoop::current() == main_loop_); | 514 DCHECK(MessageLoop::current() == main_loop_); |
505 | 515 |
506 return false; | 516 pipeline_->SetPreload(static_cast<media::Preload>(preload)); |
507 } | 517 } |
508 | 518 |
509 bool WebMediaPlayerImpl::totalBytesKnown() { | 519 bool WebMediaPlayerImpl::totalBytesKnown() { |
510 DCHECK(MessageLoop::current() == main_loop_); | 520 DCHECK(MessageLoop::current() == main_loop_); |
511 | 521 |
512 return pipeline_->GetTotalBytes() != 0; | 522 return pipeline_->GetTotalBytes() != 0; |
513 } | 523 } |
514 | 524 |
515 bool WebMediaPlayerImpl::hasVideo() const { | 525 bool WebMediaPlayerImpl::hasVideo() const { |
516 DCHECK(MessageLoop::current() == main_loop_); | 526 DCHECK(MessageLoop::current() == main_loop_); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 } | 922 } |
913 } | 923 } |
914 | 924 |
915 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 925 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
916 DCHECK(MessageLoop::current() == main_loop_); | 926 DCHECK(MessageLoop::current() == main_loop_); |
917 DCHECK(client_); | 927 DCHECK(client_); |
918 return client_; | 928 return client_; |
919 } | 929 } |
920 | 930 |
921 } // namespace webkit_glue | 931 } // namespace webkit_glue |
OLD | NEW |