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

Side by Side Diff: webkit/media/android/webmediaplayer_android.cc

Issue 11442056: Add external surface rendering mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add getPersonality() Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/android/webmediaplayer_android.h" 5 #include "webkit/media/android/webmediaplayer_android.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "media/base/android/media_player_bridge.h" 9 #include "media/base/android/media_player_bridge.h"
10 #include "net/base/mime_util.h" 10 #include "net/base/mime_util.h"
(...skipping 24 matching lines...) Expand all
35 main_loop_(MessageLoop::current()), 35 main_loop_(MessageLoop::current()),
36 pending_seek_(0), 36 pending_seek_(0),
37 seeking_(false), 37 seeking_(false),
38 did_loading_progress_(false), 38 did_loading_progress_(false),
39 manager_(manager), 39 manager_(manager),
40 network_state_(WebMediaPlayer::NetworkStateEmpty), 40 network_state_(WebMediaPlayer::NetworkStateEmpty),
41 ready_state_(WebMediaPlayer::ReadyStateHaveNothing), 41 ready_state_(WebMediaPlayer::ReadyStateHaveNothing),
42 is_playing_(false), 42 is_playing_(false),
43 needs_establish_peer_(true), 43 needs_establish_peer_(true),
44 has_size_info_(false), 44 has_size_info_(false),
45 is_in_video_view_(false),
45 stream_texture_factory_(factory) { 46 stream_texture_factory_(factory) {
46 main_loop_->AddDestructionObserver(this); 47 main_loop_->AddDestructionObserver(this);
47 if (manager_) 48 if (manager_)
48 player_id_ = manager_->RegisterMediaPlayer(this); 49 player_id_ = manager_->RegisterMediaPlayer(this);
49 50
50 if (stream_texture_factory_.get()) { 51 if (stream_texture_factory_.get()) {
51 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy()); 52 stream_texture_proxy_.reset(stream_texture_factory_->CreateProxy());
52 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_); 53 stream_id_ = stream_texture_factory_->CreateStreamTexture(&texture_id_);
53 ReallocateVideoFrame(); 54 ReallocateVideoFrame();
54 } 55 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 video_frame_.reset(); 370 video_frame_.reset();
370 371
371 if (manager_) 372 if (manager_)
372 manager_->UnregisterMediaPlayer(player_id_); 373 manager_->UnregisterMediaPlayer(player_id_);
373 374
374 manager_ = NULL; 375 manager_ = NULL;
375 main_loop_ = NULL; 376 main_loop_ = NULL;
376 } 377 }
377 378
378 void WebMediaPlayerAndroid::ReallocateVideoFrame() { 379 void WebMediaPlayerAndroid::ReallocateVideoFrame() {
379 if (texture_id_) { 380 unsigned int texture_id = texture_id_;
qinmin 2012/12/17 19:34:06 you also want to change the ctor of this class, to
wonsik2 2013/02/14 14:56:38 I think it might make sense to support them both a
380 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture( 381 if (is_in_video_view_) {
381 texture_id_, kGLTextureExternalOES, natural_size_, 382 texture_id = 0;
382 gfx::Rect(natural_size_), natural_size_, base::TimeDelta(), 383 } else if (texture_id_ == 0) {
383 VideoFrame::ReadPixelsCB(), 384 return;
384 base::Closure())));
385 } 385 }
386 video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture(
387 texture_id, kGLTextureExternalOES, natural_size_,
388 gfx::Rect(natural_size_), natural_size_, base::TimeDelta(),
389 VideoFrame::ReadPixelsCB(),
390 base::Closure())));
386 } 391 }
387 392
388 WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() { 393 WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() {
389 if (stream_texture_proxy_.get() && !stream_texture_proxy_->IsInitialized() 394 if (stream_texture_proxy_.get() && !stream_texture_proxy_->IsInitialized()
390 && stream_id_) { 395 && stream_id_) {
391 stream_texture_proxy_->Initialize( 396 stream_texture_proxy_->Initialize(
392 stream_id_, video_frame_->width(), video_frame_->height()); 397 stream_id_, video_frame_->width(), video_frame_->height());
393 } 398 }
394 399
395 return video_frame_.get(); 400 return video_frame_.get();
(...skipping 12 matching lines...) Expand all
408 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() { 413 void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() {
409 if (stream_texture_factory_.get() && stream_id_) 414 if (stream_texture_factory_.get() && stream_id_)
410 stream_texture_factory_->EstablishPeer(stream_id_, player_id_); 415 stream_texture_factory_->EstablishPeer(stream_id_, player_id_);
411 needs_establish_peer_ = false; 416 needs_establish_peer_ = false;
412 } 417 }
413 418
414 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) { 419 void WebMediaPlayerAndroid::SetNeedsEstablishPeer(bool needs_establish_peer) {
415 needs_establish_peer_ = needs_establish_peer; 420 needs_establish_peer_ = needs_establish_peer;
416 } 421 }
417 422
423 void WebMediaPlayerAndroid::SetIsInVideoView(bool is_in_video_view) {
424 is_in_video_view_ = is_in_video_view;;
425 ReallocateVideoFrame();
426 }
427
418 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) { 428 void WebMediaPlayerAndroid::UpdatePlayingState(bool is_playing) {
419 is_playing_ = is_playing; 429 is_playing_ = is_playing;
420 } 430 }
421 431
422 } // namespace webkit_media 432 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698