Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: webkit/glue/webmediaplayer_impl.cc

Issue 6625059: Implementing preload=metadata for video (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « webkit/glue/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698